From 35504c08ebe9010fa3f2a9e192b0860e5e768e6c Mon Sep 17 00:00:00 2001 From: bcoudurier Date: Wed, 25 Mar 2009 06:07:13 +0000 Subject: [PATCH] set wrong dts for iMovie created files which has huge ctts delay, fix ffmpeg_sample.m4v git-svn-id: file:///var/local/repositories/ffmpeg/trunk@18181 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b --- libavformat/mov.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libavformat/mov.c b/libavformat/mov.c index 0f17c6ecd..5dd7928a6 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -1281,6 +1281,12 @@ static void mov_build_index(MOVContext *mov, AVStream *st) int rescaled = sc->time_offset < 0 ? av_rescale(sc->time_offset, sc->time_scale, mov->time_scale) : sc->time_offset; assert(sc->time_offset % sc->time_rate == 0); current_dts = - (rescaled / sc->time_rate); + if (sc->ctts_data && sc->ctts_data[0].duration / sc->stts_data[0].duration > 16) { + /* more than 16 frames delay, dts are likely wrong + this happens with files created by iMovie */ + sc->wrong_dts = 1; + st->codec->has_b_frames = 1; + } } /* only use old uncompressed audio chunk demuxing when stts specifies it */ -- 2.39.2