[FFmpeg-cvslog] avformat/mov: Ignore the last frame for duration and fps calculation if it looks suspect

Michael Niedermayer git at videolan.org
Tue Jan 21 19:53:31 CET 2014


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Tue Jan 21 18:31:54 2014 +0100| [8e5e84c2a2a21a979b48e80c5a8dd44754ab3f21] | committer: Michael Niedermayer

avformat/mov: Ignore the last frame for duration and fps calculation if it looks suspect

The used heuristic will potentially need to be finetuned
Fixes daemon404s fps.mov

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8e5e84c2a2a21a979b48e80c5a8dd44754ab3f21
---

 libavformat/mov.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 413a508..a24df84 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1940,6 +1940,12 @@ static int mov_read_stts(MOVContext *c, AVIOContext *pb, MOVAtom atom)
         av_dlog(c->fc, "sample_count=%d, sample_duration=%d\n",
                 sample_count, sample_duration);
 
+        if (   i+1 == entries
+            && i
+            && sample_count == 1
+            && total_sample_count > 100
+            && sample_duration/10 > duration / total_sample_count)
+            sample_duration = duration / total_sample_count;
         duration+=(int64_t)sample_duration*sample_count;
         total_sample_count+=sample_count;
     }



More information about the ffmpeg-cvslog mailing list