[MPlayer-dev-eng] [PATCH] fps determination in demux_mov (for vfr / 3gp files)
Reinoud Elhorst
reinoud at hyves.nl
Thu Jun 15 23:18:40 CEST 2006
Hi all,
I was fighting with encoding a 3gp file to something else using
mencoder. Problem was that quite some 3gp files seem to start with
single frame lasting .7 seconds, and then continuing at about 10fps.
Since demux_mov looks only at the first frame for determining fps, fps
was reported as about 1.5. As a result, the default output fps for
mencoder was 1.5 as well.
Now obviously it doesn't really make sense to talk about "a framerate"
for vfr files, and the code recognises this:
In the sh_video_t typedef, comments on the fps field read: // frames per
second (set only if constant fps).
However the file would not even play if the fps (and the frametime)
fields were not set.
The following patch tries to be a little more intelligent in retrieving
the framerate (taking the average for all the trak->durmap's available,
ignoring the highest and lowest value). I'm not sure what I'm possibly
breaking with this, and realise that my way of calculating the average
is only one of many algorithms, but it seems to suite my needs (files
that were encoded on 1.5 fps before, now get a more realistic 9.8 fps).
Reinoud
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: mov_vfr_fps_tweak.diff
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20060615/2c3db230/attachment.txt>
More information about the MPlayer-dev-eng
mailing list