[FFmpeg-cvslog] avcodec/nvenc: Add support for 2pass rc in vbr mode

Timo Rothenpieler git at videolan.org
Tue Aug 4 21:46:09 CEST 2015


ffmpeg | branch: master | Timo Rothenpieler <timo at rothenpieler.org> | Tue Aug  4 19:57:10 2015 +0200| [2ae45816b2f38928f69b01736ce56298ff1cbcb6] | committer: Timo Rothenpieler

avcodec/nvenc: Add support for 2pass rc in vbr mode

Thanks to WereCatf for pointing out this now exists.

Github: Closes #143

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

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

diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index d9dcf96..5490652 100644
--- a/libavcodec/nvenc.c
+++ b/libavcodec/nvenc.c
@@ -791,7 +791,16 @@ static av_cold int nvenc_encode_init(AVCodecContext *avctx)
         avctx->qmin = -1;
         avctx->qmax = -1;
     } else if (avctx->qmin >= 0 && avctx->qmax >= 0) {
-        ctx->encode_config.rcParams.rateControlMode = NV_ENC_PARAMS_RC_VBR;
+        if (ctx->twopass == 1) {
+            ctx->encode_config.rcParams.rateControlMode = NV_ENC_PARAMS_RC_2_PASS_VBR;
+
+            if (avctx->codec->id == AV_CODEC_ID_H264) {
+                ctx->encode_config.encodeCodecConfig.h264Config.adaptiveTransformMode = NV_ENC_H264_ADAPTIVE_TRANSFORM_ENABLE;
+                ctx->encode_config.encodeCodecConfig.h264Config.fmoMode = NV_ENC_H264_FMO_DISABLE;
+            }
+        } else {
+            ctx->encode_config.rcParams.rateControlMode = NV_ENC_PARAMS_RC_VBR;
+        }
 
         ctx->encode_config.rcParams.enableMinQP = 1;
         ctx->encode_config.rcParams.enableMaxQP = 1;



More information about the ffmpeg-cvslog mailing list