PR #21774 opened by Diego de Souza (ddesouza)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21774
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21774.patch

For AV1, NV_ENC_BFRAME_REF_MODE_MIDDLE does not use a single middle
B-frame. Per the NVENC Programming Guide, it sets every other B-frame
as an Altref2 reference except the last B-frame in the Altref interval.

Signed-off-by: Diego de Souza <[email protected]>


>From 2b8cffea34d04d1542360e84e1ed469be7970f54 Mon Sep 17 00:00:00 2001
From: Diego de Souza <[email protected]>
Date: Tue, 17 Feb 2026 17:04:18 +0100
Subject: [PATCH] avcodec/nvenc_av1: fix b_ref_mode "middle" help string for
 AV1

For AV1, NV_ENC_BFRAME_REF_MODE_MIDDLE does not use a single middle
B-frame. Per the NVENC Programming Guide, it sets every other B-frame
as an Altref2 reference except the last B-frame in the Altref interval.

Signed-off-by: Diego de Souza <[email protected]>
---
 libavcodec/nvenc_av1.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/nvenc_av1.c b/libavcodec/nvenc_av1.c
index 446ba684e6..98fcc76e39 100644
--- a/libavcodec/nvenc_av1.c
+++ b/libavcodec/nvenc_av1.c
@@ -143,7 +143,7 @@ static const AVOption options[] = {
     { "b_ref_mode",   "Use B frames as references",         
OFFSET(b_ref_mode),   AV_OPT_TYPE_INT,   { .i64 = -1 }, -1, 
NV_ENC_BFRAME_REF_MODE_MIDDLE, VE, .unit = "b_ref_mode" },
     { "disabled",     "B frames will not be used for reference", 0,            
   AV_OPT_TYPE_CONST, { .i64 = NV_ENC_BFRAME_REF_MODE_DISABLED }, 0, 0, VE, 
.unit = "b_ref_mode" },
     { "each",         "Each B frame will be used for reference", 0,            
   AV_OPT_TYPE_CONST, { .i64 = NV_ENC_BFRAME_REF_MODE_EACH }, 0, 0, VE, .unit = 
"b_ref_mode" },
-    { "middle",       "Only (number of B frames)/2 will be used for 
reference", 0,AV_OPT_TYPE_CONST, { .i64 = NV_ENC_BFRAME_REF_MODE_MIDDLE },  0, 
0, VE, .unit = "b_ref_mode" },
+    { "middle",       "Every other B-frame as Altref2 reference, except last 
in Altref interval", 0, AV_OPT_TYPE_CONST, { .i64 = 
NV_ENC_BFRAME_REF_MODE_MIDDLE }, 0, 0, VE, .unit = "b_ref_mode" },
     { "dpb_size",     "Specifies the DPB size used for encoding (0 means 
automatic)",
                                                             OFFSET(dpb_size),  
   AV_OPT_TYPE_INT,   { .i64 = 0 }, 0, INT_MAX, VE },
     { "ldkfs",        "Low delay key frame scale; Specifies the Scene Change 
frame size increase allowed in case of single frame VBV and CBR",
-- 
2.52.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to