PR #26154 opened by Baptiste Coudurier (bcoudurier)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/26154
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/26154.patch

Key frames of codecs without sequence headers (ProRes, JPEG 2000, FFV1) were 
never flagged as random access points in the index (ST 377-1 Table 28, bit 7 of 
the flags).

MPEG-2 and H.264 keep their existing handling. The mxf_ffv1 and 
mxf-remux-applehdr10 refs change accordingly.

🤖 Generated with [Claude Code](https://claude.com/claude-code)



From ddd0e851b411b20b5a88b87b827452b2f38604f6 Mon Sep 17 00:00:00 2001
From: Baptiste Coudurier <[email protected]>
Date: Fri, 13 Nov 2026 16:25:24 -0800
Subject: [PATCH] avformat/mxfenc: set the random access flag for intra codecs

Key frames of codecs without sequence headers (ProRes, JPEG 2000, FFV1)
were never flagged as random access points in the index.

Signed-off-by: Baptiste Coudurier <[email protected]>
---
 libavformat/mxfenc.c                | 7 +++++++
 tests/ref/fate/mxf-remux-applehdr10 | 2 +-
 tests/ref/lavf/mxf_ffv1             | 2 +-
 3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c
index 66528d5e358..aa18982b691 100644
--- a/libavformat/mxfenc.c
+++ b/libavformat/mxfenc.c
@@ -3401,6 +3401,13 @@ static int mxf_write_packet(AVFormatContext *s, AVPacket 
*pkt)
         }
     }
 
+    // codecs without sequence headers: every key frame is a random access 
point
+    if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO &&
+        st->codecpar->codec_id != AV_CODEC_ID_MPEG2VIDEO &&
+        st->codecpar->codec_id != AV_CODEC_ID_H264 &&
+        pkt->flags & AV_PKT_FLAG_KEY)
+        ie.flags |= 0x80;
+
     if (mxf->cbr_index) {
         if (pkt->size != sc->frame_size && st->codecpar->codec_type == 
AVMEDIA_TYPE_VIDEO) {
             av_log(s, AV_LOG_ERROR, "track %d: frame size does not match index 
unit size, %d != %d\n",
diff --git a/tests/ref/fate/mxf-remux-applehdr10 
b/tests/ref/fate/mxf-remux-applehdr10
index 9fbf8b60c74..e5bd4c959fa 100644
--- a/tests/ref/fate/mxf-remux-applehdr10
+++ b/tests/ref/fate/mxf-remux-applehdr10
@@ -1,4 +1,4 @@
-5e03bad42adeb396b6614890f30aefba *tests/data/fate/mxf-remux-applehdr10.mxf
+746c72480f46876bd7de0d17aaa963e1 *tests/data/fate/mxf-remux-applehdr10.mxf
 323641 tests/data/fate/mxf-remux-applehdr10.mxf
 #tb 0: 1001/60000
 #media_type 0: video
diff --git a/tests/ref/lavf/mxf_ffv1 b/tests/ref/lavf/mxf_ffv1
index 4ae93b2e892..1fcf09250a4 100644
--- a/tests/ref/lavf/mxf_ffv1
+++ b/tests/ref/lavf/mxf_ffv1
@@ -1,3 +1,3 @@
-67638015788bb7dfcc1c16183967b513 *tests/data/lavf/lavf.mxf_ffv1
+bf91a74a741da5435ff4577358c269f8 *tests/data/lavf/lavf.mxf_ffv1
 5587001 tests/data/lavf/lavf.mxf_ffv1
 tests/data/lavf/lavf.mxf_ffv1 CRC=0x02354cdc
-- 
2.54.0

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

Reply via email to