[FFmpeg-devel] [RFC] Frame rate emulation

Michael Niedermayer michaelni
Thu Jun 7 12:13:19 CEST 2007


Hi

On Wed, Jun 06, 2007 at 03:31:03PM -0300, Ramiro Ribeiro Polla wrote:
> Hello,
> 
> x11grab provides its own frame rate emulation inside its read_frame 
> function. Many other grab formats will need it (GDI, VFW...), so it 
> would be best to make a format level frame rate emulation in FFmpeg, and 
> not each demuxer (also I believe they don't belong in the demuxers 
> themselves).
> 
> FFmpeg already provides a frame rate emulation (added for DV), 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
>      */
> 
> It's in Fabrice's TODO "suppress rate_emu from AVCodecContext".
> 
> I don't know DV's needs for rate emulation, but couldn't it be passed to 
> ffmpeg.c's AVOutputStream instead of AVCodecContext? It would depend on 
> the format then, and not the codec.
> 
> Also, I plan to add that to AVInputStream, right before av_read_frame, 
> where it will be useful for grabbing demuxers.
> 
> Can there be 2 places where rate emulation occurs (reading from the 
> format, and writing to the codec)?
> Is it ok for DV for the rate emulation to occur at writing to the output 
> format, so it's checked in AVOutputStream?

first, AVInputStream / AVOutputStream are private structs of ffmpeg.c
libav* is used by more than just ffmpeg.c thus moving essential 
functionality into ffmpeg.c is not ok

second, its the input formats / demuxers job to read the frames properly
that includes reading them at the proper time for realtime stuff, sane
capture APIs should provide the needed functionality to capture at a specific
time. simply waiting in ffmpeg.c and then calling the demuxer is a incredibly
inaccurate way to do it, keep in mind ffmpeg does encoding, writeing and
others too, using a seperate thread would probably be needed ...


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The worst form of inequality is to try to make unequal things equal.
-- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070607/0d0bb18b/attachment.pgp>



More information about the ffmpeg-devel mailing list