[NUT-devel] Re: [theora-dev] Theora in Matroska

Michael Niedermayer michaelni at gmx.at
Sat Nov 18 14:57:51 PST 2006


Hi

On Sat, Nov 04, 2006 at 07:09:23AM +1100, Silvia Pfeiffer wrote:
> Let me see if I understand the problem correctly.
> 
> Matroska provides only one header packet per codec to identify it.

my proposal was about the 2 or 3 codec initalization packets at the
start of vorbis, theora, ... streams
identifying the codecs is not a problem in any container format besides
ogg i know of, containers simply have some field which identifies the
codec, that can be a 32bit or 16bit integer, or a variable length
string, or in case of matroska several redundant systems

the problem with the initalization packets, or super keyframes or
sequence headers or whetever you want to call them is that there
are several of them but containers are generally designed to handle
just one such packet per stream
if you would simply store these 3 packets like normal packets then
a demuxer which is told by the user to seek to lets say 5min into
the stream will do so, first it will pass the single global header
(this one is empty in our example) to the codec next it would search
for a keyframe around the requested 5min and start passing packets
begining with the keyframe to the decoder which would fail as it
never received the 3 initalization packets ...

if now the 2 or 3 packets are merged into one and stored in the appropriate
spot for the global packet for the stream then everything will work
fine, of course that requires that the decoder is able to parse 
or the demuxer is able to split the merged packet (for that a few words 
in the relevant specs would be helpfull, whatever the exact method is
which is used to merge the packets ...)

also note this is not about matroska alone, but rather many containers
avi, wav, nut, matroska, nuv, asf to name the ones which IIRC support
a single global header but do not really support multiple ones without
codec specific hacks ...
mpeg-ps/ts does not support any global header, they expect such headers
to be repeated before keyframes (mpeg1/2 video does exactly that with
their sequence headers)
mov allows everything but tends to need a special case per codec in the
demuxer

also APIs tend to support passing a single global packet around but tend
not to support multiple ones ...


[...]
> I am not sure if Matroska would encapsulate the clean codec stream or
> an ogg framed stream. I also don't understand if there would be one
> blob per codec in the case of a multitrack file (e.g. Theora + Vorbis)
> or whether there would be just one large, interleaved blob. In any
> case, I might put our experience into the mix to get this right.

putting a container into a container is the most insane thing you could
do, it also isnt allowed in many containers, avi
requires each packet to be a single packet (people do ignore this yes
i know but they generally dont put other containers in avi), nut 
explicitly says that containers inside streams render the 
file invalid and any player playing such a file is not nut compliant,
i dont know about matroska but it would surprise me if a vorbis+theora 
in ogg stream could be put in matroska without violating some rules
also what is such a stream audio? video? something else?

also ignoring the rules, such files are a nightmare to support, and
even if supported will have a lot of random problems with AV sync

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

In the past you could go to a library and read, borrow or copy any book
Today you'd get arrested for mere telling someone where the library is


More information about the theora-dev mailing list