cannam@86
|
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
cannam@86
|
2 <html>
|
cannam@86
|
3 <head>
|
cannam@86
|
4
|
cannam@86
|
5 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15"/>
|
cannam@86
|
6 <title>Ogg Vorbis Documentation</title>
|
cannam@86
|
7
|
cannam@86
|
8 <style type="text/css">
|
cannam@86
|
9 body {
|
cannam@86
|
10 margin: 0 18px 0 18px;
|
cannam@86
|
11 padding-bottom: 30px;
|
cannam@86
|
12 font-family: Verdana, Arial, Helvetica, sans-serif;
|
cannam@86
|
13 color: #333333;
|
cannam@86
|
14 font-size: .8em;
|
cannam@86
|
15 }
|
cannam@86
|
16
|
cannam@86
|
17 a {
|
cannam@86
|
18 color: #3366cc;
|
cannam@86
|
19 }
|
cannam@86
|
20
|
cannam@86
|
21 img {
|
cannam@86
|
22 border: 0;
|
cannam@86
|
23 }
|
cannam@86
|
24
|
cannam@86
|
25 #xiphlogo {
|
cannam@86
|
26 margin: 30px 0 16px 0;
|
cannam@86
|
27 }
|
cannam@86
|
28
|
cannam@86
|
29 #content p {
|
cannam@86
|
30 line-height: 1.4;
|
cannam@86
|
31 }
|
cannam@86
|
32
|
cannam@86
|
33 h1, h1 a, h2, h2 a, h3, h3 a {
|
cannam@86
|
34 font-weight: bold;
|
cannam@86
|
35 color: #ff9900;
|
cannam@86
|
36 margin: 1.3em 0 8px 0;
|
cannam@86
|
37 }
|
cannam@86
|
38
|
cannam@86
|
39 h1 {
|
cannam@86
|
40 font-size: 1.3em;
|
cannam@86
|
41 }
|
cannam@86
|
42
|
cannam@86
|
43 h2 {
|
cannam@86
|
44 font-size: 1.2em;
|
cannam@86
|
45 }
|
cannam@86
|
46
|
cannam@86
|
47 h3 {
|
cannam@86
|
48 font-size: 1.1em;
|
cannam@86
|
49 }
|
cannam@86
|
50
|
cannam@86
|
51 li {
|
cannam@86
|
52 line-height: 1.4;
|
cannam@86
|
53 }
|
cannam@86
|
54
|
cannam@86
|
55 #copyright {
|
cannam@86
|
56 margin-top: 30px;
|
cannam@86
|
57 line-height: 1.5em;
|
cannam@86
|
58 text-align: center;
|
cannam@86
|
59 font-size: .8em;
|
cannam@86
|
60 color: #888888;
|
cannam@86
|
61 clear: both;
|
cannam@86
|
62 }
|
cannam@86
|
63 </style>
|
cannam@86
|
64
|
cannam@86
|
65 </head>
|
cannam@86
|
66
|
cannam@86
|
67 <body>
|
cannam@86
|
68
|
cannam@86
|
69 <div id="xiphlogo">
|
cannam@86
|
70 <a href="http://www.xiph.org/"><img src="fish_xiph_org.png" alt="Fish Logo and Xiph.Org"/></a>
|
cannam@86
|
71 </div>
|
cannam@86
|
72
|
cannam@86
|
73 <h1>Ogg logical and physical bitstream overview</h1>
|
cannam@86
|
74
|
cannam@86
|
75 <h2>Ogg bitstreams</h2>
|
cannam@86
|
76
|
cannam@86
|
77 <p>Ogg codecs use octet vectors of raw, compressed data
|
cannam@86
|
78 (<em>packets</em>). These compressed packets do not have any
|
cannam@86
|
79 high-level structure or boundary information; strung together, they
|
cannam@86
|
80 appear to be streams of random bytes with no landmarks.</p>
|
cannam@86
|
81
|
cannam@86
|
82 <p>Raw packets may be used directly by transport mechanisms that provide
|
cannam@86
|
83 their own framing and packet-separation mechanisms (such as UDP
|
cannam@86
|
84 datagrams). For stream based storage (such as files) and transport
|
cannam@86
|
85 (such as TCP streams or pipes), Vorbis and other future Ogg codecs use
|
cannam@86
|
86 the Ogg bitstream format to provide framing/sync, sync recapture
|
cannam@86
|
87 after error, landmarks during seeking, and enough information to
|
cannam@86
|
88 properly separate data back into packets at the original packet
|
cannam@86
|
89 boundaries without relying on decoding to find packet boundaries.</p>
|
cannam@86
|
90
|
cannam@86
|
91 <h2>Logical and physical bitstreams</h2>
|
cannam@86
|
92
|
cannam@86
|
93 <p>Raw packets are grouped and encoded into contiguous pages of
|
cannam@86
|
94 structured bitstream data called <em>logical bitstreams</em>. A
|
cannam@86
|
95 logical bitstream consists of pages, in order, belonging to a single
|
cannam@86
|
96 codec instance. Each page is a self contained entity (although it is
|
cannam@86
|
97 possible that a packet may be split and encoded across one or more
|
cannam@86
|
98 pages); that is, the page decode mechanism is designed to recognize,
|
cannam@86
|
99 verify and handle single pages at a time from the overall bitstream.</p>
|
cannam@86
|
100
|
cannam@86
|
101 <p>Multiple logical bitstreams can be combined (with restrictions) into a
|
cannam@86
|
102 single <em>physical bitstream</em>. A physical bitstream consists of
|
cannam@86
|
103 multiple logical bitstreams multiplexed at the page level and may
|
cannam@86
|
104 include a 'meta-header' at the beginning of the multiplexed logical
|
cannam@86
|
105 stream that serves as identification magic. Whole pages are taken in
|
cannam@86
|
106 order from multiple logical bitstreams and combined into a single
|
cannam@86
|
107 physical stream of pages. The decoder reconstructs the original
|
cannam@86
|
108 logical bitstreams from the physical bitstream by taking the pages in
|
cannam@86
|
109 order from the physical bitstream and redirecting them into the
|
cannam@86
|
110 appropriate logical decoding entity. The simplest physical bitstream
|
cannam@86
|
111 is a single, unmultiplexed logical bitstream with no meta-header; this
|
cannam@86
|
112 is referred to as a 'degenerate stream'.</p>
|
cannam@86
|
113
|
cannam@86
|
114 <p><a href="framing.html">Ogg Logical Bitstream Framing</a> discusses
|
cannam@86
|
115 the page format of an Ogg bitstream, the packet coding process
|
cannam@86
|
116 and logical bitstreams in detail. The remainder of this document
|
cannam@86
|
117 specifies requirements for constructing finished, physical Ogg
|
cannam@86
|
118 bitstreams.</p>
|
cannam@86
|
119
|
cannam@86
|
120 <h2>Mapping Restrictions</h2>
|
cannam@86
|
121
|
cannam@86
|
122 <p>Logical bitstreams may not be mapped/multiplexed into physical
|
cannam@86
|
123 bitstreams without restriction. Here we discuss design restrictions
|
cannam@86
|
124 on Ogg physical bitstreams in general, mostly to introduce
|
cannam@86
|
125 design rationale. Each 'media' format defines its own (generally more
|
cannam@86
|
126 restrictive) mapping. An 'Ogg Vorbis Audio Bitstream', for example, has a
|
cannam@86
|
127 specific physical bitstream structure.
|
cannam@86
|
128 An 'Ogg A/V' bitstream (not currently specified) will also mandate a
|
cannam@86
|
129 specific, restricted physical bitstream format.</p>
|
cannam@86
|
130
|
cannam@86
|
131 <h3>additional end-to-end structure</h3>
|
cannam@86
|
132
|
cannam@86
|
133 <p>The <a href="framing.html">framing specification</a> defines
|
cannam@86
|
134 'beginning of stream' and 'end of stream' page markers via a header
|
cannam@86
|
135 flag (it is possible for a stream to consist of a single page). A
|
cannam@86
|
136 stream always consists of an integer number of pages, an easy
|
cannam@86
|
137 requirement given the variable size nature of pages.</p>
|
cannam@86
|
138
|
cannam@86
|
139 <p>In addition to the header flag marking the first and last pages of a
|
cannam@86
|
140 logical bitstream, the first page of an Ogg bitstream obeys
|
cannam@86
|
141 additional restrictions. Each individual media mapping specifies its
|
cannam@86
|
142 own implementation details regarding these restrictions.</p>
|
cannam@86
|
143
|
cannam@86
|
144 <p>The first page of a logical Ogg bitstream consists of a single,
|
cannam@86
|
145 small 'initial header' packet that includes sufficient information to
|
cannam@86
|
146 identify the exact CODEC type and media requirements of the logical
|
cannam@86
|
147 bitstream. The intent of this restriction is to simplify identifying
|
cannam@86
|
148 the bitstream type and content; for a given media type (or across all
|
cannam@86
|
149 Ogg media types) we can know that we only need a small, fixed
|
cannam@86
|
150 amount of data to uniquely identify the bitstream type.</p>
|
cannam@86
|
151
|
cannam@86
|
152 <p>As an example, Ogg Vorbis places the name and revision of the Vorbis
|
cannam@86
|
153 CODEC, the audio rate and the audio quality into this initial header,
|
cannam@86
|
154 thus simplifying vastly the certain identification of an Ogg Vorbis
|
cannam@86
|
155 audio bitstream.</p>
|
cannam@86
|
156
|
cannam@86
|
157 <h3>sequential multiplexing (chaining)</h3>
|
cannam@86
|
158
|
cannam@86
|
159 <p>The simplest form of logical bitstream multiplexing is concatenation
|
cannam@86
|
160 (<em>chaining</em>). Complete logical bitstreams are strung
|
cannam@86
|
161 one-after-another in order. The bitstreams do not overlap; the final
|
cannam@86
|
162 page of a given logical bitstream is immediately followed by the
|
cannam@86
|
163 initial page of the next. Chaining is the only logical->physical
|
cannam@86
|
164 mapping allowed by Ogg Vorbis.</p>
|
cannam@86
|
165
|
cannam@86
|
166 <p>Each chained logical bitstream must have a unique serial number within
|
cannam@86
|
167 the scope of the physical bitstream.</p>
|
cannam@86
|
168
|
cannam@86
|
169 <h3>concurrent multiplexing (grouping)</h3>
|
cannam@86
|
170
|
cannam@86
|
171 <p>Logical bitstreams may also be multiplexed 'in parallel'
|
cannam@86
|
172 (<em>grouped</em>). An example of grouping would be to allow
|
cannam@86
|
173 streaming of separate audio and video streams, using different codecs
|
cannam@86
|
174 and different logical bitstreams, in the same physical bitstream.
|
cannam@86
|
175 Whole pages from multiple logical bitstreams are mixed together.</p>
|
cannam@86
|
176
|
cannam@86
|
177 <p>The initial pages of each logical bitstream must appear first; the
|
cannam@86
|
178 media mapping specifies the order of the initial pages. For example,
|
cannam@86
|
179 Ogg A/V will eventually specify an Ogg video bitstream with
|
cannam@86
|
180 audio. The mapping may specify that the physical bitstream must begin
|
cannam@86
|
181 with the initial page of a logical video bitstream, followed by the
|
cannam@86
|
182 initial page of an audio stream. Unlike initial pages, terminal pages
|
cannam@86
|
183 for the logical bitstreams need not all occur contiguously (although a
|
cannam@86
|
184 specific media mapping may require this; it is not mandated by the
|
cannam@86
|
185 generic Ogg stream spec). Terminal pages may be 'nil' pages,
|
cannam@86
|
186 that is, pages containing no content but simply a page header with
|
cannam@86
|
187 position information and the 'last page of bitstream' flag set in the
|
cannam@86
|
188 page header.</p>
|
cannam@86
|
189
|
cannam@86
|
190 <p>Each grouped bitstream must have a unique serial number within the
|
cannam@86
|
191 scope of the physical bitstream.</p>
|
cannam@86
|
192
|
cannam@86
|
193 <h3>sequential and concurrent multiplexing</h3>
|
cannam@86
|
194
|
cannam@86
|
195 <p>Groups of concurrently multiplexed bitstreams may be chained
|
cannam@86
|
196 consecutively. Such a physical bitstream obeys all the rules of both
|
cannam@86
|
197 grouped and chained multiplexed streams; the groups, when unchained ,
|
cannam@86
|
198 must stand on their own as a valid concurrently multiplexed
|
cannam@86
|
199 bitstream.</p>
|
cannam@86
|
200
|
cannam@86
|
201 <h3>multiplexing example</h3>
|
cannam@86
|
202
|
cannam@86
|
203 <p>Below, we present an example of a grouped and chained bitstream:</p>
|
cannam@86
|
204
|
cannam@86
|
205 <p><img src="stream.png" alt="stream"/></p>
|
cannam@86
|
206
|
cannam@86
|
207 <p>In this example, we see pages from five total logical bitstreams
|
cannam@86
|
208 multiplexed into a physical bitstream. Note the following
|
cannam@86
|
209 characteristics:</p>
|
cannam@86
|
210
|
cannam@86
|
211 <ol>
|
cannam@86
|
212 <li>Grouped bitstreams begin together; all of the initial pages
|
cannam@86
|
213 must appear before any data pages. When concurrently multiplexed
|
cannam@86
|
214 groups are chained, the new group does not begin until all the
|
cannam@86
|
215 bitstreams in the previous group have terminated.</li>
|
cannam@86
|
216
|
cannam@86
|
217 <li>The pages of concurrently multiplexed bitstreams need not conform
|
cannam@86
|
218 to a regular order; the only requirement is that page <tt>n</tt> of a
|
cannam@86
|
219 logical bitstream follow page <tt>n-1</tt> in the physical bitstream.
|
cannam@86
|
220 There are no restrictions on intervening pages belonging to other
|
cannam@86
|
221 logical bitstreams. (Tying page appearance to bitrate demands is one
|
cannam@86
|
222 logical strategy, ie, the page appears at the chronological point
|
cannam@86
|
223 where decode requires more information).</li>
|
cannam@86
|
224 </ol>
|
cannam@86
|
225
|
cannam@86
|
226 <div id="copyright">
|
cannam@86
|
227 The Xiph Fish Logo is a
|
cannam@86
|
228 trademark (™) of Xiph.Org.<br/>
|
cannam@86
|
229
|
cannam@86
|
230 These pages © 1994 - 2005 Xiph.Org. All rights reserved.
|
cannam@86
|
231 </div>
|
cannam@86
|
232
|
cannam@86
|
233 </body>
|
cannam@86
|
234 </html>
|