Raw packets may be used directly by transport mechanisms that provide their own framing and packet-separation mechanisms (such as UDP datagrams). For stream based storage (such as files) and transport (such as TCP streams or pipes), Vorbis and other future Ogg codecs use the Ogg bitstream format to provide framing/sync, sync recapture after error, landmarks during seeking, and enough information to properly separate data back into packets at the original packet boundaries without relying on decoding to find packet boundaries.
Multiple logical bitstreams can be combined (with restrictions) into a single physical bitstream. A physical bitstream consists of multiple logical bitstreams multiplexed at the page level and may include a 'meta-header' at the beginning of the multiplexed logical stream that serves as identification magic. Whole pages are taken in order from multiple logical bitstreams and combined into a single physical stream of pages. The decoder reconstructs the original logical bitstreams from the physical bitstream by taking the pages in order from the physical bitstream and redirecting them into the appropriate logical decoding entity. The simplest physical bitstream is a single, unmultiplexed logical bitstream with no meta-header; this is referred to as a 'degenerate stream'.
Ogg Logical Bitstream Framing discusses the page format of an Ogg bitstream, the packet coding process and logical bitstreams in detail. The remainder of this document specifies requirements for constructing finished, physical Ogg bitstreams.
In addition to the header flag marking the first and last pages of a logical bitstream, the first page of an Ogg bitstream obeys additional restrictions. Each individual media mapping specifies its own implementation details regarding these restrictions.
The first page of a logical Ogg bitstream consists of a single, small 'initial header' packet that includes sufficient information to identify the exact CODEC type and media requirements of the logical bitstream. The intent of this restriction is to simplify identifying the bitstream type and content; for a given media type (or across all Ogg media types) we can know that we only need a small, fixed amount of data to uniquely identify the bitstream type.
As an example, Ogg Vorbis places the name and revision of the Vorbis CODEC, the audio rate and the audio quality into this initial header, thus simplifying vastly the certain identification of an Ogg Vorbis audio bitstream.
Each chained logical bitstream must have a unique serial number within the scope of the physical bitstream.
The initial pages of each logical bitstream must appear first; the media mapping specifies the order of the initial pages. For example, Ogg A/V will eventually specify an Ogg video bitstream with audio. The mapping may specify that the physical bitstream must begin with the initial page of a logical video bitstream, followed by the initial page of an audio stream. Unlike initial pages, terminal pages for the logical bitstreams need not all occur contiguously (although a specific media mapping may require this; it is not mandated by the generic Ogg stream spec). Terminal pages may be 'nil' pages, that is, pages containing no content but simply a page header with position information and the 'last page of bitstream' flag set in the page header.
Each grouped bitstream must have a unique serial number within the scope of the physical bitstream.
In this example, we see pages from five total logical bitstreams multiplexed into a physical bitstream. Note the following characteristics:
Ogg Vorbis is the first Ogg audio CODEC. Anyone may freely use and distribute the Ogg and Vorbis specification, whether in a private, public or corporate capacity. However, the Xiph.org Foundation and the Ogg project (xiph.org) reserve the right to set the Ogg Vorbis specification and certify specification compliance.
Xiph.org's Vorbis software CODEC implementation is distributed under a BSD-like license. This does not restrict third parties from distributing independent implementations of Vorbis software under other licenses.
Ogg, Vorbis, Xiph.org Foundation and their logos are trademarks (tm) of the Xiph.org Foundation. These pages are copyright (C) 1994-2002 Xiph.org Foundation. All rights reserved.