mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-11-26 19:01:44 +02:00
lavc/qsvenc: use VBR if maxrate is not specified on Windows
Currently AVBR is disabled and VBR is the default method if maxrate is not specified on Linux, but AVBR is the default one if maxrate is not specified on Windows. In order to make user experience better accross Linux and Windows, use VBR by default on Windows if maxrate is not specified. User need to set both avbr_accuracy and avbr_convergence to non-zero explicitly and not to specify maxrate if AVBR is expected. In addition, AVBR works for H264 and HEVC only in the SDK. $ ffmpeg.exe -v verbose -f lavfi -i yuvtestsrc -vf "format=nv12" -c:v vp9_qsv -f null -
This commit is contained in:
parent
ff6f2c5586
commit
a5b6e29227
@ -3244,9 +3244,9 @@ the average bitrate.
|
||||
than the average bitrate.
|
||||
|
||||
@item
|
||||
@var{AVBR} - average VBR mode, when @option{maxrate} is not specified. This mode
|
||||
is further configured by the @option{avbr_accuracy} and
|
||||
@option{avbr_convergence} options.
|
||||
@var{AVBR} - average VBR mode, when @option{maxrate} is not specified, both
|
||||
@option{avbr_accuracy} and @option{avbr_convergence} are set to non-zero. This
|
||||
mode is available for H264 and HEVC on Windows.
|
||||
@end itemize
|
||||
@end itemize
|
||||
|
||||
@ -3300,19 +3300,6 @@ Specifies how many asynchronous operations an application performs
|
||||
before the application explicitly synchronizes the result. If zero,
|
||||
the value is not specified.
|
||||
|
||||
@item @var{avbr_accuracy}
|
||||
Accuracy of the AVBR ratecontrol (unit of tenth of percent).
|
||||
|
||||
@item @var{avbr_convergence}
|
||||
Convergence of the AVBR ratecontrol (unit of 100 frames)
|
||||
|
||||
The parameters @var{avbr_accuracy} and @var{avbr_convergence} are for the
|
||||
average variable bitrate control (AVBR) algorithm.
|
||||
The algorithm focuses on overall encoding quality while meeting the specified
|
||||
bitrate, @var{target_bitrate}, within the accuracy range @var{avbr_accuracy},
|
||||
after a @var{avbr_Convergence} period. This method does not follow HRD and the
|
||||
instant bitrate is not capped or padded.
|
||||
|
||||
@item @var{preset}
|
||||
This option itemizes a range of choices from veryfast (best speed) to veryslow
|
||||
(best quality).
|
||||
@ -3518,6 +3505,19 @@ Provides a hint to encoder about the scenario for the encoding session.
|
||||
@item remotegaming
|
||||
@end table
|
||||
|
||||
@item @var{avbr_accuracy}
|
||||
Accuracy of the AVBR ratecontrol (unit of tenth of percent).
|
||||
|
||||
@item @var{avbr_convergence}
|
||||
Convergence of the AVBR ratecontrol (unit of 100 frames)
|
||||
|
||||
The parameters @var{avbr_accuracy} and @var{avbr_convergence} are for the
|
||||
average variable bitrate control (AVBR) algorithm.
|
||||
The algorithm focuses on overall encoding quality while meeting the specified
|
||||
bitrate, @var{target_bitrate}, within the accuracy range @var{avbr_accuracy},
|
||||
after a @var{avbr_Convergence} period. This method does not follow HRD and the
|
||||
instant bitrate is not capped or padded.
|
||||
|
||||
@end table
|
||||
|
||||
@subsection HEVC Options
|
||||
@ -3681,6 +3681,19 @@ Provides a hint to encoder about the scenario for the encoding session.
|
||||
@item remotegaming
|
||||
@end table
|
||||
|
||||
@item @var{avbr_accuracy}
|
||||
Accuracy of the AVBR ratecontrol (unit of tenth of percent).
|
||||
|
||||
@item @var{avbr_convergence}
|
||||
Convergence of the AVBR ratecontrol (unit of 100 frames)
|
||||
|
||||
The parameters @var{avbr_accuracy} and @var{avbr_convergence} are for the
|
||||
average variable bitrate control (AVBR) algorithm.
|
||||
The algorithm focuses on overall encoding quality while meeting the specified
|
||||
bitrate, @var{target_bitrate}, within the accuracy range @var{avbr_accuracy},
|
||||
after a @var{avbr_Convergence} period. This method does not follow HRD and the
|
||||
instant bitrate is not capped or padded.
|
||||
|
||||
@end table
|
||||
|
||||
@subsection MPEG2 Options
|
||||
|
@ -479,7 +479,10 @@ static int select_rc_mode(AVCodecContext *avctx, QSVEncContext *q)
|
||||
rc_desc = "constant bitrate (CBR)";
|
||||
}
|
||||
#if QSV_HAVE_AVBR
|
||||
else if (!avctx->rc_max_rate) {
|
||||
else if (!avctx->rc_max_rate &&
|
||||
(avctx->codec_id == AV_CODEC_ID_H264 || avctx->codec_id == AV_CODEC_ID_HEVC) &&
|
||||
q->avbr_accuracy &&
|
||||
q->avbr_convergence) {
|
||||
rc_mode = MFX_RATECONTROL_AVBR;
|
||||
rc_desc = "average variable bitrate (AVBR)";
|
||||
}
|
||||
|
@ -52,8 +52,6 @@
|
||||
|
||||
#define QSV_COMMON_OPTS \
|
||||
{ "async_depth", "Maximum processing parallelism", OFFSET(qsv.async_depth), AV_OPT_TYPE_INT, { .i64 = ASYNC_DEPTH_DEFAULT }, 1, INT_MAX, VE }, \
|
||||
{ "avbr_accuracy", "Accuracy of the AVBR ratecontrol (unit of tenth of percent)", OFFSET(qsv.avbr_accuracy), AV_OPT_TYPE_INT, { .i64 = 1 }, 1, UINT16_MAX, VE }, \
|
||||
{ "avbr_convergence", "Convergence of the AVBR ratecontrol (unit of 100 frames)", OFFSET(qsv.avbr_convergence), AV_OPT_TYPE_INT, { .i64 = 1 }, 1, UINT16_MAX, VE }, \
|
||||
{ "preset", NULL, OFFSET(qsv.preset), AV_OPT_TYPE_INT, { .i64 = MFX_TARGETUSAGE_BALANCED }, MFX_TARGETUSAGE_BEST_QUALITY, MFX_TARGETUSAGE_BEST_SPEED, VE, "preset" }, \
|
||||
{ "veryfast", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_TARGETUSAGE_BEST_SPEED }, INT_MIN, INT_MAX, VE, "preset" }, \
|
||||
{ "faster", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_TARGETUSAGE_6 }, INT_MIN, INT_MAX, VE, "preset" }, \
|
||||
@ -124,6 +122,10 @@
|
||||
{ "gamestreaming", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_SCENARIO_GAME_STREAMING }, .flags = VE, "scenario" }, \
|
||||
{ "remotegaming", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_SCENARIO_REMOTE_GAMING }, .flags = VE, "scenario" },
|
||||
|
||||
#define QSV_OPTION_AVBR \
|
||||
{ "avbr_accuracy", "Accuracy of the AVBR ratecontrol (unit of tenth of percent)", OFFSET(qsv.avbr_accuracy), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, UINT16_MAX, VE }, \
|
||||
{ "avbr_convergence", "Convergence of the AVBR ratecontrol (unit of 100 frames)", OFFSET(qsv.avbr_convergence), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, UINT16_MAX, VE },
|
||||
|
||||
extern const AVCodecHWConfigInternal *const ff_qsv_enc_hw_configs[];
|
||||
|
||||
typedef int SetEncodeCtrlCB (AVCodecContext *avctx,
|
||||
|
@ -115,6 +115,7 @@ static const AVOption options[] = {
|
||||
QSV_OPTION_LOW_DELAY_BRC
|
||||
QSV_OPTION_MAX_MIN_QP
|
||||
QSV_OPTION_SCENARIO
|
||||
QSV_OPTION_AVBR
|
||||
|
||||
{ "cavlc", "Enable CAVLC", OFFSET(qsv.cavlc), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
|
||||
#if QSV_HAVE_VCM
|
||||
|
@ -236,6 +236,7 @@ static const AVOption options[] = {
|
||||
QSV_OPTION_ADAPTIVE_I
|
||||
QSV_OPTION_ADAPTIVE_B
|
||||
QSV_OPTION_SCENARIO
|
||||
QSV_OPTION_AVBR
|
||||
|
||||
{ "idr_interval", "Distance (in I-frames) between IDR frames", OFFSET(qsv.idr_interval), AV_OPT_TYPE_INT, { .i64 = 0 }, -1, INT_MAX, VE, "idr_interval" },
|
||||
{ "begin_only", "Output an IDR-frame only at the beginning of the stream", 0, AV_OPT_TYPE_CONST, { .i64 = -1 }, 0, 0, VE, "idr_interval" },
|
||||
|
Loading…
Reference in New Issue
Block a user