<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.xiph.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Seelie</id>
	<title>XiphWiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.xiph.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Seelie"/>
	<link rel="alternate" type="text/html" href="https://wiki.xiph.org/Special:Contributions/Seelie"/>
	<updated>2026-05-02T18:45:33Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.45.1</generator>
	<entry>
		<id>https://wiki.xiph.org/index.php?title=Oggless&amp;diff=6845</id>
		<title>Oggless</title>
		<link rel="alternate" type="text/html" href="https://wiki.xiph.org/index.php?title=Oggless&amp;diff=6845"/>
		<updated>2007-06-04T21:54:40Z</updated>

		<summary type="html">&lt;p&gt;Seelie: /* Example and Discussion of the avi container */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The text below is supposed to be a start point for discussions and is ATM identical to [http://svn.mplayerhq.hu/nut/docs/oggless-xiph-codecs.txt?view=log]&lt;br /&gt;
&lt;br /&gt;
==Abstract==&lt;br /&gt;
Embedding xiph codecs like vorbis in containers other than ogg&lt;br /&gt;
&lt;br /&gt;
==Current Version==&lt;br /&gt;
* 2007-05-23&lt;br /&gt;
&lt;br /&gt;
==Status==&lt;br /&gt;
This is a proposal being discussed.  It&#039;s currently not ready to be used on real-life situations.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- ==License==&lt;br /&gt;
GPL + GFDL + anything needed to turn this into a open standard like a RFC~&lt;br /&gt;
(License should not be stated yet, or it will be a mess to change later) --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Minimum container requirements==&lt;br /&gt;
This appendix only explains how to store xiph codecs in containers which &lt;br /&gt;
support at least one global header per stream, can separate individual codec&lt;br /&gt;
packets and in principle support the codec, so for example in the case of&lt;br /&gt;
vorbis that would be variable bitrate and variable number of samples/packet&lt;br /&gt;
Storage in other containers is outside the scope of this appendix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FIXME non vorbis/theora&lt;br /&gt;
===Global header:===&lt;br /&gt;
If the container can store 3 headers per stream in an unambiguous and ordered&lt;br /&gt;
way then they shall be stored in that way, if OTOH the container is only&lt;br /&gt;
capable to store a single global header then the 3 codec headers shall be&lt;br /&gt;
concatenated without any additional header, footer or separator between them&lt;br /&gt;
to recover the 3 headers from such a global header the following procedure&lt;br /&gt;
shall be used:&lt;br /&gt;
: 1) search for the 1st occurrence of ID1 the found match and the following ID1_LEN bytes are the 1st header packet&lt;br /&gt;
: 2) search for the 1st occurrence of ID2 after here&lt;br /&gt;
:: 3) read an unsigned integer of 32 bits and skip that many bytes&lt;br /&gt;
:: 4) [user_comment_list_length] = read an unsigned integer of 32 bits&lt;br /&gt;
:: 5) iterate [user_comment_list_length] times {&lt;br /&gt;
::: 6) read an unsigned integer of 32 bits and skip that many bytes&lt;br /&gt;
:: }&lt;br /&gt;
:: 7) skip 1 byte&lt;br /&gt;
: 8) the match in 2) and what follows until here is the 2nd header packet&lt;br /&gt;
: 9) search for the 1st occurrence of ID3 after here the matching part and what follows is the 3rd header packet&lt;br /&gt;
&lt;br /&gt;
====Constants:====&lt;br /&gt;
{|&lt;br /&gt;
! Codec&lt;br /&gt;
! ID1&lt;br /&gt;
! ID2&lt;br /&gt;
! ID3&lt;br /&gt;
! ID1_LEN&lt;br /&gt;
|-&lt;br /&gt;
| Vorbis&lt;br /&gt;
| 0x01,&#039;v&#039;,&#039;o&#039;,&#039;r&#039;,&#039;b&#039;,&#039;i&#039;,&#039;s&#039;&lt;br /&gt;
| 0x03,&#039;v&#039;,&#039;o&#039;,&#039;r&#039;,&#039;b&#039;,&#039;i&#039;,&#039;s&#039;     &lt;br /&gt;
| 0x05,&#039;v&#039;,&#039;o&#039;,&#039;r&#039;,&#039;b&#039;,&#039;i&#039;,&#039;s&#039;&lt;br /&gt;
| 23&lt;br /&gt;
|-&lt;br /&gt;
| Theora&lt;br /&gt;
| 0x80,&#039;t&#039;,&#039;h&#039;,&#039;e&#039;,&#039;o&#039;,&#039;r&#039;,&#039;a&#039;&lt;br /&gt;
| 0x81,&#039;t&#039;,&#039;h&#039;,&#039;e&#039;,&#039;o&#039;,&#039;r&#039;,&#039;a&#039;&lt;br /&gt;
| 0x82,&#039;t&#039;,&#039;h&#039;,&#039;e&#039;,&#039;o&#039;,&#039;r&#039;,&#039;a&#039;&lt;br /&gt;
| 35&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
if the container needs an identifier for the global header, for example a 4cc&lt;br /&gt;
for a global header chunk then glbl shall be used&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Storing packets:===&lt;br /&gt;
Each codec packet shall be stored in exactly one &amp;quot;container packet&amp;quot;&lt;br /&gt;
and one &amp;quot;container packet&amp;quot; must not contain more then one codec packet&lt;br /&gt;
&amp;quot;container packet&amp;quot; here means the smallest separatable unit of data in the&lt;br /&gt;
container&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Codec Identifier:===&lt;br /&gt;
{|&lt;br /&gt;
! xiph-codec&lt;br /&gt;
! 4-cc id&lt;br /&gt;
! long id&lt;br /&gt;
|-&lt;br /&gt;
| Vorbis      &lt;br /&gt;
| vrbs        &lt;br /&gt;
| vorbis&lt;br /&gt;
|-&lt;br /&gt;
| Theora&lt;br /&gt;
| ther&lt;br /&gt;
| theora&lt;br /&gt;
|-&lt;br /&gt;
| Tarkin&lt;br /&gt;
| trkn&lt;br /&gt;
| tarkin&lt;br /&gt;
|-&lt;br /&gt;
| Flac&lt;br /&gt;
| flac&lt;br /&gt;
| flac&lt;br /&gt;
|-&lt;br /&gt;
| Speex&lt;br /&gt;
| spex&lt;br /&gt;
| speex&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
if the container uses 4-character codes 4-cc identifier from the table above&lt;br /&gt;
shall be used&lt;br /&gt;
if the container uses arbitrary length strings as identifiers then the long&lt;br /&gt;
id from the table above shall be used&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Examples and Discussions about specific containers===&lt;br /&gt;
What follows are some notes about specific containers, these notes are just&lt;br /&gt;
informative as they just repeat what is written above or in the &lt;br /&gt;
specification of the specific container&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Example and Discussion of the avi container====&lt;br /&gt;
avi supports everything needed to store vorbis, this does not mean that all&lt;br /&gt;
application will support vorbis in avi as vorbis is rather different from&lt;br /&gt;
other audio codecs commonly stored in avi ...&lt;br /&gt;
avi supports a single global header like wav does, the 3 vorbis headers&lt;br /&gt;
shall be stored in it and only in it as described above&lt;br /&gt;
dwSampleSize must be set to zero as vorbis is vbr, many applications do&lt;br /&gt;
this incorrectly for other vbr codecs and consequently vbr audio in avi&lt;br /&gt;
becomes problematic&lt;br /&gt;
avi does not have timestamps but each chunk has a constant duration, while&lt;br /&gt;
vorbis packets can have one of 2 durations, if now the avi header is setup&lt;br /&gt;
so that each avi chunk has the same duration as the smaller duration of&lt;br /&gt;
the 2 possibilities in vorbis then simply inserting empty avi chunks will&lt;br /&gt;
allow every avi chunk to have the correct duration, this is of course&lt;br /&gt;
not the most beautiful solution but it is the only way to keep things&lt;br /&gt;
exact, additionally note, that empty chunks have been used since ages&lt;br /&gt;
in avi to lengthen the duration of video chunks&lt;br /&gt;
&lt;br /&gt;
Some Links:&lt;br /&gt;
* [http://svn.xiph.org/tags/vorbisacm_20020708/ vorbisacm]&lt;br /&gt;
* [http://www.alexander-noe.com/video/documentation/avi.pdf AVI File Format] (PDF), 5.7 (p.21) VFR Audio - Storing Vorbis in AVI&lt;br /&gt;
&lt;br /&gt;
====Example and Discussion of the asf container====&lt;br /&gt;
asf supports a single global header per stream and has timestamps so&lt;br /&gt;
storing xiph codecs in it should be possible but asf is patented and &lt;br /&gt;
microsoft has already threatened individuals so we strongly urge you to &lt;br /&gt;
avoid this container&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Example and Discussion of the matroska container====&lt;br /&gt;
matroska supports storing 3 headers using a codec specific&lt;br /&gt;
format, which should be used for storing the 3 headers&lt;br /&gt;
Note, the above procedure to split one header into 3 works with the&lt;br /&gt;
vorbis-matroska specific format too&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Example and Discussion of the nut container====&lt;br /&gt;
nut supports a single global header per stream so the 1&amp;lt;-&amp;gt;3 merge/split&lt;br /&gt;
procedure above must be used, except that theres nothing special with &lt;br /&gt;
storing xiph codecs in nut&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Example and Discussion of mpeg-ps / mpeg-ts container====&lt;br /&gt;
These containers neither support a global header nor provide the neccessary&lt;br /&gt;
packet separation / framing, so storing xiph codecs in them is outside the &lt;br /&gt;
scope of this appendix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Example and Discussion of wav container====&lt;br /&gt;
wav does not provide the necessary packet separation / framing, so storing &lt;br /&gt;
xiph codecs in it is outside the scope of this appendix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Example and Discussion of the mov container====&lt;br /&gt;
a single glbl atom shall be placed in the stsd atom in which the the global&lt;br /&gt;
header shall be stored&lt;/div&gt;</summary>
		<author><name>Seelie</name></author>
	</entry>
</feed>