[FFmpeg-devel] [PATCH 2/3] avformat/mov: Populate packet duration using stts atom instead of guessing

James Almer jamrial at gmail.com
Thu Nov 21 05:23:41 EET 2024


From: Darren Mo <fumoboy007 at me.com>

Fixes tickets #7855 and #11312.

Co-authored-by: James Almer <jamrial at gmail.com>
Signed-off-by: James Almer <jamrial at gmail.com>
---
This is an alternative, better approach to the same issue.

 libavformat/isom.h                            |   3 +
 libavformat/mov.c                             | 180 ++++++++++++++++--
 tests/ref/fate/copy-trac236                   |   4 +-
 tests/ref/fate/filter-fps                     |   1 +
 tests/ref/fate/filter-fps-cfr                 |   1 +
 tests/ref/fate/filter-meta-4560-rotate0       |   4 +-
 tests/ref/fate/gaplessenc-itunes-to-ipod-aac  |   2 +-
 tests/ref/fate/matroska-dovi-write-config8    |   4 +-
 .../fate/matroska-non-rotation-displaymatrix  |   6 +-
 tests/ref/fate/mov-aac-2048-priming           |   2 +-
 tests/ref/fate/mov-zombie                     |   4 +-
 11 files changed, 181 insertions(+), 30 deletions(-)

diff --git a/libavformat/isom.h b/libavformat/isom.h
index ff08f2a48d..f18b15bbff 100644
--- a/libavformat/isom.h
+++ b/libavformat/isom.h
@@ -174,6 +174,7 @@ typedef struct MOVStreamContext {
     unsigned int chunk_count;
     int64_t *chunk_offsets;
     unsigned int stts_count;
+    unsigned int stts_allocated_size;
     MOVStts *stts_data;
     unsigned int sdtp_count;
     uint8_t *sdtp_data;
@@ -188,6 +189,8 @@ typedef struct MOVStreamContext {
     unsigned *stps_data;  ///< partial sync sample for mpeg-2 open gop
     MOVElst *elst_data;
     unsigned int elst_count;
+    int stts_index;
+    int stts_sample;
     int ctts_index;
     int ctts_sample;
     unsigned int sample_size; ///< may contain value calculated from stsd or value from stsz atom
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 3e94a21418..66feea912d 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -3518,7 +3518,7 @@ static int mov_read_stts(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 {
     AVStream *st;
     MOVStreamContext *sc;
-    unsigned int i, entries, alloc_size = 0;
+    unsigned int i, entries;
     int64_t duration = 0;
     int64_t total_sample_count = 0;
     int64_t current_dts = 0;
@@ -3552,7 +3552,7 @@ static int mov_read_stts(MOVContext *c, AVIOContext *pb, MOVAtom atom)
         unsigned int sample_duration;
         unsigned int sample_count;
         unsigned int min_entries = FFMIN(FFMAX(i + 1, 1024 * 1024), entries);
-        MOVStts *stts_data = av_fast_realloc(sc->stts_data, &alloc_size,
+        MOVStts *stts_data = av_fast_realloc(sc->stts_data, &sc->stts_allocated_size,
                                              min_entries * sizeof(*sc->stts_data));
         if (!stts_data) {
             av_freep(&sc->stts_data);
@@ -3916,11 +3916,15 @@ static int get_edit_list_entry(MOVContext *mov,
 static int find_prev_closest_index(AVStream *st,
                                    AVIndexEntry *e_old,
                                    int nb_old,
+                                   MOVStts* stts_data,
+                                   int64_t stts_count,
                                    MOVCtts* ctts_data,
                                    int64_t ctts_count,
                                    int64_t timestamp_pts,
                                    int flag,
                                    int64_t* index,
+                                   int64_t* stts_index,
+                                   int64_t* stts_sample,
                                    int64_t* ctts_index,
                                    int64_t* ctts_sample)
 {
@@ -3963,6 +3967,15 @@ static int find_prev_closest_index(AVStream *st,
         // Find out the ctts_index for the found frame.
         *ctts_index = 0;
         *ctts_sample = 0;
+
+        if (stts_data) {
+            av_assert0(stts_index);
+            av_assert0(stts_sample);
+
+            *stts_index = 0;
+            *stts_sample = 0;
+        }
+
         for (index_ctts_count = 0; index_ctts_count < *index; index_ctts_count++) {
             if (*ctts_index < ctts_count) {
                 (*ctts_sample)++;
@@ -3971,6 +3984,13 @@ static int find_prev_closest_index(AVStream *st,
                     *ctts_sample = 0;
                 }
             }
+            if (stts_data && *stts_index < stts_count) {
+                (*stts_sample)++;
+                if (stts_data[*stts_index].count == *stts_sample) {
+                    (*stts_index)++;
+                    *stts_sample = 0;
+                }
+            }
         }
 
         while (*index >= 0 && (*ctts_index) >= 0 && (*ctts_index) < ctts_count) {
@@ -3990,6 +4010,16 @@ static int find_prev_closest_index(AVStream *st,
             } else {
                 (*ctts_sample)--;
             }
+            if (stts_data) {
+                if (*stts_sample == 0) {
+                    (*stts_index)--;
+                    if (*stts_index >= 0) {
+                        *stts_sample = stts_data[*stts_index].count - 1;
+                    }
+                } else {
+                    (*stts_sample)--;
+                }
+            }
         }
     }
 
@@ -4063,6 +4093,33 @@ static void fix_index_entry_timestamps(AVStream* st, int end_index, int64_t end_
     }
 }
 
+static int64_t add_stts_entry(MOVStts** stts_data, unsigned int* stts_count, unsigned int* allocated_size,
+                              int count, int duration)
+{
+    MOVStts *stts_buf_new;
+    const size_t min_size_needed = (*stts_count + 1) * sizeof(MOVStts);
+    const size_t requested_size =
+        min_size_needed > *allocated_size ?
+        FFMAX(min_size_needed, 2 * (*allocated_size)) :
+        min_size_needed;
+
+    if ((unsigned)(*stts_count) >= UINT_MAX / sizeof(MOVStts) - 1)
+        return -1;
+
+    stts_buf_new = av_fast_realloc(*stts_data, allocated_size, requested_size);
+
+    if (!stts_buf_new)
+        return -1;
+
+    *stts_data = stts_buf_new;
+
+    stts_buf_new[*stts_count].count = count;
+    stts_buf_new[*stts_count].duration = duration;
+
+    *stts_count = (*stts_count) + 1;
+    return *stts_count;
+}
+
 /**
  * Append a new ctts entry to ctts_data.
  * Returns the new ctts_count if successful, else returns -1.
@@ -4211,6 +4268,10 @@ static void mov_fix_index(MOVContext *mov, AVStream *st)
     int nb_old = sti->nb_index_entries;
     const AVIndexEntry *e_old_end = e_old + nb_old;
     const AVIndexEntry *current = NULL;
+    MOVStts *stts_data_old = msc->stts_data;
+    int64_t stts_index_old = 0;
+    int64_t stts_sample_old = 0;
+    int64_t stts_count_old = msc->stts_count;
     MOVCtts *ctts_data_old = msc->ctts_data;
     int64_t ctts_index_old = 0;
     int64_t ctts_sample_old = 0;
@@ -4220,6 +4281,7 @@ static void mov_fix_index(MOVContext *mov, AVStream *st)
     int64_t frame_duration = 0;
     int64_t edit_list_dts_counter = 0;
     int64_t edit_list_dts_entry_end = 0;
+    int64_t edit_list_start_stts_sample = 0;
     int64_t edit_list_start_ctts_sample = 0;
     int64_t curr_cts;
     int64_t curr_ctts = 0;
@@ -4256,7 +4318,12 @@ static void mov_fix_index(MOVContext *mov, AVStream *st)
     sti->index_entries_allocated_size = 0;
     sti->nb_index_entries = 0;
 
-    // Clean ctts fields of MOVStreamContext
+    // Clean time to sample fields of MOVStreamContext
+    msc->stts_data = NULL;
+    msc->stts_count = 0;
+    msc->stts_index = 0;
+    msc->stts_sample = 0;
+    msc->stts_allocated_size = 0;
     msc->ctts_data = NULL;
     msc->ctts_count = 0;
     msc->ctts_index = 0;
@@ -4314,17 +4381,19 @@ static void mov_fix_index(MOVContext *mov, AVStream *st)
             search_timestamp = FFMAX(search_timestamp - msc->time_scale, e_old[0].timestamp);
         }
 
-        if (find_prev_closest_index(st, e_old, nb_old, ctts_data_old, ctts_count_old, search_timestamp, 0,
-                                    &index, &ctts_index_old, &ctts_sample_old) < 0) {
+        if (find_prev_closest_index(st, e_old, nb_old, stts_data_old, stts_count_old, ctts_data_old, ctts_count_old, search_timestamp, 0,
+                                    &index, &stts_index_old, &stts_sample_old, &ctts_index_old, &ctts_sample_old) < 0) {
             av_log(mov->fc, AV_LOG_WARNING,
                    "st: %d edit list: %"PRId64" Missing key frame while searching for timestamp: %"PRId64"\n",
                    st->index, edit_list_index, search_timestamp);
-            if (find_prev_closest_index(st, e_old, nb_old, ctts_data_old, ctts_count_old, search_timestamp, AVSEEK_FLAG_ANY,
-                                        &index, &ctts_index_old, &ctts_sample_old) < 0) {
+            if (find_prev_closest_index(st, e_old, nb_old, stts_data_old, stts_count_old, ctts_data_old, ctts_count_old, search_timestamp, AVSEEK_FLAG_ANY,
+                                        &index, &stts_index_old, &stts_sample_old, &ctts_index_old, &ctts_sample_old) < 0) {
                 av_log(mov->fc, AV_LOG_WARNING,
                        "st: %d edit list %"PRId64" Cannot find an index entry before timestamp: %"PRId64".\n",
                        st->index, edit_list_index, search_timestamp);
                 index = 0;
+                stts_index_old = 0;
+                stts_sample_old = 0;
                 ctts_index_old = 0;
                 ctts_sample_old = 0;
             }
@@ -4346,6 +4415,24 @@ static void mov_fix_index(MOVContext *mov, AVStream *st)
             curr_cts = current->timestamp + msc->dts_shift;
             curr_ctts = 0;
 
+            if (stts_data_old && stts_index_old < stts_count_old) {
+                stts_sample_old++;
+                if (stts_sample_old == stts_data_old[stts_index_old].count) {
+                    if (add_stts_entry(&msc->stts_data, &msc->stts_count,
+                                       &msc->stts_allocated_size,
+                                       stts_data_old[stts_index_old].count - edit_list_start_stts_sample,
+                                       stts_data_old[stts_index_old].duration) == -1) {
+                        av_log(mov->fc, AV_LOG_ERROR, "Cannot add STTS entry %"PRId64" - {%"PRId64", %d}\n",
+                               stts_index_old,
+                               stts_data_old[stts_index_old].count - edit_list_start_stts_sample,
+                               stts_data_old[stts_index_old].duration);
+                        break;
+                    }
+                    stts_index_old++;
+                    stts_sample_old = 0;
+                    edit_list_start_stts_sample = 0;
+                }
+            }
             if (ctts_data_old && ctts_index_old < ctts_count_old) {
                 curr_ctts = ctts_data_old[ctts_index_old].offset;
                 av_log(mov->fc, AV_LOG_TRACE, "stts: %"PRId64" ctts: %"PRId64", ctts_index: %"PRId64", ctts_count: %"PRId64"\n",
@@ -4460,6 +4547,16 @@ static void mov_fix_index(MOVContext *mov, AVStream *st)
                         continue;
                     }
                     if (ctts_sample_old != 0) {
+                        if (stts_data_old &&
+                            add_stts_entry(&msc->stts_data, &msc->stts_count,
+                                           &msc->stts_allocated_size,
+                                           stts_sample_old - edit_list_start_stts_sample,
+                                           stts_data_old[stts_index_old].duration) == -1) {
+                            av_log(mov->fc, AV_LOG_ERROR, "Cannot add STTS entry %"PRId64" - {%"PRId64", %d}\n",
+                                   stts_index_old, stts_sample_old - edit_list_start_stts_sample,
+                                   stts_data_old[stts_index_old].duration);
+                            break;
+                        }
                         if (add_ctts_entry(&msc->ctts_data, &msc->ctts_count,
                                            &msc->ctts_allocated_size,
                                            ctts_sample_old - edit_list_start_ctts_sample,
@@ -4497,6 +4594,7 @@ static void mov_fix_index(MOVContext *mov, AVStream *st)
 
     // Free the old index and the old CTTS structures
     av_free(e_old);
+    av_free(stts_data_old);
     av_free(ctts_data_old);
     av_freep(&frame_duration_buffer);
 
@@ -5213,7 +5311,6 @@ static int mov_read_trak(MOVContext *c, AVIOContext *pb, MOVAtom atom)
     av_freep(&sc->chunk_offsets);
     av_freep(&sc->sample_sizes);
     av_freep(&sc->keyframes);
-    av_freep(&sc->stts_data);
     av_freep(&sc->stps_data);
     av_freep(&sc->elst_data);
     av_freep(&sc->rap_group);
@@ -5686,6 +5783,7 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom)
     AVStream *st = NULL;
     FFStream *sti = NULL;
     MOVStreamContext *sc;
+    MOVStts *stts_data;
     MOVCtts *ctts_data;
     uint64_t offset;
     int64_t dts, pts = AV_NOPTS_VALUE;
@@ -5695,7 +5793,7 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom)
     int64_t prev_dts = AV_NOPTS_VALUE;
     int next_frag_index = -1, index_entry_pos;
     size_t requested_size;
-    size_t old_ctts_allocated_size;
+    size_t old_allocated_size;
     AVIndexEntry *new_entries;
     MOVFragmentStreamInfo * frag_stream_info;
 
@@ -5816,7 +5914,7 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom)
     sti->index_entries= new_entries;
 
     requested_size = (sti->nb_index_entries + entries) * sizeof(*sc->ctts_data);
-    old_ctts_allocated_size = sc->ctts_allocated_size;
+    old_allocated_size = sc->ctts_allocated_size;
     ctts_data = av_fast_realloc(sc->ctts_data, &sc->ctts_allocated_size,
                                 requested_size);
     if (!ctts_data)
@@ -5826,8 +5924,20 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom)
     // In case there were samples without ctts entries, ensure they get
     // zero valued entries. This ensures clips which mix boxes with and
     // without ctts entries don't pickup uninitialized data.
-    memset((uint8_t*)(sc->ctts_data) + old_ctts_allocated_size, 0,
-           sc->ctts_allocated_size - old_ctts_allocated_size);
+    memset((uint8_t*)(sc->ctts_data) + old_allocated_size, 0,
+           sc->ctts_allocated_size - old_allocated_size);
+
+    requested_size = (sti->nb_index_entries + entries) * sizeof(*sc->stts_data);
+    old_allocated_size = sc->stts_allocated_size;
+    stts_data = av_fast_realloc(sc->stts_data, &sc->stts_allocated_size,
+                                requested_size);
+    if (!stts_data)
+        return AVERROR(ENOMEM);
+    sc->stts_data = stts_data;
+
+    // See the comment for ctts above.
+    memset((uint8_t*)(sc->stts_data) + old_allocated_size, 0,
+           sc->stts_allocated_size - old_allocated_size);
 
     if (index_entry_pos < sti->nb_index_entries) {
         // Make hole in index_entries and ctts_data for new samples
@@ -5838,6 +5948,9 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom)
         memmove(sc->ctts_data + index_entry_pos + entries,
                 sc->ctts_data + index_entry_pos,
                 sizeof(*sc->ctts_data) * (sc->ctts_count - index_entry_pos));
+        memmove(sc->stts_data + index_entry_pos + entries,
+                sc->stts_data + index_entry_pos,
+                sizeof(*sc->stts_data) * (sc->stts_count - index_entry_pos));
         if (index_entry_pos < sc->current_sample) {
             sc->current_sample += entries;
         }
@@ -5845,6 +5958,7 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 
     sti->nb_index_entries += entries;
     sc->ctts_count = sti->nb_index_entries;
+    sc->stts_count = sti->nb_index_entries;
 
     // Record the index_entry position in frag_index of this fragment
     if (frag_stream_info) {
@@ -5911,6 +6025,8 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 
         sc->ctts_data[index_entry_pos].count = 1;
         sc->ctts_data[index_entry_pos].offset = ctts_duration;
+        sc->stts_data[index_entry_pos].count = 1;
+        sc->stts_data[index_entry_pos].duration = sample_duration;
         index_entry_pos++;
 
         av_log(c->fc, AV_LOG_TRACE, "AVIndex stream %d, sample %d, offset %"PRIx64", dts %"PRId64", "
@@ -5946,9 +6062,14 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom)
                 sc->ctts_data + index_entry_pos + gap,
                 sizeof(*sc->ctts_data) *
                 (sc->ctts_count - (index_entry_pos + gap)));
+        memmove(sc->stts_data + index_entry_pos,
+                sc->stts_data + index_entry_pos + gap,
+                sizeof(*sc->stts_data) *
+                (sc->stts_count - (index_entry_pos + gap)));
 
         sti->nb_index_entries -= gap;
         sc->ctts_count -= gap;
+        sc->stts_count -= gap;
         if (index_entry_pos < sc->current_sample) {
             sc->current_sample -= gap;
         }
@@ -10720,6 +10841,17 @@ static int mov_finalize_packet(AVFormatContext *s, AVStream *st, AVIndexEntry *s
     if (sample->flags & AVINDEX_DISCARD_FRAME) {
         pkt->flags |= AV_PKT_FLAG_DISCARD;
     }
+    if (sc->stts_data && sc->stts_index < sc->stts_count) {
+        pkt->duration = sc->stts_data[sc->stts_index].duration;
+
+        /* update stts context */
+        sc->stts_sample++;
+        if (sc->stts_index < sc->ctts_count &&
+            sc->stts_data[sc->stts_index].count == sc->stts_sample) {
+            sc->stts_index++;
+            sc->stts_sample = 0;
+        }
+    }
     if (sc->ctts_data && sc->ctts_index < sc->ctts_count) {
         pkt->pts = av_sat_add64(pkt->dts, av_sat_add64(sc->dts_shift, sc->ctts_data[sc->ctts_index].offset));
 
@@ -10731,11 +10863,12 @@ static int mov_finalize_packet(AVFormatContext *s, AVStream *st, AVIndexEntry *s
             sc->ctts_sample = 0;
         }
     } else {
-        int64_t next_dts = (sc->current_sample < ffstream(st)->nb_index_entries) ?
-            ffstream(st)->index_entries[sc->current_sample].timestamp : st->duration;
-
-        if (next_dts >= pkt->dts)
-            pkt->duration = next_dts - pkt->dts;
+        if (pkt->duration == 0) {
+            int64_t next_dts = (sc->current_sample < ffstream(st)->nb_index_entries) ?
+                ffstream(st)->index_entries[sc->current_sample].timestamp : st->duration;
+            if (next_dts >= pkt->dts)
+                pkt->duration = next_dts - pkt->dts;
+        }
         pkt->pts = pkt->dts;
     }
 
@@ -11031,6 +11164,19 @@ static int mov_seek_stream(AVFormatContext *s, AVStream *st, int64_t timestamp,
 
     mov_current_sample_set(sc, sample);
     av_log(s, AV_LOG_TRACE, "stream %d, found sample %d\n", st->index, sc->current_sample);
+    /* adjust stts index */
+    if (sc->stts_data) {
+        time_sample = 0;
+        for (i = 0; i < sc->stts_count; i++) {
+            int next = time_sample + sc->stts_data[i].count;
+            if (next > sc->current_sample) {
+                sc->stts_index = i;
+                sc->stts_sample = sc->current_sample - time_sample;
+                break;
+            }
+            time_sample = next;
+        }
+    }
     /* adjust ctts index */
     if (sc->ctts_data) {
         time_sample = 0;
diff --git a/tests/ref/fate/copy-trac236 b/tests/ref/fate/copy-trac236
index c89649e953..1f20e9ea7e 100644
--- a/tests/ref/fate/copy-trac236
+++ b/tests/ref/fate/copy-trac236
@@ -1,5 +1,5 @@
-ca4068319c6586de757c1f6a592b31e5 *tests/data/fate/copy-trac236.mov
-630918 tests/data/fate/copy-trac236.mov
+3e3497985d54991e09f82ca3dd7eda79 *tests/data/fate/copy-trac236.mov
+630910 tests/data/fate/copy-trac236.mov
 #tb 0: 100/2997
 #media_type 0: video
 #codec_id 0: rawvideo
diff --git a/tests/ref/fate/filter-fps b/tests/ref/fate/filter-fps
index 242fb04e85..fa71b59cd3 100644
--- a/tests/ref/fate/filter-fps
+++ b/tests/ref/fate/filter-fps
@@ -91,3 +91,4 @@
 0,         85,         85,        1,    30576, 0xd4150aad
 0,         86,         86,        1,    30576, 0xd4150aad
 0,         87,         87,        1,    30576, 0xd4150aad
+0,         88,         88,        1,    30576, 0xd4150aad
diff --git a/tests/ref/fate/filter-fps-cfr b/tests/ref/fate/filter-fps-cfr
index 242fb04e85..fa71b59cd3 100644
--- a/tests/ref/fate/filter-fps-cfr
+++ b/tests/ref/fate/filter-fps-cfr
@@ -91,3 +91,4 @@
 0,         85,         85,        1,    30576, 0xd4150aad
 0,         86,         86,        1,    30576, 0xd4150aad
 0,         87,         87,        1,    30576, 0xd4150aad
+0,         88,         88,        1,    30576, 0xd4150aad
diff --git a/tests/ref/fate/filter-meta-4560-rotate0 b/tests/ref/fate/filter-meta-4560-rotate0
index c0f3b03710..b0f3d67f08 100644
--- a/tests/ref/fate/filter-meta-4560-rotate0
+++ b/tests/ref/fate/filter-meta-4560-rotate0
@@ -1,5 +1,5 @@
-dc213aee944a55af2f41950921fd62d7 *tests/data/fate/filter-meta-4560-rotate0.mov
-347433 tests/data/fate/filter-meta-4560-rotate0.mov
+6cd6b45a88881e85dfe7ad9582ffbeff *tests/data/fate/filter-meta-4560-rotate0.mov
+347425 tests/data/fate/filter-meta-4560-rotate0.mov
 #tb 0: 1/30
 #media_type 0: video
 #codec_id 0: rawvideo
diff --git a/tests/ref/fate/gaplessenc-itunes-to-ipod-aac b/tests/ref/fate/gaplessenc-itunes-to-ipod-aac
index 41c9f03b20..a8da904c32 100644
--- a/tests/ref/fate/gaplessenc-itunes-to-ipod-aac
+++ b/tests/ref/fate/gaplessenc-itunes-to-ipod-aac
@@ -22,7 +22,7 @@ packet|pts=98304|dts=98304|duration=1024|flags=K__
 packet|pts=99328|dts=99328|duration=1024|flags=K__
 packet|pts=100352|dts=100352|duration=1024|flags=K__
 packet|pts=101376|dts=101376|duration=1024|flags=K__
-packet|pts=102400|dts=102400|duration=926|flags=K__
+packet|pts=102400|dts=102400|duration=960|flags=K__
 stream|nb_read_packets=102
 frame|pts=0|pkt_dts=0|best_effort_timestamp=0|nb_samples=1024
 frame|pts=1024|pkt_dts=1024|best_effort_timestamp=1024|nb_samples=1024
diff --git a/tests/ref/fate/matroska-dovi-write-config8 b/tests/ref/fate/matroska-dovi-write-config8
index 85899d5f6d..d5704c7684 100644
--- a/tests/ref/fate/matroska-dovi-write-config8
+++ b/tests/ref/fate/matroska-dovi-write-config8
@@ -1,5 +1,5 @@
-3bd4b07d5af6153516e4c0e66a71c8c9 *tests/data/fate/matroska-dovi-write-config8.matroska
-3600607 tests/data/fate/matroska-dovi-write-config8.matroska
+593bb650a937b25b87de3079ee7d1517 *tests/data/fate/matroska-dovi-write-config8.matroska
+3600617 tests/data/fate/matroska-dovi-write-config8.matroska
 #extradata 0:      551, 0xb1ddcd66
 #extradata 1:        2, 0x00340022
 #tb 0: 1/1000
diff --git a/tests/ref/fate/matroska-non-rotation-displaymatrix b/tests/ref/fate/matroska-non-rotation-displaymatrix
index c48a4afa43..ad9d6e5b43 100644
--- a/tests/ref/fate/matroska-non-rotation-displaymatrix
+++ b/tests/ref/fate/matroska-non-rotation-displaymatrix
@@ -1,12 +1,12 @@
-3d9eac5b7551c5d644443a70451c809c *tests/data/fate/matroska-non-rotation-displaymatrix.matroska
-7860 tests/data/fate/matroska-non-rotation-displaymatrix.matroska
+7294b73bcb1cd5059b8f413e2a4dab5b *tests/data/fate/matroska-non-rotation-displaymatrix.matroska
+7866 tests/data/fate/matroska-non-rotation-displaymatrix.matroska
 #extradata 0:       34, 0xc1d10b51
 #tb 0: 1/1000
 #media_type 0: video
 #codec_id 0: h264
 #dimensions 0: 160x240
 #sar 0: 1/2
-0,        -33,          0,       33,     4133, 0xc48cf152
+0,        -33,          0,       27,     4133, 0xc48cf152
 0,          0,         60,       33,     1077, 0x15a71a8a, F=0x0
 0,         27,         27,       33,      355, 0x1ee8b91a, F=0x0
 0,         60,        127,       33,     1110, 0x4e1a2b12, F=0x0
diff --git a/tests/ref/fate/mov-aac-2048-priming b/tests/ref/fate/mov-aac-2048-priming
index b3ab9e0d34..feea5e36eb 100644
--- a/tests/ref/fate/mov-aac-2048-priming
+++ b/tests/ref/fate/mov-aac-2048-priming
@@ -214,4 +214,4 @@ packet|codec_type=audio|stream_index=0|pts=215040|pts_time=4.876190|dts=215040|d
 packet|codec_type=audio|stream_index=0|pts=216064|pts_time=4.899410|dts=216064|dts_time=4.899410|duration=1024|duration_time=0.023220|size=203|pos=42900|flags=K__
 packet|codec_type=audio|stream_index=0|pts=217088|pts_time=4.922630|dts=217088|dts_time=4.922630|duration=1024|duration_time=0.023220|size=198|pos=43103|flags=K__
 packet|codec_type=audio|stream_index=0|pts=218112|pts_time=4.945850|dts=218112|dts_time=4.945850|duration=1024|duration_time=0.023220|size=284|pos=43301|flags=K__
-packet|codec_type=audio|stream_index=0|pts=219136|pts_time=4.969070|dts=219136|dts_time=4.969070|duration=1364|duration_time=0.030930|size=5|pos=43585|flags=K__
+packet|codec_type=audio|stream_index=0|pts=219136|pts_time=4.969070|dts=219136|dts_time=4.969070|duration=340|duration_time=0.007710|size=5|pos=43585|flags=K__
diff --git a/tests/ref/fate/mov-zombie b/tests/ref/fate/mov-zombie
index 10476bc49f..ed20e635ad 100644
--- a/tests/ref/fate/mov-zombie
+++ b/tests/ref/fate/mov-zombie
@@ -1,6 +1,6 @@
-packet|codec_type=video|stream_index=0|pts=0|pts_time=0.000000|dts=-3004|dts_time=-0.033378|duration=3003|duration_time=0.033367|size=4133|pos=11309|flags=K__
+packet|codec_type=video|stream_index=0|pts=0|pts_time=0.000000|dts=-3004|dts_time=-0.033378|duration=2437|duration_time=0.027078|size=4133|pos=11309|flags=K__
 packet|codec_type=video|stream_index=0|pts=5440|pts_time=0.060444|dts=-567|dts_time=-0.006300|duration=3003|duration_time=0.033367|size=1077|pos=15442|flags=___
-frame|media_type=video|stream_index=0|key_frame=1|pts=0|pts_time=0.000000|pkt_dts=-567|pkt_dts_time=-0.006300|best_effort_timestamp=0|best_effort_timestamp_time=0.000000|duration=3003|duration_time=0.033367|pkt_pos=11309|pkt_size=4133|width=160|height=240|crop_top=0|crop_bottom=0|crop_left=0|crop_right=0|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=I|interlaced_frame=0|top_field_first=0|repeat_pict=0|color_range=tv|color_space=smpte170m|color_primaries=smpte170m|color_transfer=bt709|chroma_location=topleft|side_datum/3x3_displaymatrix:side_data_type=3x3 displaymatrix|side_datum/3x3_displaymatrix:displaymatrix=\n00000000:       131072           0           0\n00000001:            0       65536           0\n00000002:            0           0  1073741824\n|side_datum/3x3_displaymatrix:rotation=0|side_datum/h_26_45__user_data_unregistered_sei_message:side_data_type=H.26[45] User Data Unregistered SEI message
+frame|media_type=video|stream_index=0|key_frame=1|pts=0|pts_time=0.000000|pkt_dts=-567|pkt_dts_time=-0.006300|best_effort_timestamp=0|best_effort_timestamp_time=0.000000|duration=2437|duration_time=0.027078|pkt_pos=11309|pkt_size=4133|width=160|height=240|crop_top=0|crop_bottom=0|crop_left=0|crop_right=0|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=I|interlaced_frame=0|top_field_first=0|repeat_pict=0|color_range=tv|color_space=smpte170m|color_primaries=smpte170m|color_transfer=bt709|chroma_location=topleft|side_datum/3x3_displaymatrix:side_data_type=3x3 displaymatrix|side_datum/3x3_displaymatrix:displaymatrix=\n00000000:       131072           0           0\n00000001:            0       65536           0\n00000002:            0           0  1073741824\n|side_datum/3x3_displaymatrix:rotation=0|side_datum/h_26_45__user_data_unregistered_sei_message:side_data_type=H.26[45] User Data Unregistered SEI message
 packet|codec_type=video|stream_index=0|pts=2437|pts_time=0.027078|dts=2436|dts_time=0.027067|duration=3003|duration_time=0.033367|size=355|pos=16519|flags=___
 frame|media_type=video|stream_index=0|key_frame=0|pts=2437|pts_time=0.027078|pkt_dts=2436|pkt_dts_time=0.027067|best_effort_timestamp=2437|best_effort_timestamp_time=0.027078|duration=3003|duration_time=0.033367|pkt_pos=16519|pkt_size=355|width=160|height=240|crop_top=0|crop_bottom=0|crop_left=0|crop_right=0|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=B|interlaced_frame=0|top_field_first=0|repeat_pict=0|color_range=tv|color_space=smpte170m|color_primaries=smpte170m|color_transfer=bt709|chroma_location=topleft|side_datum/3x3_displaymatrix:side_data_type=3x3 displaymatrix|side_datum/3x3_displaymatrix:displaymatrix=\n00000000:       131072           0           0\n00000001:            0       65536           0\n00000002:            0           0  1073741824\n|side_datum/3x3_displaymatrix:rotation=0|side_datum/h_26_45__user_data_unregistered_sei_message:side_data_type=H.26[45] User Data Unregistered SEI message
 packet|codec_type=video|stream_index=0|pts=11446|pts_time=0.127178|dts=5439|dts_time=0.060433|duration=3003|duration_time=0.033367|size=1110|pos=16874|flags=___
-- 
2.47.0



More information about the ffmpeg-devel mailing list