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

Read interlace_mode from the ProRes frame header and signal interlaced ProRes
as separate fields. Bottom field first uses FieldDominance 2 and
DisplayF2Offset -1, per RDD 44 Table 6.

Checked on 1080i ProRes muxed to OP1a: TFF writes FieldDominance 1 /
DisplayF2Offset 0, BFF writes FieldDominance 2 / DisplayF2Offset -1.
No FATE ref changes.

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



From 790b6a0451c5832c3ebc98f5776d2f579e5dab3f Mon Sep 17 00:00:00 2001
From: Baptiste Coudurier <[email protected]>
Date: Fri, 13 Nov 2026 16:27:19 -0800
Subject: [PATCH] avformat/mxfenc: signal interlaced ProRes

Use separate fields for interlaced ProRes, and DisplayF2Offset -1 for
bottom field first, per RDD 44 Table 6.

Signed-off-by: Baptiste Coudurier <[email protected]>
---
 libavformat/mxfenc.c | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c
index 867a4abd4d2..35b2c7242c1 100644
--- a/libavformat/mxfenc.c
+++ b/libavformat/mxfenc.c
@@ -107,6 +107,7 @@ typedef struct MXFStreamContext {
     int order;               ///< interleaving order if dts are equal
     int interlaced;          ///< whether picture is interlaced
     int field_dominance;     ///< tff=1, bff=2
+    int display_f2_offset;   ///< DisplayF2Offset, 0 or -1
     int signal_standard;
     int temporal_reordering;
     AVRational aspect_ratio; ///< display aspect ratio
@@ -1334,7 +1335,7 @@ static int64_t 
mxf_write_generic_picture_desc(AVFormatContext *s, AVStream *st)
     if (sc->interlaced) {
         //Display F2 Offset
         mxf_write_local_tag(s, 4, 0x3217);
-        avio_wb32(pb, -((st->codecpar->height - display_height)&1));
+        avio_wb32(pb, sc->display_f2_offset);
     }
 
     if (sc->picture_descriptor_key == &mxf_rgba_descriptor_key) {
@@ -2327,6 +2328,23 @@ static int mxf_parse_prores_frame(AVFormatContext *s, 
AVStream *st, AVPacket *pk
     if (i == FF_ARRAY_ELEMS(mxf_prores_codec_uls))
         return 0;
 
+    if (pkt->size < 28 || AV_RB32(pkt->data + 4) != MKBETAG('i','c','p','f'))
+        return 0;
+
+    // interlace_mode: 1 top field first, 2 bottom field first,
+    // RDD 44 Table 6 also signals bottom field first with DisplayF2Offset -1
+    switch ((pkt->data[8 + 12] >> 2) & 3) {
+    case 1:
+        sc->interlaced = 1;
+        sc->field_dominance = 1;
+        break;
+    case 2:
+        sc->interlaced = 1;
+        sc->field_dominance = 2;
+        sc->display_f2_offset = -1;
+        break;
+    }
+
     sc->frame_size = pkt->size;
 
     return 1;
-- 
2.54.0

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

Reply via email to