[Ffmpeg-devel] VFR support

Rich Felker dalias
Wed Oct 19 18:24:08 CEST 2005

On Wed, Oct 19, 2005 at 12:15:00PM +0200, Emiliano Parasassi wrote:
> Hi,
> I'm trying to make a Variable FrameRate video mpeg4/mp4 from
> my network camera which releases frames from 1 to 10 fps...
> Unfortunately, when I play video with MPlayer or VLC the fps is
> fixed to 10 and the result output is played fast... :(
> These are main steps i made:
> ...
> fAVCodecContext->time_base = (AVRational){1, 10}
> ...
> fAVFrame->pts = ...
> avcodec_encode_video(...)
> avpkt.pts = av_rescale_q(...)
> av_write_frame(...)
> The question is:
> Which are the main steps to do for having a VFR videoclip in ffmpeg?

1/10 is not a working timebase for variable framerate anywhere between
1 and 10 fps; it only works for 1, 2, 5, and 10 fps. If the frame
durations are all integer multiples of 1/10, then you can use 1/2520
(lcm of 1,2,...,10 unless I made a mistake); otherwise just use some
small physical unit like microseconds.

In any case, you need to set the pts values correctly for each frame
you write. MPlayer and vlc incorrectly show the timebase as a
"framerate" but they should play the file correctly still.


More information about the ffmpeg-devel mailing list