[Ffmpeg-devel] Interleaving audio and video

Roman Shaposhnik rvs
Mon Feb 5 20:19:42 CET 2007


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 ? 


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

More information about the ffmpeg-devel mailing list