[FFmpeg-cvslog] avcodec/nvenc: fix vbv buffer size in cq mode

Timo Rothenpieler git at videolan.org
Thu Dec 8 13:38:45 EET 2022


ffmpeg | branch: release/5.1 | Timo Rothenpieler <timo at rothenpieler.org> | Thu Dec  8 12:31:00 2022 +0100| [807afa59cca8f6019c4be4043de87a52ee11741c] | committer: Timo Rothenpieler

avcodec/nvenc: fix vbv buffer size in cq mode

The CQ calculation gets thrown off and behaves very nonsensical
if it isn't set to 0.

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

 libavcodec/nvenc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index e19378736f..4450df774c 100644
--- a/libavcodec/nvenc.c
+++ b/libavcodec/nvenc.c
@@ -1083,8 +1083,9 @@ static av_cold void nvenc_setup_rate_control(AVCodecContext *avctx)
 
         av_log(avctx, AV_LOG_VERBOSE, "CQ(%d) mode enabled.\n", tmp_quality);
 
-        //CQ mode shall discard avg bitrate & honor max bitrate;
+        // CQ mode shall discard avg bitrate/vbv buffer size and honor only max bitrate
         ctx->encode_config.rcParams.averageBitRate = avctx->bit_rate = 0;
+        ctx->encode_config.rcParams.vbvBufferSize = avctx->rc_buffer_size = 0;
         ctx->encode_config.rcParams.maxBitRate = avctx->rc_max_rate;
     }
 }



More information about the ffmpeg-cvslog mailing list