[Matroska-devel] [Fwd: Re: Dirac mapping for Matroska]
Sebastian Dröge
sebastian.droege at collabora.co.uk
Tue Jun 24 15:11:23 CEST 2008
Hi,
after reading all the discussion about how to best put Dirac into
Matroska I would propose the following plan, which includes all aspects
mentioned in the previous mails and goes in line with how other codecs
are handled.
In Dirac there exist 4 different types of "packets":
- Sequence header
- Picture
- Auxiliary data
- Padding data
The sequence header contains information that is important for the
decoder to actually decode the pictures (aka frames). After a sequence
header a I frame must follow. For one stream all sequence headers must
be bit identical.
The auxiliary data contains "metadata", which is not strictly needed for
anything and could in theory be dropped. See
http://www.diracvideo.org/wiki/index.php/DiracAuxiliaryData for the list
of defined auxiliary data types. Auxiliary data packets are associated
with the following picture packet.
The padding data contains nothing useful.
See the Dirac spec for more on this:
http://dirac.sourceforge.net/specification.html
Now my idea for putting Dirac into Matroska would be the following:
- CodecID would be "V_DIRAC"
- The sequence header would be stored in CodecPrivate and
should be stripped from the stream
- The actual content of a block/lace would be one picture and only
pictures are stored there
- Any existing auxiliary data should be stored in BlockAdditions in
the block of the picture it is associated with. All auxiliary data
packets for one picture should be stored in a single BlockAdditional
as there could be zero to infinite auxiliary packets for one
picture and a maximum can't be known before and put into
MaxBlockAdditionID.
All these auxiliary data packets for one picture are stored in a
row and if a demuxer wants to parse them it can step through the
packets by looking the parse info at the start of every packet,
see section 9.6 of the Dirac 2.2 spec for this.
Of course muxers can also decide to simply drop auxiliary data packets
as they're not needed for decoding
- As for MPEG1/2 the muxer must write ReferenceBlock for every
block that doesn't contain I frames
When demuxing a "V_DIRAC" stream it is important that the demuxer
outputs the sequence header from CodecPrivate before any pictures. After
seeking the demuxer should also output the sequence header just before
the first I frame after seeking.
This would be similar to what is done for MPEG1/2 video right now.
Any comments? Is there something that needs to be clarified?
If not it would be nice if this could be added to the Matroska spec.
If everybody is fine with this I'll implement it in the GStreamer
Matroska muxer and demuxer.
More information about the Matroska-devel
mailing list