[FFmpeg-devel] [libav-devel] mpegts encoder not interleaving audio/video packets well

Tony Strauss tony at animoto.com
Thu Jun 16 18:05:34 CEST 2011

On Wed, Jun 15, 2011 at 4:18 AM, Martin Storsjö <martin at martin.st> wrote:

> On Tue, 14 Jun 2011, Kieran Kunhya wrote:
> > >> What does everyone think?
> >
> > The proper fix is to follow the buffering model of the spec and
> interleave
> > ts packets appropriately. However, this will break iPhone, iPad and other
> things because they don't follow the spec.
> Could this be settable via a muxer specific avoption, choosing between
> apple-compatible or spec compliant mode?

I think that the iPhone is compatible with streams with relatively little
interleaving (the current mpegts muxer output) and with streams with a high
degree of interleaving (my "fix" of removing the buffering of audio frames).
 Certainly, the streams that are produced by the mpegts muxer after my "fix"
are playable on my iPhone.

I took a look through the mpeg ps encoder (libavformat/mpegenc.c).  It seems
to require interleaving within .7 sec by default (max_delay).  I think that
it's reasonable to implement this for the mpegts muxer as well.  max_delay
also is configurable via ffmpeg's command-line, so people can set it to be
whatever they want.  I can create a patch for this, if it sounds reasonable
to everyone.


More information about the ffmpeg-devel mailing list