[FFmpeg-devel] [RFC] Frame rate emulation

Luca Abeni lucabe72
Thu Jun 7 09:29:00 CEST 2007

Hi Ramiro,

Ramiro Ribeiro Polla wrote:
> FFmpeg already provides a frame rate emulation (added for DV)
Are you sure it's for DV? As far as I know, it is needed for streaming 
audio or video from a file to the net (think about RTP streaming from an 
MPEG file... If you forget "-re", frames will be streamed as fast as 
possible, while they must be streamed at the correct rate).

> but it 
> works depending on a codec's demand, and not at a format level, like 
> avcodec.h says:
>     /**
>      * Frame rate emulation. If not zero, the lower layer (i.e. format 
> handler)
>      * has to read frames at native frame rate.
>      * - encoding: Set by user.
>      * - decoding: unused
>      */
BTW: looking at ffmpeg.c, this comment doesn't look completely correct.

> Can there be 2 places where rate emulation occurs (reading from the 
> format, and writing to the codec)?
In my understanding, yes, they really are two different kinds of 
synchronization: the role of the first one is to wait for a frame to be 
ready before reading it, while the second mechanism is used to output 
frames at the correct rate.

> Is it ok for DV for the rate emulation to occur at writing to the output 
> format, so it's checked in AVOutputStream?
I do not know about DV, but this can make sense for streaming.

As a final notw, if you implement frame rate emulation on the input, 
there might be interesting problems when reading from multiple streams 
(this is why capturing audio with OSS and video with video4linux is 
difficult using libavformat).


More information about the ffmpeg-devel mailing list