Jump to content

Ogg

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by 80.202.179.68 (talk) at 14:11, 31 August 2007 (Added Metadata section as OGG is indeed a container format (which would imply metadata)). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Ogg
Ogg Vorbis Logo
Filename extension
.ogg
Internet media type
application/ogg
Magic numberOggS
Developed byXiph.Org Foundation
Type of formatContainer format
Container forVorbis, Theora, Speex, FLAC

OGG is an open standard for a free container format for digital multimedia, unrestricted by software patents and designed for efficient streaming and manipulation. OGG is maintained by the Xiph.Org Foundation.

The name ‘OGG’ refers to the file format which can multiplex a number of separate independent free and open source codecs for audio, video, text (such as subtitles), and metadata. Files ending in the .ogg extension may be of any OGG media filetype. The term ‘OGG’ is often used to refer to audio file format OGG Vorbis, that is, Vorbis-encoded audio in the OGG container. Other prominent Xiph codecs that are often encapsulated in OGG are the video codec Theora, and the human speech audio compression format Speex. Because the format is free, 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 from different manufacturers.

It is often erroneously assumed that the name OGG comes from the character of Nanny Ogg in Terry Pratchett's Discworld novels. Rather, it derives from ogging, jargon from the computer game Netrek which came to mean doing something forcefully, possibly without consideration of the drain on future resources.[1] At its inception, the OGG project was thought to be somewhat ambitious given the power of the PC hardware of the time.

The current version of Xiph's reference implementation, released on 27 November 2005, is libogg 1.1.3.[2] Another version, libogg2, is also available from Xiph's SVN repositories. Both software libraries are free and open source software, released under the BSD License.

File format

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.

Page structure

The following is the field layout of an Ogg page header:

 0                   1                   2                   3
 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| capture_pattern: Magic number for page start "OggS"           | 0-3
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| version       | header_type   | granule_position              | 4-7
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                                                               | 8-11
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                               | bitstream_serial_number       | 12-15
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                               | page_sequence_number          | 16-19
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                               | CRC_checksum                  | 20-23
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                               | page_segments | segment_table | 24-27
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| ...                                                           | 28-
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
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.

Metadata

There is no standard for including metadata in OGG containers. Implementation is still a long way off. The Xiph.Org Foundation are currently welcomming suggestions and feedback. Suggested implementation methods include the following: [3]

  • Dublin core in RDF
  • XML-encoding (options include generic RDF, CMML, and XMP)
  • MusicBrainz XML MetaData
  • Ogg_Skeleton is emerging as the way to approach machineable metadata.

Mmetadata must currently be included in the codec. There is farily good software support for Vorbis metadata—often referred to as comments. But software support for Theora and FLAC comments in OGG containers is very limited.

History

The “Play OGG” web button

In May 2003, two Internet RFCs were published relating to the format. The Ogg bitstream was defined in RFC 3533 (which is classified as 'informative') and its Internet content type (application/ogg) in RFC 3534 (which is, as of 2006, a proposed standard protocol).

Although Ogg hasn't reached anywhere near the ubiquity of the MPEG standards (e.g.: MP3 / MP4), as of 2006, it is commonly used to encode free content (such as free music, multimedia on Wikimedia projects and Creative Commons files) and has started to be supported by a significant minority of digital audio players. Many popular game engines also support the Ogg format, not the least of which have been the Doom 3, Unreal Tournament 2004, Serious Sam: The Second Encounter, and the Grand Theft Auto engines. The more popular Ogg Vorbis codec has built-in support on many software players and extensions are available for nearly all the rest. Other codecs are less well supported although extensions are often available.

On May 16, 2007, the Free Software Foundation started a campaign to widespread the use of Ogg Vorbis “as an ethically, legally and technically superior audio alternative to the proprietary MP3 format.”[4] People are also encouraged to support the campaign by adding a web button to their website or blog. For those who don't want to download and use FSF's suggested Ogg player (VLC), the Xiph.Org Foundation has an official codec[5] for QuickTime-based applications in Windows and Mac OS X, such as iTunes players and iMovie applications; and Windows users can install a Windows Media Player Ogg codec[6].

Potential patent problems

According to a CNET news story[7], the vice president of Thomson which holds patents to the MP3 format, says "I would say we continue to have some thoughts that it is very likely that they are using some of the Thomson/Fraunhofer solutions in the project…But it's not part of our daily concern." Xiph.org Foundation responded with an open letter[8]. No action has been taken to this point, although the information about the implementation of Ogg is freely available. Chris Montgomery, creator of Ogg, has later been cited as saying, "To this day, we still have lawyers tell us they won't support Ogg because Thomson would come after them"[9].

Ogg codecs

Ogg is only a container format. The actual audio or video encoded by a codec will be stored inside an Ogg container. Ogg containers may contain streams encoded with multiple codecs, for example, an audio video file may contain data encoded by both an audio codec and a video codec.

Being a Container format, Ogg can embed audio and video in various formats (such as MPEG-4, Dirac, MP3 and others) but usually Ogg is used with the following:

  • Text codecs
    • Writ: a text codec designed to embed subtitles or captions
  • Video codecs
    • Theora: based upon On2's VP3, it is targeted at competing with MPEG-4 video (for example, encoded with DivX or Xvid), RealVideo, or Windows Media Video.
    • Tarkin: an experimental codec utilizing discrete wavelet transforms in the three dimensions of width, height, and time. It has been put on hold since February 2000, with Theora becoming the main focus for video encoding.
    • Dirac: an experimental codec developed by the BBC as the basis of a new codec for the transmission of video over the Internet. The Schrödinger project aims to provide portable libraries, written in C, that implement the Dirac codec. It also allows to embed Dirac inside the Ogg container format.
    • OggUVS: a draft codec for storing uncompressed video.
  • Subtitle structures
    • Annodex: A free and open source set of standards developed by CSIRO to annotate and index networked media.

References

  1. ^ Medo (2005-12-20). "Ogg Vorbis - Better Than Mp3?". BBC. Retrieved 2007-06-24. {{cite web}}: Check date values in: |date= (help)
  2. ^ http://lists.xiph.org/pipermail/vorbis-dev/2005-November/018295.html
  3. ^ "OGG Metadata". Xiph Wiki. 2005-12-20. Retrieved 2007-08-31. {{cite web}}: Check date values in: |date= (help)
  4. ^ 'Play Ogg': FSF launches free audio format campaign
  5. ^ Xiph.Org: Ogg QuickTime Components for iTunes and iMovie (Windows and MacOSX)
  6. ^ Windows Media Player Directshow Filters for Ogg Vorbis, Speex, Theora and FLAC
  7. ^ John Borland (2001-02-27). "MP3 rival attempts to shield developers". News.com. Retrieved 2007-02-28. {{cite web}}: Check date values in: |date= (help)
  8. ^ Emmett Plant (2002-08-27). "An open Thank-You Letter". Xiph.org Foundation. Retrieved 2007-02-28. {{cite web}}: Check date values in: |date= (help)
  9. ^ Evan Hansen, Eliot Van Buskirk (2007-02-23). "MP3's Loss, Open Source's Gain". Wired. Retrieved 2007-02-28. {{cite web}}: Check date values in: |date= (help)

See also

Template:HelpCommons