[Matroska-devel] Re: MPEG in MKV

Ronald S. Bultje rbultje at ronald.bitfreak.net
Thu Jan 29 10:12:19 CET 2004

Hi John,

On Wed, 2004-01-28 at 19:19, John Cannon wrote:
> Ronald S. Bultje wrote:
> > On Wed, 2004-01-28 at 17:29, John Cannon wrote:
> >>- GOP headers may optionally be excluded as according to the specs.
> > Which specs?
> ISO MPEG-2 says:
> "Group of picture header is an optional header that can be used 
> immediately before a coded I-frame to
> indicate to the decoder if the first consecutive B-pictures immediately 
> following the coded I-frame can
> be reconstructed properly in the case of a random access."  This makes 
> me believe it's not required.

I can't find any such thing in the MPEG-1 video specs (11172-2). I only
looked at it briefly, though. I do know that several decoders or parsers
(parsing bitstream to AVI-/matroska-compatible frame blocks) sync on the
GOP-/sequence-header *pairs*. Don't know about decoders, I'm too lazy to
check those.

MPEG-1 and -2 might differ in this respect, though. I don't have the
MPEG-2 specs here, I don't really use MPEG-2 much yet (as a developer).

> Of course they require the sequence headers but the GOP header only 
> serves one purpose, to tell the decoder if the following GOP has some 
> broken/missing references.  IMO if the decoder MUST use this it's simply 
> broken.  Perhaps we should only include them if they tell that the gop 
> is broken?

It makes sense to remove it from a *logical* point of view. I'm just
talking about the *practical* part of it. I don't want to rewrite all
sorts of stuff because some container format (heh ;) ) thought it'd be
cool to do things differently.

Apparently, for MPEG-2, it's legal to omit the GOP header, which sounds
fine to me. I can't find that in the MPEG-1 specs, so I'm scary to allow
it (explicitly) for MPEG-1, too. I'd say that it's fairly logical to
allow it for MPEG-2 only, then (even though most MPEG-1/2 combi decoders
will decode MPEG-1 with missing GOP headers just fine, too, simply
because that simplifies their implementation as a combi-decoder).

> > Apart from that, seems similar to MPGI in AVI - so it's fine, I guess.
> > The fact that MPEG-4 is stored in display and MPEG-1 in coding order is
> > logical (specs), but confusing. I'd make this an explicit note in your
> > Matroska specs.
> ummm...doesn't native mpeg4 use coding order?

Afaik, that depends on the implementation (xvid, divx, 3ivx, blax, foox,
barx, ...). ISO MPEG-4 stores everything in coding order, but nobody
really uses ISO MPEG-4 much yet right now.

But there, too: I don't have any specs handy. These things are way too
expensive for me, and my employer already gave me the MPEG-1 specs,
can't ask too much, can I? ;).

> > PS: why do stream headers go into codecpivate? Where do you use them?
> Well, it makes it easier for DirectShow since we need the sequence 
> header to create the output format.  If it can be done without it, i 
> don't know that we really need it there.  Any ideas? Toff?

Well, GStreamer or ffmpeg doesn't need it... I'm no DirectShow expert,


Ronald Bultje <rbultje at ronald.bitfreak.net>
Linux Video/Multimedia developer

More information about the Matroska-devel mailing list