[FFmpeg-devel] ffmpeg misdetects frame rate on divx files

Gabriel Forté gforte
Thu Dec 27 00:03:17 CET 2007


Hi,

I have uploaded a divx 4 stream at ftp://samples.mplayerhq.hu/MPlayer/incoming/mpeg4_framerate
of which the frame rate is detected anormally by ffmpeg:

[NULL @ 0xb7db1450]looks like this file was encoded with (divx4/(old)xvid/opendivx) -> forcing low_delay flag
Input #0, avi, from 'fightclub.avi':
  Duration: 00:01:40.0, start: 0.000000, bitrate: 757 kb/s
    Stream #0.0: Video: mpeg4, yuv420p, 640x288 [PAR 0:1 DAR 0:1],  1.00 tb(r)
    Stream #0.1: Audio: mp3, 48000 Hz, stereo, 32 kb/s

playing it with ffplay renders video very slowly.


this wrong 1.00 fps comes from libavcodec/h263.c's decode_vol_header()
function, where AVCodecContext's time_base field is overwritten with
seemingly bogus values when fixed_vop_header == 0.

in this case, the stream contains time_increment_resolution == 1.
I have another stream where time_increment_resolution == 2, leading to 2.00 fps.


I don't know which of the stream or decoder is broken, but attached is a
patch that appears to circumvent the problem.

as I don't feel familiar enough with the mpeg4p2 standard, I don't know
exactly if it is appropriate to do this in such a situation...

I'm not even sure if it wouldn't break in other cases (most particularly,
maybe it could lead to division by zero if s->avctx->time_base isn't properly
initialized ?).

maybe it is a divx4 encoder bug, as the only such samples I have are divx4...


any comment/information/correction would be appreciated if it is not the
proper way to fix this.


cheers,


-- 
Gabriel Fort? <gforte at wyplay.com>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: mpeg4_framerate.patch
Type: text/x-diff
Size: 1385 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20071227/3ede23c2/attachment.patch>



More information about the ffmpeg-devel mailing list