[FFmpeg-devel] [PATCH] lavf/mov: ignore edit list with duration equals to 0 for covers art

Matthieu Bouron matthieu.bouron at gmail.com
Wed Jan 18 12:38:41 EET 2017


Discards edit list with duration equals to 0 for video streams with only
one frame and avoid discarding covers art muxed as a single frame video
stream.
---
Hello,

The following patch discards single edit list with duration equals to 0 for video streams with only one frame which prevents discarding covers art muxed as a single frame video stream.

The patch can be extended to make it always discards single edit list with duration equals to 0 (even if the video streams has more than one sample).
What do you think ?

Matthieu
---
 libavformat/mov.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index d1b929174d..88ffd0e5f2 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -2988,6 +2988,17 @@ static void mov_fix_index(MOVContext *mov, AVStream *st)
     if (!msc->elst_data || msc->elst_count <= 0 || nb_old <= 0) {
         return;
     }
+
+    // Discard edit list with duration equals to 0 for video streams with only
+    // one frame and avoid discarding covers art muxed as a single frame video
+    // stream
+    if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO &&
+        msc->chunk_count == 1 &&
+        msc->elst_count == 1 &&
+        msc->elst_data[0].duration == 0) {
+        return;
+    }
+
     // Clean AVStream from traces of old index
     st->index_entries = NULL;
     st->index_entries_allocated_size = 0;
-- 
2.11.0



More information about the ffmpeg-devel mailing list