{"id":15,"date":"2012-03-24T16:01:39","date_gmt":"2012-03-24T08:01:39","guid":{"rendered":"http:\/\/www.datarelab.com\/blog\/?p=15"},"modified":"2012-03-24T16:01:39","modified_gmt":"2012-03-24T08:01:39","slug":"ogg%e6%96%87%e4%bb%b6%e6%a0%bc%e5%bc%8f","status":"publish","type":"post","link":"https:\/\/www.datarelab.com\/blog\/Technical_literature\/15.html","title":{"rendered":"Ogg\u6587\u4ef6\u683c\u5f0f"},"content":{"rendered":"<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The Ogg Encapsulation Format Version 0<\/p>\n<p>Status of this Memo<\/p>\n<p>&nbsp;&nbsp; This memo provides information for the Internet community.&nbsp; It does<br \/>\n&nbsp;&nbsp; not specify an Internet standard of any kind.&nbsp; Distribution of this<br \/>\n&nbsp;&nbsp; memo is unlimited.<\/p>\n<p>Copyright Notice<\/p>\n<p>&nbsp;&nbsp; Copyright (C) The Internet Society (2003).&nbsp; All Rights Reserved.<\/p>\n<p>Abstract<\/p>\n<p>&nbsp;&nbsp; This document describes the Ogg bitstream format version 0, which is<br \/>\n&nbsp;&nbsp; a general, freely-available encapsulation format for media streams.<br \/>\n&nbsp;&nbsp; It is able to encapsulate any kind and number of video and audio<br \/>\n&nbsp;&nbsp; encoding formats as well as other data streams in a single bitstream.<\/p>\n<p>Terminology<\/p>\n<p>&nbsp;&nbsp; The key words \"MUST\", \"MUST NOT\", \"REQUIRED\", \"SHALL\", \"SHALL NOT\",<br \/>\n&nbsp;&nbsp; \"SHOULD\", \"SHOULD NOT\", \"RECOMMENDED\", \"MAY\", and \"OPTIONAL\" in this<br \/>\n&nbsp;&nbsp; document are to be interpreted as described in BCP 14, RFC 2119 [2].<\/p>\n<p>Table of Contents<\/p>\n<p>&nbsp;&nbsp; 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . .&nbsp;&nbsp; 2<br \/>\n&nbsp;&nbsp; 2. Definitions&nbsp; . . . . . . . . . . . . . . . . . . . . . . . . .&nbsp;&nbsp; 2<br \/>\n&nbsp;&nbsp; 3. Requirements for a generic encapsulation format&nbsp; . . . . . . .&nbsp;&nbsp; 3<br \/>\n&nbsp;&nbsp; 4. The Ogg bitstream format . . . . . . . . . . . . . . . . . . .&nbsp;&nbsp; 3<br \/>\n&nbsp;&nbsp; 5. The encapsulation process&nbsp; . . . . . . . . . . . . . . . . . .&nbsp;&nbsp; 6<br \/>\n&nbsp;&nbsp; 6. The Ogg page format&nbsp; . . . . . . . . . . . . . . . . . . . . .&nbsp;&nbsp; 9<br \/>\n&nbsp;&nbsp; 7. Security Considerations&nbsp; . . . . . . . . . . . . . . . . . . .&nbsp; 11<br \/>\n&nbsp;&nbsp; 8. References . . . . . . . . . . . . . . . . . . . . . . . . . .&nbsp; 12<br \/>\n&nbsp;&nbsp; A. Glossary of terms and abbreviations&nbsp; . . . . . . . . . . . . .&nbsp; 13<br \/>\n&nbsp;&nbsp; B. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . .&nbsp; 14<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Author's Address . . . . . . . . . . . . . . . . . . . . . . .&nbsp; 14<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Full Copyright Statement . . . . . . . . . . . . . . . . . . .&nbsp; 15<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>Pfeiffer&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Informational&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [Page 1]<\/p>\n<p>RFC 3533&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OGG&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; May 2003<\/p>\n<p>\n1. Introduction<\/p>\n<p>&nbsp;&nbsp; The Ogg bitstream format has been developed as a part of a larger<br \/>\n&nbsp;&nbsp; project aimed at creating a set of components for the coding and<br \/>\n&nbsp;&nbsp; decoding of multimedia content (codecs) which are to be freely<br \/>\n&nbsp;&nbsp; available and freely re-implementable, both in software and in<br \/>\n&nbsp;&nbsp; hardware for the computing community at large, including the Internet<br \/>\n&nbsp;&nbsp; community.&nbsp; It is the intention of the Ogg developers represented by<br \/>\n&nbsp;&nbsp; Xiph.Org that it be usable without intellectual property concerns.<\/p>\n<p>&nbsp;&nbsp; This document describes the Ogg bitstream format and how to use it to<br \/>\n&nbsp;&nbsp; encapsulate one or several media bitstreams created by one or several<br \/>\n&nbsp;&nbsp; encoders.&nbsp; The Ogg transport bitstream is designed to provide<br \/>\n&nbsp;&nbsp; framing, error protection and seeking structure for higher-level<br \/>\n&nbsp;&nbsp; codec streams that consist of raw, unencapsulated data packets, such<br \/>\n&nbsp;&nbsp; as the Vorbis audio codec or the upcoming Tarkin and Theora video<br \/>\n&nbsp;&nbsp; codecs.&nbsp; It is capable of interleaving different binary media and<br \/>\n&nbsp;&nbsp; other time-continuous data streams that are prepared by an encoder as<br \/>\n&nbsp;&nbsp; a sequence of data packets.&nbsp; Ogg provides enough information to<br \/>\n&nbsp;&nbsp; properly separate data back into such encoder created data packets at<br \/>\n&nbsp;&nbsp; the original packet boundaries without relying on decoding to find<br \/>\n&nbsp;&nbsp; packet boundaries.<\/p>\n<p>&nbsp;&nbsp; Please note that the MIME type application\/ogg has been registered<br \/>\n&nbsp;&nbsp; with the IANA [1].<\/p>\n<p>2. Definitions<\/p>\n<p>&nbsp;&nbsp; For describing the Ogg encapsulation process, a set of terms will be<br \/>\n&nbsp;&nbsp; used whose meaning needs to be well understood.&nbsp; Therefore, some of<br \/>\n&nbsp;&nbsp; the most fundamental terms are defined now before we start with the<br \/>\n&nbsp;&nbsp; description of the requirements for a generic media stream<br \/>\n&nbsp;&nbsp; encapsulation format, the process of encapsulation, and the concrete<br \/>\n&nbsp;&nbsp; format of the Ogg bitstream.&nbsp; See the Appendix for a more complete<br \/>\n&nbsp;&nbsp; glossary.<\/p>\n<p>&nbsp;&nbsp; The result of an Ogg encapsulation is called the \"Physical (Ogg)<br \/>\n&nbsp;&nbsp; Bitstream\".&nbsp; It encapsulates one or several encoder-created<br \/>\n&nbsp;&nbsp; bitstreams, which are called \"Logical Bitstreams\".&nbsp; A logical<br \/>\n&nbsp;&nbsp; bitstream, provided to the Ogg encapsulation process, has a<br \/>\n&nbsp;&nbsp; structure, i.e., it is split up into a sequence of so-called<br \/>\n&nbsp;&nbsp; \"Packets\".&nbsp; The packets are created by the encoder of that logical<br \/>\n&nbsp;&nbsp; bitstream and represent meaningful entities for that encoder only<br \/>\n&nbsp;&nbsp; (e.g., an uncompressed stream may use video frames as packets).&nbsp; They<br \/>\n&nbsp;&nbsp; do not contain boundary information - strung together they appear to<br \/>\n&nbsp;&nbsp; be streams of random bytes with no landmarks.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>Pfeiffer&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Informational&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [Page 2]<\/p>\n<p>RFC 3533&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OGG&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; May 2003<\/p>\n<p>\n&nbsp;&nbsp; Please note that the term \"packet\" is not used in this document to<br \/>\n&nbsp;&nbsp; signify entities for transport over a network.<\/p>\n<p>3. Requirements for a generic encapsulation format<\/p>\n<p>&nbsp;&nbsp; The design idea behind Ogg was to provide a generic, linear media<br \/>\n&nbsp;&nbsp; transport format to enable both file-based storage and stream-based<br \/>\n&nbsp;&nbsp; transmission of one or several interleaved media streams independent<br \/>\n&nbsp;&nbsp; of the encoding format of the media data.&nbsp; Such an encapsulation<br \/>\n&nbsp;&nbsp; format needs to provide:<\/p>\n<p>&nbsp;&nbsp; o&nbsp; framing for logical bitstreams.<\/p>\n<p>&nbsp;&nbsp; o&nbsp; interleaving of different logical bitstreams.<\/p>\n<p>&nbsp;&nbsp; o&nbsp; detection of corruption.<\/p>\n<p>&nbsp;&nbsp; o&nbsp; recapture after a parsing error.<\/p>\n<p>&nbsp;&nbsp; o&nbsp; position landmarks for direct random access of arbitrary positions<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; in the bitstream.<\/p>\n<p>&nbsp;&nbsp; o&nbsp; streaming capability (i.e., no seeking is needed to build a 100%<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; complete bitstream).<\/p>\n<p>&nbsp;&nbsp; o&nbsp; small overhead (i.e., use no more than approximately 1-2% of<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bitstream bandwidth for packet boundary marking, high-level<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; framing, sync and seeking).<\/p>\n<p>&nbsp;&nbsp; o&nbsp; simplicity to enable fast parsing.<\/p>\n<p>&nbsp;&nbsp; o&nbsp; simple concatenation mechanism of several physical bitstreams.<\/p>\n<p>&nbsp;&nbsp; All of these design considerations have been taken into consideration<br \/>\n&nbsp;&nbsp; for Ogg.&nbsp; Ogg supports framing and interleaving of logical<br \/>\n&nbsp;&nbsp; bitstreams, seeking landmarks, detection of corruption, and stream<br \/>\n&nbsp;&nbsp; resynchronisation after a parsing error with no more than<br \/>\n&nbsp;&nbsp; approximately 1-2% overhead.&nbsp; It is a generic framework to perform<br \/>\n&nbsp;&nbsp; encapsulation of time-continuous bitstreams.&nbsp; It does not know any<br \/>\n&nbsp;&nbsp; specifics about the codec data that it encapsulates and is thus<br \/>\n&nbsp;&nbsp; independent of any media codec.<\/p>\n<p>4. The Ogg bitstream format<\/p>\n<p>&nbsp;&nbsp; A physical Ogg bitstream consists of multiple logical bitstreams<br \/>\n&nbsp;&nbsp; interleaved in so-called \"Pages\".&nbsp; Whole pages are taken in order<br \/>\n&nbsp;&nbsp; from multiple logical bitstreams multiplexed at the page level.&nbsp; The<br \/>\n&nbsp;&nbsp; logical bitstreams are identified by a unique serial number in the<\/p>\n<p>&nbsp;<\/p>\n<p>Pfeiffer&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Informational&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [Page 3]<\/p>\n<p>RFC 3533&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OGG&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; May 2003<\/p>\n<p>\n&nbsp;&nbsp; header of each page of the physical bitstream.&nbsp; This unique serial<br \/>\n&nbsp;&nbsp; number is created randomly and does not have any connection to the<br \/>\n&nbsp;&nbsp; content or encoder of the logical bitstream it represents.&nbsp; Pages of<br \/>\n&nbsp;&nbsp; all logical bitstreams are concurrently interleaved, but they need<br \/>\n&nbsp;&nbsp; not be in a regular order - they are only required to be consecutive<br \/>\n&nbsp;&nbsp; within the logical bitstream.&nbsp; Ogg demultiplexing reconstructs the<br \/>\n&nbsp;&nbsp; original logical bitstreams from the physical bitstream by taking the<br \/>\n&nbsp;&nbsp; pages in order from the physical bitstream and redirecting them into<br \/>\n&nbsp;&nbsp; the appropriate logical decoding entity.<\/p>\n<p>&nbsp;&nbsp; Each Ogg page contains only one type of data as it belongs to one<br \/>\n&nbsp;&nbsp; logical bitstream only.&nbsp; Pages are of variable size and have a page<br \/>\n&nbsp;&nbsp; header containing encapsulation and error recovery information.&nbsp; Each<br \/>\n&nbsp;&nbsp; logical bitstream in a physical Ogg bitstream starts with a special<br \/>\n&nbsp;&nbsp; start page (bos=beginning of stream) and ends with a special page<br \/>\n&nbsp;&nbsp; (eos=end of stream).<\/p>\n<p>&nbsp;&nbsp; The bos page contains information to uniquely identify the codec type<br \/>\n&nbsp;&nbsp; and MAY contain information to set up the decoding process.&nbsp; The bos<br \/>\n&nbsp;&nbsp; page SHOULD also contain information about the encoded media - for<br \/>\n&nbsp;&nbsp; example, for audio, it should contain the sample rate and number of<br \/>\n&nbsp;&nbsp; channels.&nbsp; By convention, the first bytes of the bos page contain<br \/>\n&nbsp;&nbsp; magic data that uniquely identifies the required codec.&nbsp; It is the<br \/>\n&nbsp;&nbsp; responsibility of anyone fielding a new codec to make sure it is<br \/>\n&nbsp;&nbsp; possible to reliably distinguish his\/her codec from all other codecs<br \/>\n&nbsp;&nbsp; in use.&nbsp; There is no fixed way to detect the end of the codec-<br \/>\n&nbsp;&nbsp; identifying marker.&nbsp; The format of the bos page is dependent on the<br \/>\n&nbsp;&nbsp; codec and therefore MUST be given in the encapsulation specification<br \/>\n&nbsp;&nbsp; of that logical bitstream type.&nbsp; Ogg also allows but does not require<br \/>\n&nbsp;&nbsp; secondary header packets after the bos page for logical bitstreams<br \/>\n&nbsp;&nbsp; and these must also precede any data packets in any logical<br \/>\n&nbsp;&nbsp; bitstream.&nbsp; These subsequent header packets are framed into an<br \/>\n&nbsp;&nbsp; integral number of pages, which will not contain any data packets.<br \/>\n&nbsp;&nbsp; So, a physical bitstream begins with the bos pages of all logical<br \/>\n&nbsp;&nbsp; bitstreams containing one initial header packet per page, followed by<br \/>\n&nbsp;&nbsp; the subsidiary header packets of all streams, followed by pages<br \/>\n&nbsp;&nbsp; containing data packets.<\/p>\n<p>&nbsp;&nbsp; The encapsulation specification for one or more logical bitstreams is<br \/>\n&nbsp;&nbsp; called a \"media mapping\".&nbsp; An example for a media mapping is \"Ogg<br \/>\n&nbsp;&nbsp; Vorbis\", which uses the Ogg framework to encapsulate Vorbis-encoded<br \/>\n&nbsp;&nbsp; audio data for stream-based storage (such as files) and transport<br \/>\n&nbsp;&nbsp; (such as TCP streams or pipes).&nbsp; Ogg Vorbis provides the name and<br \/>\n&nbsp;&nbsp; revision of the Vorbis codec, the audio rate and the audio quality on<br \/>\n&nbsp;&nbsp; the Ogg Vorbis bos page.&nbsp; It also uses two additional header pages<br \/>\n&nbsp;&nbsp; per logical bitstream.&nbsp; The Ogg Vorbis bos page starts with the byte<br \/>\n&nbsp;&nbsp; 0x01, followed by \"vorbis\" (a total of 7 bytes of identifier).<\/p>\n<p>&nbsp;<\/p>\n<p>\nPfeiffer&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Informational&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [Page 4]<\/p>\n<p>RFC 3533&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OGG&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; May 2003<\/p>\n<p>\n&nbsp;&nbsp; Ogg knows two types of multiplexing: concurrent multiplexing (so-<br \/>\n&nbsp;&nbsp; called \"Grouping\") and sequential multiplexing (so-called<br \/>\n&nbsp;&nbsp; \"Chaining\").&nbsp; Grouping defines how to interleave several logical<br \/>\n&nbsp;&nbsp; bitstreams page-wise in the same physical bitstream.&nbsp; Grouping is for<br \/>\n&nbsp;&nbsp; example needed for interleaving a video stream with several<br \/>\n&nbsp;&nbsp; synchronised audio tracks using different codecs in different logical<br \/>\n&nbsp;&nbsp; bitstreams.&nbsp; Chaining on the other hand, is defined to provide a<br \/>\n&nbsp;&nbsp; simple mechanism to concatenate physical Ogg bitstreams, as is often<br \/>\n&nbsp;&nbsp; needed for streaming applications.<\/p>\n<p>&nbsp;&nbsp; In grouping, all bos pages of all logical bitstreams MUST appear<br \/>\n&nbsp;&nbsp; together at the beginning of the Ogg bitstream.&nbsp; The media mapping<br \/>\n&nbsp;&nbsp; specifies the order of the initial pages.&nbsp; For example, the grouping<br \/>\n&nbsp;&nbsp; of a specific Ogg video and Ogg audio bitstream may specify that the<br \/>\n&nbsp;&nbsp; physical bitstream MUST begin with the bos page of the logical video<br \/>\n&nbsp;&nbsp; bitstream, followed by the bos page of the audio bitstream.&nbsp; Unlike<br \/>\n&nbsp;&nbsp; bos pages, eos pages for the logical bitstreams need not all occur<br \/>\n&nbsp;&nbsp; contiguously.&nbsp; Eos pages may be 'nil' pages, that is, pages<br \/>\n&nbsp;&nbsp; containing no content but simply a page header with position<br \/>\n&nbsp;&nbsp; information and the eos flag set in the page header.&nbsp; Each grouped<br \/>\n&nbsp;&nbsp; logical bitstream MUST have a unique serial number within the scope<br \/>\n&nbsp;&nbsp; of the physical bitstream.<\/p>\n<p>&nbsp;&nbsp; In chaining, complete logical bitstreams are concatenated.&nbsp; The<br \/>\n&nbsp;&nbsp; bitstreams do not overlap, i.e., the eos page of a given logical<br \/>\n&nbsp;&nbsp; bitstream is immediately followed by the bos page of the next.&nbsp; Each<br \/>\n&nbsp;&nbsp; chained logical bitstream MUST have a unique serial number within the<br \/>\n&nbsp;&nbsp; scope of the physical bitstream.<\/p>\n<p>&nbsp;&nbsp; It is possible to consecutively chain groups of concurrently<br \/>\n&nbsp;&nbsp; multiplexed bitstreams.&nbsp; The groups, when unchained, MUST stand on<br \/>\n&nbsp;&nbsp; their own as a valid concurrently multiplexed bitstream.&nbsp; The<br \/>\n&nbsp;&nbsp; following diagram shows a schematic example of such a physical<br \/>\n&nbsp;&nbsp; bitstream that obeys all the rules of both grouped and chained<br \/>\n&nbsp;&nbsp; multiplexed bitstreams.<\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; physical bitstream with pages of<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; different logical bitstreams grouped and chained<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -------------------------------------------------------------<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |*A*|*B*|*C*|A|A|C|B|A|B|#A#|C|...|B|C|#B#|#C#|*D*|D|...|#D#|<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -------------------------------------------------------------<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bos bos bos&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; eos&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; eos eos bos&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; eos<\/p>\n<p>&nbsp;&nbsp; In this example, there are two chained physical bitstreams, the first<br \/>\n&nbsp;&nbsp; of which is a grouped stream of three logical bitstreams A, B, and C.<br \/>\n&nbsp;&nbsp; The second physical bitstream is chained after the end of the grouped<br \/>\n&nbsp;&nbsp; bitstream, which ends after the last eos page of all its grouped<br \/>\n&nbsp;&nbsp; logical bitstreams.&nbsp; As can be seen, grouped bitstreams begin<\/p>\n<p>&nbsp;<\/p>\n<p>Pfeiffer&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Informational&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [Page 5]<\/p>\n<p>RFC 3533&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OGG&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; May 2003<\/p>\n<p>\n&nbsp;&nbsp; together - all of the bos pages MUST appear before any data pages.<br \/>\n&nbsp;&nbsp; It can also be seen that pages of concurrently multiplexed bitstreams<br \/>\n&nbsp;&nbsp; need not conform to a regular order.&nbsp; And it can be seen that a<br \/>\n&nbsp;&nbsp; grouped bitstream can end long before the other bitstreams in the<br \/>\n&nbsp;&nbsp; group end.<\/p>\n<p>&nbsp;&nbsp; Ogg does not know any specifics about the codec data except that each<br \/>\n&nbsp;&nbsp; logical bitstream belongs to a different codec, the data from the<br \/>\n&nbsp;&nbsp; codec comes in order and has position markers (so-called \"Granule<br \/>\n&nbsp;&nbsp; positions\").&nbsp; Ogg does not have a concept of 'time': it only knows<br \/>\n&nbsp;&nbsp; about sequentially increasing, unitless position markers.&nbsp; An<br \/>\n&nbsp;&nbsp; application can only get temporal information through higher layers<br \/>\n&nbsp;&nbsp; which have access to the codec APIs to assign and convert granule<br \/>\n&nbsp;&nbsp; positions or time.<\/p>\n<p>&nbsp;&nbsp; A specific definition of a media mapping using Ogg may put further<br \/>\n&nbsp;&nbsp; constraints on its specific use of the Ogg bitstream format.&nbsp; For<br \/>\n&nbsp;&nbsp; example, a specific media mapping may require that all the eos pages<br \/>\n&nbsp;&nbsp; for all grouped bitstreams need to appear in direct sequence.&nbsp; An<br \/>\n&nbsp;&nbsp; example for a media mapping is the specification of \"Ogg Vorbis\".<br \/>\n&nbsp;&nbsp; Another example is the upcoming \"Ogg Theora\" specification which<br \/>\n&nbsp;&nbsp; encapsulates Theora-encoded video data and usually comes multiplexed<br \/>\n&nbsp;&nbsp; with a Vorbis stream for an Ogg containing synchronised audio and<br \/>\n&nbsp;&nbsp; video.&nbsp; As Ogg does not specify temporal relationships between the<br \/>\n&nbsp;&nbsp; encapsulated concurrently multiplexed bitstreams, the temporal<br \/>\n&nbsp;&nbsp; synchronisation between the audio and video stream will be specified<br \/>\n&nbsp;&nbsp; in this media mapping.&nbsp; To enable streaming, pages from various<br \/>\n&nbsp;&nbsp; logical bitstreams will typically be interleaved in chronological<br \/>\n&nbsp;&nbsp; order.<\/p>\n<p>5. The encapsulation process<\/p>\n<p>&nbsp;&nbsp; The process of multiplexing different logical bitstreams happens at<br \/>\n&nbsp;&nbsp; the level of pages as described above.&nbsp; The bitstreams provided by<br \/>\n&nbsp;&nbsp; encoders are however handed over to Ogg as so-called \"Packets\" with<br \/>\n&nbsp;&nbsp; packet boundaries dependent on the encoding format.&nbsp; The process of<br \/>\n&nbsp;&nbsp; encapsulating packets into pages will be described now.<\/p>\n<p>&nbsp;&nbsp; From Ogg's perspective, packets can be of any arbitrary size.&nbsp; A<br \/>\n&nbsp;&nbsp; specific media mapping will define how to group or break up packets<br \/>\n&nbsp;&nbsp; from a specific media encoder.&nbsp; As Ogg pages have a maximum size of<br \/>\n&nbsp;&nbsp; about 64 kBytes, sometimes a packet has to be distributed over<br \/>\n&nbsp;&nbsp; several pages.&nbsp; To simplify that process, Ogg divides each packet<br \/>\n&nbsp;&nbsp; into 255 byte long chunks plus a final shorter chunk.&nbsp; These chunks<br \/>\n&nbsp;&nbsp; are called \"Ogg Segments\".&nbsp; They are only a logical construct and do<br \/>\n&nbsp;&nbsp; not have a header for themselves.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>Pfeiffer&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Informational&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [Page 6]<\/p>\n<p>RFC 3533&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OGG&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; May 2003<\/p>\n<p>\n&nbsp;&nbsp; A group of contiguous segments is wrapped into a variable length page<br \/>\n&nbsp;&nbsp; preceded by a header.&nbsp; A segment table in the page header tells about<br \/>\n&nbsp;&nbsp; the \"Lacing values\" (sizes) of the segments included in the page.&nbsp; A<br \/>\n&nbsp;&nbsp; flag in the page header tells whether a page contains a packet<br \/>\n&nbsp;&nbsp; continued from a previous page.&nbsp; Note that a lacing value of 255<br \/>\n&nbsp;&nbsp; implies that a second lacing value follows in the packet, and a value<br \/>\n&nbsp;&nbsp; of less than 255 marks the end of the packet after that many<br \/>\n&nbsp;&nbsp; additional bytes.&nbsp; A packet of 255 bytes (or a multiple of 255 bytes)<br \/>\n&nbsp;&nbsp; is terminated by a lacing value of 0.&nbsp; Note also that a 'nil' (zero<br \/>\n&nbsp;&nbsp; length) packet is not an error; it consists of nothing more than a<br \/>\n&nbsp;&nbsp; lacing value of zero in the header.<\/p>\n<p>&nbsp;&nbsp; The encoding is optimized for speed and the expected case of the<br \/>\n&nbsp;&nbsp; majority of packets being between 50 and 200 bytes large.&nbsp; This is a<br \/>\n&nbsp;&nbsp; design justification rather than a recommendation.&nbsp; This encoding<br \/>\n&nbsp;&nbsp; both avoids imposing a maximum packet size as well as imposing<br \/>\n&nbsp;&nbsp; minimum overhead on small packets.&nbsp; In contrast, e.g., simply using<br \/>\n&nbsp;&nbsp; two bytes at the head of every packet and having a max packet size of<br \/>\n&nbsp;&nbsp; 32 kBytes would always penalize small packets (&lt; 255 bytes, the<br \/>\n&nbsp;&nbsp; typical case) with twice the segmentation overhead.&nbsp; Using the lacing<br \/>\n&nbsp;&nbsp; values as suggested, small packets see the minimum possible byte-<br \/>\n&nbsp;&nbsp; aligned overhead (1 byte) and large packets (&gt;512 bytes) see a fairly<br \/>\n&nbsp;&nbsp; constant ~0.5% overhead on encoding space.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>\nPfeiffer&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Informational&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [Page 7]<\/p>\n<p>RFC 3533&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OGG&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; May 2003<\/p>\n<p>\n&nbsp;&nbsp; The following diagram shows a schematic example of a media mapping<br \/>\n&nbsp;&nbsp; using Ogg and grouped logical bitstreams:<\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; logical bitstream with packet boundaries<br \/>\n&nbsp;-----------------------------------------------------------------<br \/>\n&nbsp;&gt; |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; packet_1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | packet_2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | packet_3 |&nbsp; &lt;<br \/>\n&nbsp;-----------------------------------------------------------------<\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |segmentation (logically only)<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; v<\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; packet_1 (5 segments)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; packet_2 (4 segs)&nbsp;&nbsp;&nbsp; p_3 (2 segs)<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; ------------------------------ -------------------- ------------<br \/>\n&nbsp;..&nbsp; |seg_1|seg_2|seg_3|seg_4|s_5 | |seg_1|seg_2|seg_3|| |seg_1|s_2 | ..<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; ------------------------------ -------------------- ------------<\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | page encapsulation<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; v<\/p>\n<p>&nbsp;page_1 (packet_1 data)&nbsp;&nbsp; page_2 (pket_1 data)&nbsp;&nbsp; page_3 (packet_2 data)<br \/>\n------------------------&nbsp; ----------------&nbsp; ------------------------<br \/>\n|H|------------------- |&nbsp; |H|----------- |&nbsp; |H|------------------- |<br \/>\n|D||seg_1|seg_2|seg_3| |&nbsp; |D|seg_4|s_5 | |&nbsp; |D||seg_1|seg_2|seg_3| | ...<br \/>\n|R|------------------- |&nbsp; |R|----------- |&nbsp; |R|------------------- |<br \/>\n------------------------&nbsp; ----------------&nbsp; ------------------------<\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |<br \/>\npages of&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |<br \/>\nother&nbsp;&nbsp;&nbsp; --------|&nbsp; |<br \/>\nlogical&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -------<br \/>\nbitstreams&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | MUX |<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -------<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; v<\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; page_1&nbsp; page_2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; page_3<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ------&nbsp; ------&nbsp; -------&nbsp; -----&nbsp; -------<br \/>\n&nbsp;...&nbsp; ||&nbsp;&nbsp; |&nbsp; ||&nbsp;&nbsp; |&nbsp; ||&nbsp;&nbsp;&nbsp; |&nbsp; ||&nbsp; |&nbsp; ||&nbsp;&nbsp;&nbsp; |&nbsp; ...<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ------&nbsp; ------&nbsp; -------&nbsp; -----&nbsp; -------<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; physical Ogg bitstream<\/p>\n<p>&nbsp;&nbsp; In this example we take a snapshot of the encapsulation process of<br \/>\n&nbsp;&nbsp; one logical bitstream.&nbsp; We can see part of that bitstream's<br \/>\n&nbsp;&nbsp; subdivision into packets as provided by the codec.&nbsp; The Ogg<br \/>\n&nbsp;&nbsp; encapsulation process chops up the packets into segments.&nbsp; The<br \/>\n&nbsp;&nbsp; packets in this example are rather large such that packet_1 is split<br \/>\n&nbsp;&nbsp; into 5 segments - 4 segments with 255 bytes and a final smaller one.<br \/>\n&nbsp;&nbsp; Packet_2 is split into 4 segments - 3 segments with 255 bytes and a<\/p>\n<p>&nbsp;<\/p>\n<p>Pfeiffer&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Informational&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [Page 8]<\/p>\n<p>RFC 3533&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OGG&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; May 2003<\/p>\n<p>\n&nbsp;&nbsp; final very small one - and packet_3 is split into two segments.&nbsp; The<br \/>\n&nbsp;&nbsp; encapsulation process then creates pages, which are quite small in<br \/>\n&nbsp;&nbsp; this example.&nbsp; Page_1 consists of the first three segments of<br \/>\n&nbsp;&nbsp; packet_1, page_2 contains the remaining 2 segments from packet_1, and<br \/>\n&nbsp;&nbsp; page_3 contains the first three pages of packet_2.&nbsp; Finally, this<br \/>\n&nbsp;&nbsp; logical bitstream is multiplexed into a physical Ogg bitstream with<br \/>\n&nbsp;&nbsp; pages of other logical bitstreams.<\/p>\n<p>6. The Ogg page format<\/p>\n<p>&nbsp;&nbsp; A physical Ogg bitstream consists of a sequence of concatenated<br \/>\n&nbsp;&nbsp; pages.&nbsp; Pages are of variable size, usually 4-8 kB, maximum 65307<br \/>\n&nbsp;&nbsp; bytes.&nbsp; A page header contains all the information needed to<br \/>\n&nbsp;&nbsp; demultiplex the logical bitstreams out of the physical bitstream and<br \/>\n&nbsp;&nbsp; to perform basic error recovery and landmarks for seeking.&nbsp; Each page<br \/>\n&nbsp;&nbsp; is a self-contained entity such that the page decode mechanism can<br \/>\n&nbsp;&nbsp; recognize, verify, and handle single pages at a time without<br \/>\n&nbsp;&nbsp; requiring the overall bitstream.<\/p>\n<p>&nbsp;&nbsp; The Ogg page header has the following format:<\/p>\n<p>&nbsp;0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3<br \/>\n&nbsp;0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1| Byte<br \/>\n+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+<br \/>\n| capture_pattern: Magic number for page start \"OggS\"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | 0-3<br \/>\n+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+<br \/>\n| version&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | header_type&nbsp;&nbsp; | granule_position&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | 4-7<br \/>\n+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+<br \/>\n|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | 8-11<br \/>\n+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+<br \/>\n|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | bitstream_serial_number&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | 12-15<br \/>\n+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+<br \/>\n|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | page_sequence_number&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | 16-19<br \/>\n+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+<br \/>\n|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | CRC_checksum&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | 20-23<br \/>\n+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+<br \/>\n|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |page_segments&nbsp; | segment_table | 24-27<br \/>\n+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+<br \/>\n| ...&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | 28-<br \/>\n+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+<\/p>\n<p>&nbsp;&nbsp; The LSb (least significant bit) comes first in the Bytes.&nbsp; Fields<br \/>\n&nbsp;&nbsp; with more than one byte length are encoded LSB (least significant<br \/>\n&nbsp;&nbsp; byte) first.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>Pfeiffer&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Informational&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [Page 9]<\/p>\n<p>RFC 3533&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OGG&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; May 2003<\/p>\n<p>\n&nbsp;&nbsp; The fields in the page header have the following meaning:<\/p>\n<p>&nbsp;&nbsp; 1. capture_pattern: a 4 Byte field that signifies the beginning of a<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; page.&nbsp; It contains the magic numbers:<\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0x4f 'O'<\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0x67 'g'<\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0x67 'g'<\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0x53 'S'<\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; It helps a decoder to find the page boundaries and regain<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; synchronisation after parsing a corrupted stream.&nbsp; Once the<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; capture pattern is found, the decoder verifies page sync and<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; integrity by computing and comparing the checksum.<\/p>\n<p>&nbsp;&nbsp; 2. stream_structure_version: 1 Byte signifying the version number of<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; the Ogg file format used in this stream (this document specifies<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; version 0).<\/p>\n<p>&nbsp;&nbsp; 3. header_type_flag: the bits in this 1 Byte field identify the<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; specific type of this page.<\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *&nbsp; bit 0x01<\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; set: page contains data of a packet continued from the previous<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; page<\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; unset: page contains a fresh packet<\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *&nbsp; bit 0x02<\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; set: this is the first page of a logical bitstream (bos)<\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; unset: this page is not a first page<\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *&nbsp; bit 0x04<\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; set: this is the last page of a logical bitstream (eos)<\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; unset: this page is not a last page<\/p>\n<p>&nbsp;&nbsp; 4. granule_position: an 8 Byte field containing position information.<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; For example, for an audio stream, it MAY contain the total number<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; of PCM samples encoded after including all frames finished on this<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; page.&nbsp; For a video stream it MAY contain the total number of video<\/p>\n<p>&nbsp;<\/p>\n<p>Pfeiffer&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Informational&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [Page 10]<\/p>\n<p>RFC 3533&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OGG&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; May 2003<\/p>\n<p>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; frames encoded after this page.&nbsp; This is a hint for the decoder<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; and gives it some timing and position information.&nbsp; Its meaning is<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dependent on the codec for that logical bitstream and specified in<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; a specific media mapping.&nbsp; A special value of -1 (in two's<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; complement) indicates that no packets finish on this page.<\/p>\n<p>&nbsp;&nbsp; 5. bitstream_serial_number: a 4 Byte field containing the unique<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; serial number by which the logical bitstream is identified.<\/p>\n<p>&nbsp;&nbsp; 6. page_sequence_number: a 4 Byte field containing the sequence<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; number of the page so the decoder can identify page loss.&nbsp; This<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sequence number is increasing on each logical bitstream<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; separately.<\/p>\n<p>&nbsp;&nbsp; 7. CRC_checksum: a 4 Byte field containing a 32 bit CRC checksum of<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; the page (including header with zero CRC field and page content).<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The generator polynomial is 0x04c11db7.<\/p>\n<p>&nbsp;&nbsp; 8. number_page_segments: 1 Byte giving the number of segment entries<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; encoded in the segment table.<\/p>\n<p>&nbsp;&nbsp; 9. segment_table: number_page_segments Bytes containing the lacing<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; values of all segments in this page.&nbsp; Each Byte contains one<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lacing value.<\/p>\n<p>&nbsp;&nbsp; The total header size in bytes is given by:<br \/>\n&nbsp;&nbsp; header_size = number_page_segments + 27 [Byte]<\/p>\n<p>&nbsp;&nbsp; The total page size in Bytes is given by:<br \/>\n&nbsp;&nbsp; page_size = header_size + sum(lacing_values: 1..number_page_segments)<br \/>\n&nbsp;&nbsp; [Byte]<\/p>\n<p>7. Security Considerations<\/p>\n<p>&nbsp;&nbsp; The Ogg encapsulation format is a container format and only<br \/>\n&nbsp;&nbsp; encapsulates content (such as Vorbis-encoded audio).&nbsp; It does not<br \/>\n&nbsp;&nbsp; provide for any generic encryption or signing of itself or its<br \/>\n&nbsp;&nbsp; contained content bitstreams.&nbsp; However, it encapsulates any kind of<br \/>\n&nbsp;&nbsp; content bitstream as long as there is a codec for it, and is thus<br \/>\n&nbsp;&nbsp; able to contain encrypted and signed content data.&nbsp; It is also<br \/>\n&nbsp;&nbsp; possible to add an external security mechanism that encrypts or signs<br \/>\n&nbsp;&nbsp; an Ogg physical bitstream and thus provides content confidentiality<br \/>\n&nbsp;&nbsp; and authenticity.<\/p>\n<p>&nbsp;&nbsp; As Ogg encapsulates binary data, it is possible to include executable<br \/>\n&nbsp;&nbsp; content in an Ogg bitstream.&nbsp; This can be an issue with applications<br \/>\n&nbsp;&nbsp; that are implemented using the Ogg format, especially when Ogg is<br \/>\n&nbsp;&nbsp; used for streaming or file transfer in a networking scenario.&nbsp; As<\/p>\n<p>&nbsp;<\/p>\n<p>Pfeiffer&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Informational&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [Page 11]<\/p>\n<p>RFC 3533&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OGG&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; May 2003<\/p>\n<p>\n&nbsp;&nbsp; such, Ogg does not pose a threat there.&nbsp; However, an application<br \/>\n&nbsp;&nbsp; decoding Ogg and its encapsulated content bitstreams has to ensure<br \/>\n&nbsp;&nbsp; correct handling of manipulated bitstreams, of buffer overflows and<br \/>\n&nbsp;&nbsp; the like.<\/p>\n<p>8. References<\/p>\n<p>&nbsp;&nbsp; [1] Walleij, L., \"The application\/ogg Media Type\", RFC 3534, May<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2003.<\/p>\n<p>&nbsp;&nbsp; [2] Bradner, S., \"Key words for use in RFCs to Indicate Requirement<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Levels\", BCP 14, RFC 2119, March 1997.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>Pfeiffer&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Informational&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [Page 12]<\/p>\n<p>RFC 3533&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OGG&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; May 2003<\/p>\n<p>\nAppendix A. Glossary of terms and abbreviations<\/p>\n<p>&nbsp;&nbsp; bos page: The initial page (beginning of stream) of a logical<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bitstream which contains information to identify the codec type<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; and other decoding-relevant information.<\/p>\n<p>&nbsp;&nbsp; chaining (or sequential multiplexing): Concatenation of two or more<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; complete physical Ogg bitstreams.<\/p>\n<p>&nbsp;&nbsp; eos page: The final page (end of stream) of a logical bitstream.<\/p>\n<p>&nbsp;&nbsp; granule position: An increasing position number for a specific<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; logical bitstream stored in the page header.&nbsp; Its meaning is<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dependent on the codec for that logical bitstream and specified in<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; a specific media mapping.<\/p>\n<p>&nbsp;&nbsp; grouping (or concurrent multiplexing): Interleaving of pages of<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; several logical bitstreams into one complete physical Ogg<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bitstream under the restriction that all bos pages of all grouped<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; logical bitstreams MUST appear before any data pages.<\/p>\n<p>&nbsp;&nbsp; lacing value: An entry in the segment table of a page header<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; representing the size of the related segment.<\/p>\n<p>&nbsp;&nbsp; logical bitstream: A sequence of bits being the result of an encoded<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; media stream.<\/p>\n<p>&nbsp;&nbsp; media mapping: A specific use of the Ogg encapsulation format<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; together with a specific (set of) codec(s).<\/p>\n<p>&nbsp;&nbsp; (Ogg) packet: A subpart of a logical bitstream that is created by the<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; encoder for that bitstream and represents a meaningful entity for<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; the encoder, but only a sequence of bits to the Ogg encapsulation.<\/p>\n<p>&nbsp;&nbsp; (Ogg) page: A physical bitstream consists of a sequence of Ogg pages<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; containing data of one logical bitstream only.&nbsp; It usually<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; contains a group of contiguous segments of one packet only, but<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sometimes packets are too large and need to be split over several<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pages.<\/p>\n<p>&nbsp;&nbsp; physical (Ogg) bitstream: The sequence of bits resulting from an Ogg<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; encapsulation of one or several logical bitstreams.&nbsp; It consists<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; of a sequence of pages from the logical bitstreams with the<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; restriction that the pages of one logical bitstream MUST come in<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; their correct temporal order.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>\nPfeiffer&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Informational&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [Page 13]<\/p>\n<p>RFC 3533&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OGG&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; May 2003<\/p>\n<p>\n&nbsp;&nbsp; (Ogg) segment: The Ogg encapsulation process splits each packet into<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; chunks of 255 bytes plus a last fractional chunk of less than 255<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bytes.&nbsp; These chunks are called segments.<\/p>\n<p>Appendix B. Acknowledgements<\/p>\n<p>&nbsp;&nbsp; The author gratefully acknowledges the work that Christopher<br \/>\n&nbsp;&nbsp; Montgomery&nbsp; and the Xiph.Org foundation have done in defining the Ogg<br \/>\n&nbsp;&nbsp; multimedia project and as part of it the open file format described<br \/>\n&nbsp;&nbsp; in this document.&nbsp; The author hopes that providing this document to<br \/>\n&nbsp;&nbsp; the Internet community will help in promoting the Ogg multimedia<br \/>\n&nbsp;&nbsp; project at <a href=\"http:\/\/www.xiph.org\/\">http:\/\/www.xiph.org\/<\/a>.&nbsp; Many thanks also for the many<br \/>\n&nbsp;&nbsp; technical and typo corrections that C. Montgomery and the Ogg<br \/>\n&nbsp;&nbsp; community provided as feedback to this RFC.<\/p>\n<p>Author's Address<\/p>\n<p>&nbsp;&nbsp; Silvia Pfeiffer<br \/>\n&nbsp;&nbsp; CSIRO, Australia<br \/>\n&nbsp;&nbsp; Locked Bag 17<br \/>\n&nbsp;&nbsp; North Ryde, NSW&nbsp; 2113<br \/>\n&nbsp;&nbsp; Australia<\/p>\n<p>&nbsp;&nbsp; Phone: +61 2 9325 3141<br \/>\n&nbsp;&nbsp; EMail: <a href=\"mailto:Silvia.Pfeiffer@csiro.au\">Silvia.Pfeiffer@csiro.au<\/a><br \/>\n&nbsp;&nbsp; URI:&nbsp;&nbsp; <a href=\"http:\/\/www.cmis.csiro.au\/Silvia.Pfeiffer\/\">http:\/\/www.cmis.csiro.au\/Silvia.Pfeiffer\/<\/a><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>Pfeiffer&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Informational&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [Page 14]<\/p>\n<p>RFC 3533&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OGG&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; May 2003<\/p>\n<p>\nFull Copyright Statement<\/p>\n<p>&nbsp;&nbsp; Copyright (C) The Internet Society (2003).&nbsp; All Rights Reserved.<\/p>\n<p>&nbsp;&nbsp; This document and translations of it may be copied and furnished to<br \/>\n&nbsp;&nbsp; others, and derivative works that comment on or otherwise explain it<br \/>\n&nbsp;&nbsp; or assist in its implementation may be prepared, copied, published<br \/>\n&nbsp;&nbsp; and distributed, in whole or in part, without restriction of any<br \/>\n&nbsp;&nbsp; kind, provided that the above copyright notice and this paragraph are<br \/>\n&nbsp;&nbsp; included on all such copies and derivative works.&nbsp; However, this<br \/>\n&nbsp;&nbsp; document itself may not be modified in any way, such as by removing<br \/>\n&nbsp;&nbsp; the copyright notice or references to the Internet Society or other<br \/>\n&nbsp;&nbsp; Internet organizations, except as needed for the purpose of<br \/>\n&nbsp;&nbsp; developing Internet standards in which case the procedures for<br \/>\n&nbsp;&nbsp; copyrights defined in the Internet Standards process must be<br \/>\n&nbsp;&nbsp; followed, or as required to translate it into languages other than<br \/>\n&nbsp;&nbsp; English.<\/p>\n<p>&nbsp;&nbsp; The limited permissions granted above are perpetual and will not be<br \/>\n&nbsp;&nbsp; revoked by the Internet Society or its successors or assigns.<\/p>\n<p>&nbsp;&nbsp; This document and the information contained herein is provided on an<br \/>\n&nbsp;&nbsp; \"AS IS\" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING<br \/>\n&nbsp;&nbsp; TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING<br \/>\n&nbsp;&nbsp; BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION<br \/>\n&nbsp;&nbsp; HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF<br \/>\n&nbsp;&nbsp; MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.<\/p>\n<p>Acknowledgement<\/p>\n<p>&nbsp;&nbsp; Funding for the RFC Editor function is currently provided by the<br \/>\n&nbsp;&nbsp; Internet Society.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>Pfeiffer&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Informational&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [Page 15]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#038; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[27],"class_list":["post-15","post","type-post","status-publish","format-standard","hentry","category-Technical_literature","tag-ogg"],"views":1296,"_links":{"self":[{"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/posts\/15","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/comments?post=15"}],"version-history":[{"count":0,"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/posts\/15\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/media?parent=15"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/categories?post=15"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/tags?post=15"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}