From HandWiki
Short description: Open container format maintained by the Xiph.Org Foundation
Filename extension.ogg, .ogv, .oga, .ogx, .ogm, .spx, .opus
Internet media typevideo/ogg, audio/ogg, application/ogg
Magic numberOggS
Developed byXiph.Org Foundation
Initial releaseMay 2003; 20 years ago (2003-05)
Type of formatContainer format
Container forVorbis, Theora, Speex, Opus, FLAC, Dirac, and others.
Open format?Yes[1]
Ogg Logo.svg
Developer(s)Xiph.Org Foundation
Initial release22 September 2004; 19 years ago (2004-09-22)
Stable release
1.3.5 / 4 June 2021; 2 years ago (2021-06-04)
TypeReference implementation (multiplexer/demultiplexer)
LicenseBSD-style license[2]

Ogg is a free, open container format maintained by the Xiph.Org Foundation. The authors of the Ogg format state that it is unrestricted by software patents[3] and is designed to provide for efficient streaming and manipulation of high-quality digital multimedia. Its name is derived from "ogging", jargon from the computer game Netrek.[4]

The Ogg container format can multiplex a number of independent streams for audio, video, text (such as subtitles), and metadata.

In the Ogg multimedia framework, Theora provides a lossy video layer. The audio layer is most commonly provided by the music-oriented Vorbis format or its successor Opus. Lossless audio compression formats include FLAC, and OggPCM.

Before 2007, the .ogg filename extension was used for all files whose content used the Ogg container format. Since 2007, the Xiph.Org Foundation recommends that .ogg only be used for Ogg Vorbis audio files. 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 multiplexed Ogg.[5]

As of November 7, 2017, the current version of the Xiph.Org Foundation's reference implementation is libogg 1.3.3.[6] Another version, libogg2, has been in development, but is awaiting a rewrite as of 2018.[7] Both software libraries are free software, released under the New BSD License. Ogg reference implementation was separated from Vorbis on September 2, 2000.[8]

Because the format is free, and its reference implementation is not subject to restrictions associated with copyright, 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.


Ogg is derived from "ogging", jargon from the computer game Netrek, which came to mean doing something forcefully, possibly without consideration of the drain on future resources.[4] At its inception, the Ogg project was thought to be somewhat ambitious given the limited power of the PC hardware of the time.[9] Although it is sometimes assumed that the name "Ogg" comes from the character of Nanny Ogg in Terry Pratchett's Discworld novels, the format's developers say that is not true.[9] Still, to quote the same reference: "Vorbis, on the other hand is named after the Terry Pratchett character from the book Small Gods".

The Ogg Vorbis project started in 1993. It was originally named "Squish" but that name was already trademarked, so the project underwent a name change. The new name, "OggSquish", was used until 2001 when it was changed again to "Ogg". Ogg has since come to refer to the container format, which is now part of the larger multimedia project. Today, "Squish" (now known as "Vorbis") refers to a particular audio coding format typically used with the Ogg container format.[10]

File format

The "Ogg" bitstream format, designed principally by the Xiph.Org Foundation, has been developed as the framework of a larger initiative aimed at producing a set of components for the coding and decoding of multimedia files, which are available free of charge and freely re-implementable in software and hardware.

The format consists of chunks of data each called an "Ogg page". Each page begins with the characters "OggS" 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 "libvorbis", is available to encode and decode data from "Vorbis" streams. Independent Ogg implementations are used in several projects such as RealPlayer and a set of DirectShow filters.[11]

Mogg, the "Multi-Track-Single-Logical-Stream Ogg-Vorbis", is the multi-channel or multi-track Ogg file format.

Page structure

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

The field layout of an Ogg page header
Capture pattern – 32 bits
The capture pattern or sync code is a magic number used to ensure synchronization when parsing Ogg files. Every page starts with the four ASCII character sequence, "OggS". This assists in resynchronizing a parser in cases where data has been lost or is corrupted, and is a sanity check before commencing parsing of 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 that follows.
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 that 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 and Theora file, one stream is the audio (Vorbis), and the other is 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 CRC32 checksum of the data in the entire page (including the page header, calculated with the checksum field set to 0). This allows verification that the data has not been corrupted since it was authored. Pages that fail the checksum should be discarded. The checksum is generated using a polynomial value of 0x04C11DB7.
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 that follows this field. There can be a maximum of 255 segments in any one page.
Segment table
The segment table is an array of 8-bit values, each indicating the length of the corresponding 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 segment's 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 segment's length is 0–254, this indicates that this segment is the final segment in this packet. Where a packet's length is a multiple of 255, the final segment is length 0.

Where the final packet continues on the next page, the final segment value is 255, and the continuation flag is set on the following page to indicate that the start of the new page is a continuation of last page.


VorbisComment is a base-level Metadata format initially authored for use with Ogg Vorbis. It has since been adopted in the specifications of Ogg encapsulations for other Xiph.Org codecs including Theora, Speex, FLAC and Opus. VorbisComment is the simplest and most widely-supported mechanism for storing metadata with Xiph.Org codecs.[12]

Notably, one or more METADATA_BLOCK_PICTURE=… in a VorbisComment for thumbnails and cover art have Base64-encoded values of the corresponding FLAC METADATA_BLOCK_PICTURE. In other words, FLAC stores thumbnails and cover art in binary blocks—outside of the FLAC tags in a little-endian METADATA_BLOCK_VORBIS_COMMENT.[13][14]

Other existing and proposed mechanisms are:[15]


Play ogg.png
The Play Ogg web button

The Ogg project began with a simple audio compression package as part of a larger project in 1993.[9] The software was originally named Squish but due to an existing trade mark it was renamed to OggSquish. This name was later used for the whole Ogg project. In 1997, the Xiphophorus OggSquish was described as "an attempt both to create a flexible compressed audio format for modern audio applications as well as to provide the first audio format that is common on any and every modern computer platform".[17] The OggSquish was in 2000 referred to as "a group of several related multimedia and signal processing projects". In 2000, two projects were in active development for planned release: Ogg Vorbis format and libvorbis—the reference implementation of Vorbis. Research also included work on future video and lossless audio coding.[9][18][19][20][21] In 2001, OggSquish was renamed to Ogg and it was described as "the umbrella for a group of several related multimedia and signal processing projects".[22] Ogg has come to stand for the file format, as part of the larger multimedia project. Squish became just the name of one of the Ogg codecs.[10] In 2009, Ogg is described as "a multimedia container format, and the native file and stream format for the multimedia codecs".[23]

The Ogg reference implementation was separated from Vorbis on September 2, 2000.[8]

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). In September 2008, RFC 3534 was obsoleted by RFC 5334, which added content types video/ogg, audio/ogg and filename extensions .ogx, .ogv, .oga, .spx.


In 2002, the lack of formal video support in Ogg resulted in the development of the OGM file format, a hack on Ogg that allowed embedding of video from the Microsoft DirectShow framework into an Ogg-based wrapper. OGM was initially supported only by closed source Windows-only tools, but the codebase was subsequently opened. Later, video (and subtitle) support were formally specified for Ogg but in a manner incompatible with OGM. Independently, the Matroska container format reached maturity and provided an alternative for people interested in combining Vorbis audio and arbitrary video codecs. As a result, OGM is no longer supported or developed and is formally discouraged by[24] Today, video in Ogg is found with the .ogv file extension, which is formally specified and officially supported. Software and codecs that support .ogm files are available without charge.[25]


Although Ogg had not reached anywhere near the ubiquity of the MPEG standards[26][27] (e.g., MP3/MP4), (As of 2006), it was commonly used to encode free content (such as free music, multimedia on Wikimedia Foundation projects and Creative Commons files) and had started to be supported by a significant minority of digital audio players. Also supporting the Ogg format were many popular video game engines, including Doom 3, Unreal Tournament 2004, Halo, Jets'n'Guns, Mafia: The City of Lost Heaven, Myst IV, StepMania, Serious Sam, Lineage 2, Vendetta Online, Battlefield 2, and the Grand Theft Auto engines, as well as the audio files of the Java-based game, Minecraft. The more popular Vorbis codec had built-in support on many software players, and extensions were available for nearly all the rest.


On May 16, 2007, the Free Software Foundation started a campaign to increase the use of Vorbis "as an ethically, legally and technically superior audio alternative to the proprietary MP3 format".[28] People were also encouraged to support the campaign by adding a web button to their website or blog. For those who did not want to download and use the FSF's suggested Ogg player (VLC), the Xiph.Org Foundation had an official codec[29] for QuickTime-based applications in Windows and Mac OS X, such as iTunes players and iMovie applications; and Windows users could install a Windows Media Player Ogg codec.[30]


By June 30, 2009, the Ogg container, through the use of the Theora and Vorbis, was the only container format included in Firefox 3.5 web browser's implementation of the HTML5 <video> and <audio> elements.[31][32] This was in accordance with the original recommendation outlined in, but later removed from, the HTML5 draft specification (see Ogg controversy).


On March 3, 2010, a technical analysis by an FFmpeg developer was critical about the general purpose abilities of Ogg as a multimedia container format.[33] The author of Ogg later responded to these claims in an article of his own.[34]

Ogg codecs

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

Being a container format, Ogg can embed audio and video in various formats[35][36] (such as Dirac, MNG, CELT, MPEG-4, MP3 and others) but Ogg was intended to be, and usually is, used with the following free codecs:

  • Audio
    • Lossy
      • Speex: handles voice data at low bitrates (~2.1–32 kbit/s/channel)
      • Vorbis: handles general audio data at mid to high-level variable bitrates (≈16–500 kbit/s per channel)
      • Opus: handles voice, music and generic audio at low and high variable bitrates (≈6–510 kbit/s per channel)
    • Lossless
      • FLAC handles archival and high-fidelity audio data.
      • OggPCM allows storing standard uncompressed PCM audio in an Ogg container[37]
  • Video
    • Lossy
    • Lossless
      • Dirac: a part of the specification of dirac covers lossless compression.
      • Daala: a video coding format under development.
  • Text
    • Continuous Media Markup Language: a text/application codec for timed metadata, captioning, and formatting.
    • Annodex: A free and open source set of standards developed by CSIRO to annotate and index networked media.
    • OggKate: An overlay codec, originally designed for karaoke and text, that can be multiplexed in Ogg.[43]

Media types

Ogg audio media is registered as IANA media type audio/ogg with file extensions .oga, .ogg, and .spx. It is a proper subset of the Ogg video media type video/ogg with file extension .ogv. Other Ogg applications use media type application/ogg with file extension .ogx; this is a superset of video/ogg.[36] The Opus media type audio/opus with file extension .opus was registered later in RFC 7587 and 7845.

See also


  1. Template:Cite tech report
  2. "Sample Xiph.Org Variant of the BSD License". Xiph.Org Foundation. 
  3. " FAQ". 
  4. 4.0 4.1 "Ogging 101". "3.3 Ogging: This is the art of killing a carrier, or potential carrier, by a suicide run." 
  5. "MIME Types and File Extensions". XiphWiki. 2007-09-07. 
  6. Giles, Ralph (2017-11-07). "libogg 1.3.3 release". ogg-dev (Mailing list). Archived from the original on 2018-04-04. Retrieved 2019-01-14.
  7. Giles, Ralph (2008-01-05). "r14372 - in trunk/theora: . lib/dec lib/enc". xiph-commits (Mailing list). Archived from the original on 2020-10-03. Retrieved 2019-01-14. This library was never released and now looks like it needs to be redesigned.
  8. 8.0 8.1 Xiph.Org (2002-07-19) Ogg releases - libogg-1.0.tar.gz - CHANGES . Retrieved 2009-09-01.
  9. 9.0 9.1 9.2 9.3 " naming". Foundation. 2006-01-07. "At the time Ogg was starting out, most personal computers were i386s and the i486 was new. I remember thinking about the algorithms I was considering, "Whoa, that's heavyweight. People are going to need a 486 to run that..." While the software ogged the music, there wasn't much processor left for anything else." 
  10. 10.0 10.1 " naming". Foundation. 2006-01-07. 
  11. "Directshow Filters for Ogg Vorbis". 
  12. "VorbisComment". 26 April 2016. 
  13. "METADATA_BLOCK_PICTURE". flac free lossless audio codec. Xiph.Org. 2014. 
  14. "Ogg Vorbis I format specification: comment field and header specification". Xiph.Org. 2005. 
  15. "Metadata". 24 July 2013. 
  16. "Ogg Skeleton 4". Xiph.Org. 2012. 
  17. Montgomery, Christopher (1997). "Ogg 98.9". Xiphophorus company. 
  18. (2000-01-18). "OggSquish Vorbis encoding format documentation". 
  19. (2000-01-18). "OggSquish logical and physical bitstream overview". 
  20. 20.0 20.1 Xiphophorus company (2001-04-05). "The Ogg project homepage". 
  21. (2001-12-04). "The Ogg project homepage". 
  22. Xiphophorus company (2001-12-04). "The Ogg project homepage". 
  23. "The Ogg container format". Xiph.Org Foundation. 2006-01-07. 
  24. "OGM is not Ogg. does not support OGM.". Backup at WayBack Machine. 2004-07-07. 
  25. "K-Lite Codec Pack: Comparison of abilities and supported file formats". 
  26. "MP3's Loss, Open Source's Gain". 2007-02-23. 
  27. "MP3's Loss, Open Source's Gain". 2007-02-23. 
  28. "'Play Ogg': FSF launches free audio format campaign" (in la). 
  29. "Foundation: Ogg QuickTime Components for iTunes and iMovie (Windows and Mac OS X)". 
  30. "Directshow Filters for Ogg Vorbis, Speex, Theora and FLAC". 2010-02-22. 
  31. "Mozilla Developer Center - HTML - Element - Video". September 2009. 
  32. "Mozilla Developer Center - HTML - Element - Audio". September 2009. 
  33. Rullgard, Mans (2010-03-03). "Ogg objections". 
  34. Montgomery, Christopher (2010-04-27). "Monty - In Defense of Ogg's Good Name". 
  35. "MIME Types and File Extensions". XiphWiki. 2009-10-04. 
  36. 36.0 36.1 I. Goncalves; S. Pfeiffer; C. Montgomery (2008), Ogg Media Types, sec. 10, doi:10.17487/RFC5334, RFC 5334, 
  37. "OggPCM". XiphWiki. 2020-05-25. 
  38. Ralph Giles (2000-12-19) vorbis-dev - Tarkin video codec? , vorbis-dev mailinglist. Retrieved 2009-09-06.
  39. Jack Moffitt (2001-01-03) vorbis-dev - Tarkin at last , vorbis-dev mailinglist. Retrieved 2009-09-06.
  40. Chris Montgomery (2001-02-11) Tarkin developer mailing list , Retrieved on 2009-09-06
  41. Michael Smith (2005-08-29) Tarkin . Retrieved 2009-09-06.
  42. Dirac specification - integration of Dirac encoded video into commonly used container formats Retrieved on 2009-07-05
  43. "OggKate". 2017. 

External links