oggstream.html 8.4 KB

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