oggstream.html 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. <HTML><HEAD><TITLE>xiph.org: Ogg Vorbis documentation</TITLE>
  2. <BODY bgcolor="#ffffff" text="#202020" link="#006666" vlink="#000000">
  3. <nobr><a href="vorbis.html"><img src="white-ogg.png" border=0><img
  4. src="vorbisword2.png" border=0></a></nobr><p>
  5. <h1><font color=#000070>
  6. Ogg logical and physical bitstream overview
  7. </font></h1>
  8. <em>Last update to this document: July 18, 1999</em><br>
  9. <h2>Ogg bitstreams</h2>
  10. Ogg codecs use octet vectors of raw, compressed data
  11. (<em>packets</em>). These compressed packets do not have any
  12. high-level structure or boundary information; strung together, they
  13. appear to be streams of random bytes with no landmarks.<p>
  14. Raw packets may be used directly by transport mechanisms that provide
  15. their own framing and packet-seperation mechanisms (such as UDP
  16. datagrams). For stream based storage (such as files) and transport
  17. (such as TCP streams or pipes), Vorbis and other future Ogg codecs use
  18. the Ogg bitstream format to provide framing/sync, sync recapture
  19. after error, landmarks during seeking, and enough information to
  20. properly seperate data back into packets at the original packet
  21. boundaries without relying on decoding to find packet boundaries.<p>
  22. <h2>Logical and physical bitstreams</h2>
  23. Raw packets are grouped and encoded into contiguous pages of
  24. structured bitstream data called <em>logical bitstreams</em>. A
  25. logical bitstream consists of pages, in order, belonging to a single
  26. codec instance. Each page is a self contained entity (although it is
  27. possible that a packet may be split and encoded across one or more
  28. pages); that is, the page decode mechanism is designed to recognize,
  29. verify and handle single pages at a time from the overall bitstream.<p>
  30. Multiple logical bitstreams can be combined (with restricctions) into
  31. a single <em>physical bitstream</em>. A physical bitstream consists
  32. of multiple logical bitstreams multiplexed at the page level. Whole
  33. pages are taken in order from multiple logical bitstreams and combined
  34. into a single physical stream of pages. The decoder reconstructs the
  35. original logical bitstreams from the physical bitstream by taking the
  36. pages in order fromt he physical bitstream and redirecting them into
  37. the appropriate logical decoding entitiy. The simplest physical
  38. bitstream is a single, unmultiplexed logical bitstream. <p>
  39. <a href=framing.html>Ogg Logical Bitstream Framing</a> discusses
  40. the page format of an Ogg bitstream, the packet coding process
  41. and logical bitstreams in detail. The remainder of this document
  42. specifies requirements for constructing finished, physical Ogg
  43. bitstreams.<p>
  44. <h2>Mapping Restrictions</h2>
  45. Logical bitstreams may not be mapped/multiplexed into physical
  46. bitstreams without restriction. Here we discuss design restrictions
  47. on Ogg physical bitstreams in general, mostly to introduce
  48. design rationale. Each 'media' format defines its own (generally more
  49. restrictive) mapping. An '<a href="vorbis-stream.html">Ogg Vorbis
  50. Audio Bitstream</a>', for example, has a <a
  51. href="vorbis-stream.html">specific physical bitstream structure</a>.
  52. An 'Ogg A/V' bitstream (not currently specified) will also mandate a
  53. specific, restricted physical bitstream format.<p>
  54. <h3>additional end-to-end structure</h3>
  55. The <a href="framing.html">framing specification</a> defines
  56. 'beginning of stream' and 'end of stream' page markers via a header
  57. flag (it is possible for a stream to consist of a single page). A
  58. stream always consists of an integer number of pages, an easy
  59. requirement given the variable size nature of pages.<p>
  60. In addition to the header flag marking the first and last pages of a
  61. logical bitstream, the first page of an Ogg bitstream obeys
  62. additional restrictions. Each individual media mapping specifies its
  63. own implementation details regarding these restrictions.<p>
  64. The first page of a logical Ogg bitstream consists of a single,
  65. small 'initial header' packet that includes sufficient information to
  66. identify the exact CODEC type and media requirements of the logical
  67. bitstream. The intent of this restriction is to simplify identifying
  68. the bitstream type and content; for a given media type (or across all
  69. Ogg media types) we can know that we only need a small, fixed
  70. amount of data to uniquely identify the bitstream type.<p>
  71. As an example, Ogg Vorbis places the name and revision of the Vorbis
  72. CODEC, the audio rate and the audio quality into this initial header,
  73. thus simplifying vastly the certain identification of an Ogg Vorbis
  74. audio bitstream.<p>
  75. <h3>sequential multiplexing (chaining)</h3>
  76. The simplest form of logical bitstream multiplexing is concatenation
  77. (<em>chaining</em>). Complete logical bitstreams are strung
  78. one-after-another in order. The bitstreams do not overlap; the final
  79. page of a given logical bitstream is immediately followed by the
  80. initial page of the next. Chaining is the only logical->physical
  81. mapping allowed by Ogg Vorbis.<p>
  82. Each chained logical bitstream must have a unique serial number within
  83. the scope of the physical bitstream.<p>
  84. <h3>concurrent multiplexing (grouping)</h3>
  85. Logical bitstreams may also be multiplexed 'in parallel'
  86. (<em>grouped</em>). An example of grouping would be to allow
  87. streaming of seperate audio and video streams, using differnt codecs
  88. and different logical bitstreams, in the same physical bitstream.
  89. Whole pages from multiple logical bitstreams are mixed together.<p>
  90. The initial pages of each logical bitstream must appear first; the
  91. media mapping specifies the order of the initial pages. For example,
  92. Ogg A/V will eventually specify an Ogg video bitstream with
  93. audio. The mapping may specify that the physical bitstream must begin
  94. with the initial page of a logical video bitstream, followed by the
  95. initial page of an audio stream. Unlike initial pages, terminal pages
  96. for the logical bitstreams need not all occur contiguously (although a
  97. specific media mapping may require this; it is not mandated by the
  98. generic Ogg stream spec). Terminal pages may be 'nil' pages,
  99. that is, pages containing no content but simply a page header with
  100. position information and the 'last page of bitstream' flag set in the
  101. page header.<p>
  102. Each grouped bitstream must have a unique serial number within the
  103. scope of the physical bitstream.<p>
  104. <h3>sequential and concurrent multiplexing</h3>
  105. Groups of concurrently multiplexed bitstreams may be chained
  106. consecutively. Such a physical bitstream obeys all the rules of both
  107. grouped and chained multiplexed streams; the groups, when unchained ,
  108. must stand on their own as a valid concurrently multiplexed
  109. bitstream.<p>
  110. <h3>multiplexing example</h3>
  111. Below, we present an example of a grouped and chained bitstream:<p>
  112. <img src=stream.png><p>
  113. In this example, we see pages from five total logical bitstreams
  114. multiplexed into a physical bitstream. Note the following
  115. characteristics:
  116. <ol><li>Grouped bitstreams begin together; all of the initial pages
  117. must appear before any data pages. When concurrently multiplexed
  118. groups are chained, the new group does not begin until all the
  119. bitstreams in the previous group have terminated.<p>
  120. <li>The pages of concurrently multiplexed bitstreams need not conform
  121. to a regular order; the only requirement is that page <tt>n</tt> of a
  122. logical bitstream follow page <tt>n-1</tt> in the physical bitstream.
  123. There are no restrictions on intervening pages belonging to other
  124. logical bitstreams. (Tying page appearence to bitrate demands is one
  125. logical strategy, ie, the page appears at the chronological point
  126. where decode requires more information).
  127. </ol>
  128. <hr>
  129. <a href="http://www.xiph.org/">
  130. <img src="white-xifish.png" align=left border=0>
  131. </a>
  132. <font size=-2 color=#505050>
  133. Ogg is a <a href="http://www.xiph.org">Xiphophorus</a> effort to
  134. protect essential tenets of Internet multimedia from corporate
  135. hostage-taking; Open Source is the net's greatest tool to keep
  136. everyone honest. See <a href="http://www.xiph.org/about.html">About
  137. Xiphophorus</a> for details.
  138. <p>
  139. Ogg Vorbis is the first Ogg audio CODEC. Anyone may
  140. freely use and distribute the Ogg and Vorbis specification,
  141. whether in a private, public or corporate capacity. However,
  142. Xiphophorus and the Ogg project (xiph.org) reserve the right to set
  143. the Ogg/Vorbis specification and certify specification compliance.<p>
  144. Xiphophorus's Vorbis software CODEC implementation is distributed
  145. under the Lesser/Library GNU Public License. This does not restrict
  146. third parties from distributing independent implementations of Vorbis
  147. software under other licenses.<p>
  148. OggSquish, Vorbis, Xiphophorus and their logos are trademarks (tm) of
  149. <a href="http://www.xiph.org/">Xiphophorus</a>. These pages are
  150. copyright (C) 1994-2000 Xiphophorus. All rights reserved.<p>
  151. </body>