]> git.sesse.net Git - mlt/commitdiff
Fix frame rate detection when the muxer rate is 0/0.
authorDan Dennedy <dan@dennedy.org>
Fri, 22 Oct 2010 04:10:15 +0000 (21:10 -0700)
committerDan Dennedy <dan@dennedy.org>
Fri, 22 Oct 2010 04:10:15 +0000 (21:10 -0700)
src/modules/avformat/producer_avformat.c

index 6763dbac2fae9893788c5278921dc3fa88b62b9d..1947bf65bc8ed83f411140f570b4f167b8631aa8 100644 (file)
@@ -1516,13 +1516,13 @@ static int video_codec_init( producer_avformat this, int index, mlt_properties p
                        // If the muxer reports a frame rate different than the codec
 #if LIBAVFORMAT_VERSION_INT >= ((52<<16)+(42<<8)+0)
                        double muxer_fps = av_q2d( stream->avg_frame_rate );
-                       if (muxer_fps == 0) muxer_fps = av_q2d( stream->r_frame_rate );
+                       if ( muxer_fps == 0 ) muxer_fps = av_q2d( stream->r_frame_rate );
 #else
                        double muxer_fps = av_q2d( stream->r_frame_rate );
 #endif
                        // Choose the lesser - the wrong tends to be off by some multiple of 10
                        source_fps = FFMIN( source_fps, muxer_fps );
-                       if ( source_fps >= 1.0 && source_fps < muxer_fps )
+                       if ( source_fps >= 1.0 && ( source_fps < muxer_fps || isnan( muxer_fps ) ) )
                        {
                                mlt_properties_set_int( properties, "meta.media.frame_rate_num", this->video_codec->time_base.den );
                                mlt_properties_set_int( properties, "meta.media.frame_rate_den", this->video_codec->time_base.num == 0 ? 1 : this->video_codec->time_base.num );