[FFmpeg-cvslog] avcodec/videotoolboxenc: Fix bitrate doesn't work as expected

Zhao Zhili git at videolan.org
Fri Jul 26 15:21:22 EEST 2024


ffmpeg | branch: release/6.1 | Zhao Zhili <zhilizhao at tencent.com> | Tue Jul 16 20:59:52 2024 +0800| [a339afbe3c2f2455872e741ce2479dea913508b2] | committer: Zhao Zhili

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

Commit 4ef5e7d4722 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 at tencent.com>
(cherry picked from commit d07da7539d54c0ce71e06a577eb1fa3036467449)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a339afbe3c2f2455872e741ce2479dea913508b2
---

 libavcodec/videotoolboxenc.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
index b0e827d14a..3e74b59629 100644
--- a/libavcodec/videotoolboxenc.c
+++ b/libavcodec/videotoolboxenc.c
@@ -2890,6 +2890,12 @@ static const AVOption h264_options[] = {
     { NULL },
 };
 
+static const FFCodecDefault vt_defaults[] = {
+        {"qmin", "-1"},
+        {"qmax", "-1"},
+        {NULL},
+};
+
 static const AVClass h264_videotoolbox_class = {
     .class_name = "h264_videotoolbox",
     .item_name  = av_default_item_name,
@@ -2905,6 +2911,7 @@ const FFCodec ff_h264_videotoolbox_encoder = {
     .p.capabilities   = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY,
     .priv_data_size   = sizeof(VTEncContext),
     .p.pix_fmts       = avc_pix_fmts,
+    .defaults         = vt_defaults,
     .init             = vtenc_init,
     FF_CODEC_ENCODE_CB(vtenc_frame),
     .close            = vtenc_close,
@@ -2942,6 +2949,7 @@ const FFCodec ff_hevc_videotoolbox_encoder = {
                         AV_CODEC_CAP_HARDWARE,
     .priv_data_size   = sizeof(VTEncContext),
     .p.pix_fmts       = hevc_pix_fmts,
+    .defaults         = vt_defaults,
     .init             = vtenc_init,
     FF_CODEC_ENCODE_CB(vtenc_frame),
     .close            = vtenc_close,
@@ -2981,6 +2989,7 @@ const FFCodec ff_prores_videotoolbox_encoder = {
                         AV_CODEC_CAP_HARDWARE,
     .priv_data_size   = sizeof(VTEncContext),
     .p.pix_fmts       = prores_pix_fmts,
+    .defaults         = vt_defaults,
     .init             = vtenc_init,
     FF_CODEC_ENCODE_CB(vtenc_frame),
     .close            = vtenc_close,



More information about the ffmpeg-cvslog mailing list