Commit 8062f4c0e6 for ffmpeg
commit 8062f4c0e669fc8417f7b24de9170552fba66515
Author: Kyle Maclean <kyle@maclean.co.za>
Date: Sat Dec 5 21:21:01 2026 +0000
avcodec/nvenc: treat a GOP size of 1 as intra-only
A GOP size of 1 set only gopLength. The line deriving frameIntervalP
from max_b_frames runs only for GOP lengths above 1, so the preset's
frameIntervalP was kept, and the driver refused to initialise the
encoder ("Gop Length should be greater than number of B frames + 1"),
also with -bf 0.
A GOP of one frame holds only intra frames, so set frameIntervalP to
0 for a GOP size of 1, as is already done for 0.
Fixes #26639.
Signed-off-by: Kyle Maclean <kyle@maclean.co.za>
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index 48fc8df7ad..4228b8d0bf 100644
--- a/libavcodec/nvenc.c
+++ b/libavcodec/nvenc.c
@@ -1780,10 +1780,10 @@ static av_cold int nvenc_setup_encoder(AVCodecContext *avctx)
}
}
- if (avctx->gop_size > 0) {
+ if (avctx->gop_size > 1) {
// only overwrite preset if a GOP size was selected as input
ctx->encode_config.gopLength = avctx->gop_size;
- } else if (avctx->gop_size == 0) {
+ } else if (avctx->gop_size >= 0) {
ctx->encode_config.frameIntervalP = 0;
ctx->encode_config.gopLength = 1;
}