This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

The following commit(s) were added to refs/heads/master by this push:
     new 1356714d11 avcodec/nvenc: force frameIntervalP=1 for H.264 Baseline 
profile
1356714d11 is described below

commit 1356714d11b2885edfe7cdc26cb7cb256ea2c485
Author:     Diego de Souza <[email protected]>
AuthorDate: Mon May 18 16:05:06 2026 +0200
Commit:     Timo Rothenpieler <[email protected]>
CommitDate: Mon May 18 18:38:06 2026 +0000

    avcodec/nvenc: force frameIntervalP=1 for H.264 Baseline profile
    
    H.264 Baseline profile cannot contain B-frames, but the NVENC preset
    defaults and the max_b_frames-derived frameIntervalP override leave
    frameIntervalP > 1 when -profile:v baseline is requested. The
    unconditional check at the end of nvenc_setup_encoder() then sets
    has_b_frames = 2, which propagates to the muxer and causes
    compute_muxer_pkt_fields() to back-calculate
    DTS = PTS - (delay + 1) * frame_duration. The resulting bitstream
    contains no B-frames, yet every packet has a spurious 3-frame PTS/DTS
    gap, breaking MPEG-TS/HLS output and DTS-based players.
    
    This patch forces frameIntervalP to 1 in the Baseline branch of
    nvenc_setup_h264_config() and warn if the user (or preset) had asked
    for B-frames. The later has_b_frames assignment then sees the corrected
    value and leaves avctx->has_b_frames at 0.
    
    Fixes #22727.
    
    Signed-off-by: Diego de Souza <[email protected]>
---
 libavcodec/nvenc.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index a8dac1ebd3..7b9f7260df 100644
--- a/libavcodec/nvenc.c
+++ b/libavcodec/nvenc.c
@@ -1358,6 +1358,11 @@ static av_cold int 
nvenc_setup_h264_config(AVCodecContext *avctx)
         case NV_ENC_H264_PROFILE_BASELINE:
             cc->profileGUID = NV_ENC_H264_PROFILE_BASELINE_GUID;
             avctx->profile = AV_PROFILE_H264_BASELINE;
+            if (cc->frameIntervalP > 1) {
+                av_log(avctx, AV_LOG_WARNING,
+                       "B-frames are not supported by H.264 Baseline profile, 
disabling.\n");
+                cc->frameIntervalP = 1;
+            }
             break;
         case NV_ENC_H264_PROFILE_MAIN:
             cc->profileGUID = NV_ENC_H264_PROFILE_MAIN_GUID;

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

Reply via email to