|Filename extension||.ogv, .oga, .ogx, .ogg, .spx|
|Internet media type||video/ogg, audio/ogg, application/ogg|
|Developed by||[[Developer::Xiph.Org Foundation]]Expression error: Unrecognised word "span".|
|File formats category -|
Ogg is a free, open standard container format maintained by the Xiph.Org Foundation. The creators of the Ogg format claim that it is unrestricted by software patents and is designed to provide for efficient streaming and manipulation of high quality digital multimedia.
In the Ogg multimedia framework, Theora provides a lossy video layer, while the music-oriented Vorbis codec most commonly acts as the audio layer. The human speech compression codec Speex, lossless audio compression codec FLAC, and OggPCM may also act as audio layers.
The term ‘Ogg’ is commonly used to refer to audio file format Ogg Vorbis, that is, Vorbis-encoded audio in the Ogg container. Previously, the .ogg file extension was used for any content distributed within Ogg, but as of 2007, the Xiph.Org Foundation requests that .ogg be used only for Vorbis due to backward compatibility concerns. The Xiph.Org Foundation decided to create a new set of file extensions and media types to describe different types of content such as .oga for audio only files, .ogv for video with or without sound (including Theora), and .ogx for applications.
The current version of the Xiph.Org Foundation's reference implementation, released on June 23, 2009, is libogg 1.1.4. Another version, libogg2, has been in development, but is awaiting a rewrite as of 2008. Both software libraries are free software, released under the new BSD license.
Because the format is free, and its reference implementation is non-copylefted, Ogg's various codecs have been incorporated into a number of different free and proprietary media players, both commercial and non-commercial, as well as portable media players and GPS receivers from different manufacturers.
The Ogg bitstream format, spearheaded by the Xiph.Org Foundation, has been created as the framework of a larger initiative aimed at developing a set of components for the coding and decoding of multimedia content which are available free of charge and are freely re-implementable in software.
The format consists of chunks of data each called an Ogg page. Each page begins with the "OggS" string to identify the file as Ogg format.
A serial number and page number in the page header identifies each page as part of a series of pages making up a bitstream. Multiple bitstreams may be multiplexed in the file where pages from each bitstream are ordered by the seek time of the contained data. Bitstreams may also be appended to existing files, a process known as chaining, to cause the bitstreams to be decoded in sequence.
A BSD-licensed library, called libogg, is available to encode and decode data from Ogg streams. Independent Ogg implementations are used in several projects such as RealPlayer and a set of DirectShow filters.
The following is the field layout of an Ogg page header:
|0 (0)||32||Capture Pattern|
|40 (28)||8||Header Type|
|48 (30)||64||Granule Position|
|112 (70)||32||Bitstream Serial Number|
|144 (90)||32||Page Sequence Number|
|208 (D0)||8||Page Segments|
|216 (D8)||…||Segment Table|
- Capture pattern — 32 bits
- The capture pattern or sync code is a magic number used to ensure synchronisation when parsing Ogg files. Every page starts with the four byte sequence 'OggS'. This assists in resynchronising a parser in cases where data has been lost or is corrupted, and is a sanity check before commencing parsing the page structure.
- Version — 8 bits
- This field indicates the version of the Ogg bitstream format, to allow for future expansion. It is currently mandated to be 0.
- Header type — 8 bits
- This is an 8 bit field of flags, which indicates the type of page which follows. The rightmost or least significant bit is considered bit 0, with value 0x01, the next least significant digit is bit 1, with value 0x02. The third is bit 2, with value 0x04, and so on.
Bit Value Flag Page type 0 0x01 Continuation The first packet on this page is a continuation of the previous packet in the logical bitstream. 1 0x02 BOS Beginning Of Stream. This page is the first page in the logical bitstream. The BOS flag must be set on the first page of every logical bitstream, and must not be set on any other page. 2 0x04 EOS End Of Stream. This page is the last page in the logical bitstream. The EOS flag must be set on the final page of every logical bitstream, and must not be set on any other page.
- Granule position — 64 bits
- A granule position is the time marker in Ogg files. It is an abstract value, whose meaning is determined by the codec. It may for example be a count of the number of samples, the number of frames or a more complex scheme.
- Bitstream serial number — 32 bits
- This field is a serial number which identifies a page as belonging to a particular logical bitstream. Each logical bitstream in a file has a unique value, and this field allows implementations to deliver the pages to the appropriate decoder. In a typical vorbis+theora file, one stream will be the audio (vorbis), and the other will be the video (theora)
- Page sequence number — 32 bits
- This field is a monotonically increasing field for each logical bitstream. The first page is 0, the second 1, etc. This allows implementations to detect when data has been lost.
- Checksum — 32 bits
- This field provides a checksum of the data in the entire page, performed with the checksum field set to 0. This allows verification that the data has not been corrupted since it was created. Pages which fail the checksum should be discarded.
- Page segments — 8 bits
- This field indicates the number of segments that exist in this page. It also indicates how many bytes are in the segment table which follows this field. There can be a maximum of 255 segments in any one page.
- Segment table
- The segment table is an 8 bit vector of values indicating the length of each segment within the page body. The number of segments is determined from the preceding Page Segments field. Each segment is between 0 and 255 bytes in length.
The segments provide a way to group segments into packets, which are meaningful units of data for the decoder. When the segments length is indicated to be 255, this indicates that the following segment is to be concatenated to this one and is part of the same packet. When the segments length is 0-254, this indicates that this segment is the final segment in this packet. Where a packets length is a multiple of 255, the final segment will be of length 0.
Where the final packet continues on the next page, the final segment value will be 255, and the continuation flag will be set on the following page to indicate that the start of the new page is a continuation of last page.
- The Xiph.Org Foundation official webpage — Ogg
- RFC 3533 (The Ogg Encapsulation Format Version 0)
- RFC 5334 (Ogg Media Types)
<ref>tags exist, but no
<references/>tag was found