[Ffmpeg-devel] wrong framerate in mpeg4 file?

Rich Felker dalias
Sat Sep 24 02:36:19 CEST 2005


On Sat, Sep 24, 2005 at 01:05:43AM +0200, Ivo wrote:
> On Friday 23 September 2005 20:42, Luca Ognibene wrote:
> > Il giorno dom, 18/09/2005 alle 14.54 +0200, Luca Ognibene ha scritto:
> > > hi!
> > > I have a problem with some mpeg4 files.
> > > ffmpeg reports that they have a framerate of 3000fps.
> >
> > With this file:
> > In h263.c:decode_vol_header reads 3000 in time_base.den and set
> > time_base.num to 1 because get_bits1(gb) returns 0.
> > With a older version of ffmpeg the fps reported would be 29.97 but now
> > it's 3000.
> >
> > Is 1/3000 a special value? How can i know if time_base is valid or not ?
> >
> > thanks for your help.
> 
> That's "funny". I just spend three hours yesterday tracking this down. I had 
> missed your original posting and I was playing with the -demuxer 35 (lavf) 
> option of mplayer :-) Well, I learned a lot of lavc/lavf's internals, so it 
> was not a complete waste of time.
> 
> Anyway, I have several avi's (from different sources) that play at 
> 24000/1001 and 25000/1000 fps with mplayer's native demuxer, but play at 
> 30000/1 fps with lavf's demuxer (well, it tries to :) ). I tracked it down 
> to exactly the same point you did, namely decode_vol_header() in h263.c.
> 
> I'm not sure if it should restore avctx->time_base.den and time_base.num 
> instead of setting .num to 1, or that the calling application (in "my" case 
> demux_lavf) should act upon .num being 1. I've only tried the latter. If 
> codec->time_base.num == 1, use st->time_base instead (which is the desired 
> 25000/1000, 24000/1001, etc.).
> 
> Can anybody shed a light on this?

Treating 1 specially is definitely wrong. 1/25 is a typical valid
timebase. The problem is that the codec's framerate is being used at
all. If the container contains a framerate/timebase, this must be
used.

Rich





More information about the ffmpeg-devel mailing list