Changes

Jump to: navigation, search

Oggless

174 bytes added, 16:27, 15 February 2008
no edit summary
{{draft}}
 
==Abstract==
This page will document documents how to embed the different Xiph codecs like Vorbis or Theora in containers other than Ogg. It's still in the drating drafting stage, and most of it was taken from the a [http://svn.mplayerhq.hu/nut/docs/oggless-xiph-codecs.txt?viewrevision=log MPlayer SVN486&pathrev=577 version], that was previously a part of the NUT Subversion repository.Said document was originally authored by Michael Niedermayer.
==Current Version==
* 2007-07-0721
==Status==
This Information on how to convert losslessly from one format to another is a proposal being discussedmissing, as is Ogg timestamping. It's currently not ready to be used on real-life situations. HoweverRegardless, when discussion it is mostly finished and drafting are over, it will likely won't be endorsed by the Xiph.Org Foundationupdated further.
==Minimum container requirements==
This appendix only explains how to store xiph Xiph codecs in containers which support at least one global header per stream, can separate individual codecpackets and in principle support the codec, so . So for example in the case ofvorbis Vorbis, that would be variable bitrate and variable number of samples/packet. Storage in other containers is outside the scope of this appendix.
===Global header:===
If the container can store 3 headers per stream in an unambiguous and ordered way then they shall be stored in that way. If OTOH the container is only capable of storing a single global header, then the 3 codec headers shall be concatenated without any additional header, footer or separator between them. To recover the 3 headers from such a global header the following procedure shall be used:
FIXME non vorbis/theora===Global header:===If the container can store 3 headers per stream in an unambiguous and orderedway then they shall be stored in that way, if OTOH the container is onlycapable to store a single global header then the 3 codec headers shall beconcatenated without any additional header, footer or separator between themto recover the 3 headers from such a global header the following procedureshall be used:: 1) search Search for the 1st occurrence of ID1 the . The found match and the following ID1_LEN bytes are the 1st header packet.
: 2) search for the 1st occurrence of ID2 after here
:: 3) read an unsigned integer of 32 bits and skip that many bytes
:: 7) skip 1 byte
: 8) the match in 2) and what follows until here is the 2nd header packet
: 9) search Search for the 1st occurrence of ID3 after here the . The matching part and what follows is the 3rd header packet.
====Constants:====
{|border="1" cellpadding="4"
! Codec
! ID1
|}
if If the container needs an identifier for the global header, for example a 4ccfourcc for a global header chunk then glbl shall be used.
===Storing packets:===
Each codec packet shall be stored in exactly one "container packet"and one "container packet" must not contain more then one codec packet. "container packet" here means the smallest separatable separable data unit of data in thecontainer.
===Codec Identifier:===
{|border="1" cellpadding="4"! xiph-Xiph codec! 4-cc idfourcc ID! long idID
|-
| Vorbis
| tarkin
|-
| FlacFLAC
| flac
| flac
|}
if If the container uses 4-character codes 4-cc , the fourcc identifier from the table aboveshall be usedif . If the container uses arbitrary length strings as identifiers , then the longid ID from the table above shall be used.
===Examples and Discussions about specific containers===
What follows are some notes about specific containers, these notes are just informative as they just repeat what is written above or in the
specification of the specific container.
===Examples =Example and Discussions about specific containersDiscussion of the AVI container====What follows are some notes about specific containersAVI supports everything needed to store Vorbis, this does not mean that all applications will support Vorbis in AVI, these notes are justinformative as they just repeat what Vorbis is written above or rather different from other audio codecs commonly stored in the specification of the specific containerAVI.
AVI supports a single global header like WAV does, the 3 Vorbis headers
shall be stored in it and only in it as described above. dwSampleSize must be set to zero as vorbis is VBR, many applications do this incorrectly for other VBR codecs and consequently VBR audio in AVI
becomes problematic.
====Example and Discussion of the avi container====avi supports everything needed to store vorbis, this does not mean that allapplication will support vorbis in avi as vorbis is rather different fromother audio codecs commonly stored in avi ...avi supports a single global header like wav does, the 3 vorbis headersshall be stored in it and only in it as described abovedwSampleSize must be set to zero as vorbis is vbr, many applications dothis incorrectly for other vbr codecs and consequently vbr audio in avibecomes problematicavi AVI does not have timestamps , but each chunk has a constant duration, whilevorbis Vorbis packets can have one of 2 durations, if .If now the avi AVI header is setupso set up in a way that each avi AVI chunk has the same duration as the smaller duration ofthe 2 possibilities in vorbis Vorbis,then simply inserting empty avi AVI chunks willallow every avi AVI chunk to have the correct duration, this .This is of coursenot the most beautiful solution but it is the only way to keep thingsexact.exactAdditionally, additionally note, that empty chunks have been used since agesin avi AVI to lengthen the duration of video chunks.
Some Links:
* [http://svn.xiph.org/tags/vorbisacm_20020708/ vorbisacmVorbisacm]
* [http://www.alexander-noe.com/video/documentation/avi.pdf AVI File Format] (PDF), 5.7 (p.21) VFR Audio - Storing Vorbis in AVI
====Example and Discussion of the asf ASF container====asf ASF supports a single global header per stream and has timestamps , sostoring xiph Xiph codecs in it should be possible , but asf ASF is patented and microsoft Microsoft has already threatened individuals , so we strongly urge you to avoid this container  ====Example and Discussion of the matroska container====matroska supports storing 3 headers using a codec specificformat, which should be used for storing the 3 headersNote, the above procedure to split one header into 3 works with thevorbis-matroska specific format too.
====Example and Discussion of the nut Matroska container====nut Matroska supports storing 3 headers using a single global header per stream so the 1<codec->3 merge/splitspecific format.procedure above must This should be used, except that theres nothing special with for storing xiph codecs in nutthe 3 headers.
Note that the above procedure to split one header into 3 works with the
Vorbis-Matroska-specific format, too.
====Example and Discussion of mpeg-ps / mpeg-ts the NUT container====These containers neither support NUT supports a single global header nor provide per stream so the neccessary1<->3 merge/splitprocedure above must be used. Except that there is nothing special with packet separation / framing, so storing xiph Xiph codecs in them is outside the scope of this appendixNUT.
====Example and Discussion of MPEG-PS / MPEG-TS container====
These containers neither support a global header nor do they provide
the necessary packet separation / framing.
Storing Xiph codecs in them is thus outside the scope of this appendix.
====Example and Discussion of wav WAV container====wav WAV does not provide the necessary packet separation / framing, so storing xiph Xiph codecs in it is outside the scope of this appendix.
====Example and Discussion of the MOV container====
A single glbl atom shall be placed in the stsd atom in which the the global header shall be stored.
====Example and Discussion of the mov container====a single glbl atom shall be placed in the stsd atom in which the the globalheader shall be stored[[Category:Drafts]]

Navigation menu