1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-01-08 13:22:53 +02:00

avcodec/videotoolboxenc: Fix bitrate doesn't work as expected

Commit 4ef5e7d472 add qmin/qmax support to videotoolbox encoder.
The default value of (qmin, qmax) is (2, 31), which makes bitrate
control doesn't work as users' expectations.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
(cherry picked from commit d07da7539d)
This commit is contained in:
Zhao Zhili 2024-07-16 20:59:52 +08:00
parent 5f953ac26f
commit a83c1a3db9

View File

@ -2905,6 +2905,12 @@ static const AVOption h264_options[] = {
{ NULL }, { NULL },
}; };
static const FFCodecDefault vt_defaults[] = {
{"qmin", "-1"},
{"qmax", "-1"},
{NULL},
};
static const AVClass h264_videotoolbox_class = { static const AVClass h264_videotoolbox_class = {
.class_name = "h264_videotoolbox", .class_name = "h264_videotoolbox",
.item_name = av_default_item_name, .item_name = av_default_item_name,
@ -2920,6 +2926,7 @@ const FFCodec ff_h264_videotoolbox_encoder = {
.p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY, .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY,
.priv_data_size = sizeof(VTEncContext), .priv_data_size = sizeof(VTEncContext),
.p.pix_fmts = avc_pix_fmts, .p.pix_fmts = avc_pix_fmts,
.defaults = vt_defaults,
.init = vtenc_init, .init = vtenc_init,
FF_CODEC_ENCODE_CB(vtenc_frame), FF_CODEC_ENCODE_CB(vtenc_frame),
.close = vtenc_close, .close = vtenc_close,
@ -2957,6 +2964,7 @@ const FFCodec ff_hevc_videotoolbox_encoder = {
AV_CODEC_CAP_HARDWARE, AV_CODEC_CAP_HARDWARE,
.priv_data_size = sizeof(VTEncContext), .priv_data_size = sizeof(VTEncContext),
.p.pix_fmts = hevc_pix_fmts, .p.pix_fmts = hevc_pix_fmts,
.defaults = vt_defaults,
.init = vtenc_init, .init = vtenc_init,
FF_CODEC_ENCODE_CB(vtenc_frame), FF_CODEC_ENCODE_CB(vtenc_frame),
.close = vtenc_close, .close = vtenc_close,
@ -2996,6 +3004,7 @@ const FFCodec ff_prores_videotoolbox_encoder = {
AV_CODEC_CAP_HARDWARE, AV_CODEC_CAP_HARDWARE,
.priv_data_size = sizeof(VTEncContext), .priv_data_size = sizeof(VTEncContext),
.p.pix_fmts = prores_pix_fmts, .p.pix_fmts = prores_pix_fmts,
.defaults = vt_defaults,
.init = vtenc_init, .init = vtenc_init,
FF_CODEC_ENCODE_CB(vtenc_frame), FF_CODEC_ENCODE_CB(vtenc_frame),
.close = vtenc_close, .close = vtenc_close,