[Ffmpeg-devel] Interleaving audio and video

Michael Niedermayer michaelni
Tue Feb 6 00:48:30 CET 2007


Hi

On Mon, Feb 05, 2007 at 11:19:42AM -0800, Roman Shaposhnik wrote:
> Hi
> 
> On Mon, 2007-02-05 at 01:19 +0100, Michael Niedermayer wrote:
> > >       Imagine a general purpose application that can output any stream
> > >       the user asks for. Also imagine that the incoming stream sometimes
> > >       is interleaved properly and sometimes isn't. Now, the question
> > >       is -- what would you recommend for the application developer:
> > >       av_interleaved_write_frame() or  av_write_frame() ? Keep in
> > >       mind that application always needs maximum performance (which,
> > >       for example, means that producing badly interleaved AVIs is
> > >       not a problem) but also needs to generate correct GXF streams. 
> > > 
> > >   I'm using GXF here not because I care about it that much, but because
> > >   if I follow its example of using interleave_packet() as a packetizer
> > >   for DV muxer -- it seems to me I can not guarantee correct streams
> > >   in certain cases ever!
> > 
> > elaborate what "the incoming stream sometimes is interleaved properly
> > and sometimes isn't" means, that is a definition of properly interleaved
> > and how does the application know that
> 
>   Imagine ffmpeg-like application augmented with a possibility of 
> some CGI. Such an application has no control over what kind of
> existing streams will be given to it and thus has no prior knowledge
> whether they will be interleaved properly or not. Yet it is pretty
> sure that CGI portions are interleaved properly because it synthesizes
> them itself and can guarantee perfect interleave. 
> 
>   Basically where I'm driving is is that given all of the restrictions
> av_write_frame() has it is not even clear to me why bother having
> it ? 

av_write_frame() is needed for muxing without an extra memcpy() and 
without extra delay it will because of that not be removed or deoptimized
you are free to fork ffmpeg, you are also free to continue to argue but
i fear i wont be replying any further

furthermore av_write_frame() is part of the public exported API and we 
cannot just remove it or change what it does without bumping the major
version number the same is true for av_interleaved_write_frame()

and about your CGI example
either interleave the packets correctly and use av_write_frame()
or dont and use av_interleaved_write_frame()
the first will provide maximum performance as you requested but be
more complex
and if you want to generate broken files like you desribed in some
earlier post then you can as well use av_write_frame() with not correctly
intereaved streams for the set of formats you dont like


> 
> Thanks,
> Roman.
> 
> P.S. Its interesting to notice that ffmpeg itself uses
> av_interleaved_write_frame() where ffserver uses av_write_frame().

i see nothing interresting here, ffserver as a realtime thingy cannot do
extra buffering as the delay would be unacceptable ...

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

When the tyrant has disposed of foreign enemies by conquest or treaty, and
there is nothing more to fear from them, then he is always stirring up
some war or other, in order that the people may require a leader. -- Plato
-------------- 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/20070206/86119911/attachment.pgp>



More information about the ffmpeg-devel mailing list