Since a0949d0bcb0eee2f3fffcf9a4810c0295d14c0dc, the b-frames
setting defaults to -1, which uses the preset's default setting.

If b-frames are enabled, but max_b_frames is kept at <= 0, the
output dts are inconsistent.
---
 libavcodec/nvenc.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index a061dee880..6baeec6d36 100644
--- a/libavcodec/nvenc.c
+++ b/libavcodec/nvenc.c
@@ -1380,8 +1380,11 @@ static av_cold int nvenc_setup_encoder(AVCodecContext 
*avctx)
     if (res < 0)
         return res;
 
-    if (ctx->encode_config.frameIntervalP > 1)
+    if (ctx->encode_config.frameIntervalP > 1) {
         avctx->has_b_frames = 2;
+        if (avctx->max_b_frames <= 0)
+            avctx->max_b_frames = 1;
+    }
 
     if (ctx->encode_config.rcParams.averageBitRate > 0)
         avctx->bit_rate = ctx->encode_config.rcParams.averageBitRate;
-- 
2.24.3 (Apple Git-128)

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to