Ignore video streams with zero avg_frame_rate in their AVStream (e.g. from iTunes).
authorCarl Hetherington <cth@carlh.net>
Wed, 22 Oct 2014 08:29:38 +0000 (09:29 +0100)
committerCarl Hetherington <cth@carlh.net>
Wed, 22 Oct 2014 08:29:38 +0000 (09:29 +0100)
ChangeLog
src/lib/ffmpeg.cc

index 5bb0711b48dda50626403c9f940268b5422490ea..69af59f2c25b4cf02f4f3bea5652c5fae4586f68 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2014-10-22  Carl Hetherington  <cth@carlh.net>
+
+       * Fix bug where some files from iTunes would
+       be read as being at 90,000fps.
+
 2014-10-20  Carl Hetherington  <cth@carlh.net>
 
        * Version 1.76.2 released.
index ebe62b51fbd412cb73956b2ae86db2c6058257ab..53eed97e2dfb9fe8b5d1d7231cb2a9c54301ce70 100644 (file)
@@ -109,7 +109,10 @@ FFmpeg::setup_general ()
 
        for (uint32_t i = 0; i < _format_context->nb_streams; ++i) {
                AVStream* s = _format_context->streams[i];
-               if (s->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
+               /* Files from iTunes sometimes have two video streams, one with the avg_frame_rate.num and .den set
+                  to zero.  Ignore these streams.
+               */
+               if (s->codec->codec_type == AVMEDIA_TYPE_VIDEO && s->avg_frame_rate.num > 0 && s->avg_frame_rate.den > 0) {
                        _video_stream = i;
                }
        }