[Ffmpeg-devel] [BUG] wrong fps in r_frame_rate ?

Fred Rothganger fred
Sun Dec 24 16:04:14 CET 2006

Baptiste Coudurier wrote:
> Hi
> $subject
> latest svn. ffmpeg -i wrong_fps.mpg
> Seems that stream 0 comes from film source: 25.00 (25/1) -> 24.75 (99/4)
> Input #0, mpeg, from 'wrong_fps.mpg':
>   Duration: 00:00:04.3, start: 0.552822, bitrate: 15583 kb/s
>   Stream #0.0[0x1e0]: Video: mpeg2video, yuv422p, 720x608, 15000 kb/s,
> 24.75 fps(r)
>   Stream #0.1[0x1c0]: Audio: mp2, 48000 Hz, stereo, 192 kb/s
>   Stream #0.2[0x1c1]: Audio: mp2, 48000 Hz, stereo, 192 kb/s
> Must supply at least one output file
> wrong_fps.mpg on mplayerhq as usual. File should be 25fps.
> in libavformat/utils.c if I remove || CODEC_ID_MPEG2VIDEO, or revert
> commit r6345, it is correctly detected.
> I believe this code was change to correcty detect groundhog.vob.

    groundhog.vob contains 24fps material.  The file is broken in the 
sense that it starts with one frame at 1/30s duration and then returns 
to 24fps.  This frame was inserted by my DVD ripping program because I 
asked it to break the vobs up by chapter, and it is not smart enough to 
understand telecine.  :)

    I submitted it to demonstrate the need for a patch to the code for 
detecting telecine (it was using AV_TIME_BASE rather than 
stream.time_base).  Michael decided to get rid of this code entirely.  
He also added some other code to find a least common multiple time 
base.  The end result was an r_frame_rate that is even less usable for 
the purpose of detecting 24fps material.  Michael has defined 
r_frame_rate to be the LCM time base of stream, so it will almost never 
be 24fps unless the timestamps in the file are perfect.

    The older code for detecting telecine that Michael removed was more 
robust, in that it had a wider margin (1/2fps rather than 1/24fps) for 
quantizing to 24 fps, and it worked with average frame rate rather than 
LCM.  I would argue that we have lost functionality with this change.

    Sorry for the high latency.  I read this list about once every 1-2 
weeks to catch up.  Too busy with other things.  :)

-- Fred

More information about the ffmpeg-devel mailing list