Ogg is a free, open container format maintained by the Xiph.Org Foundation that multiplexes compressed audio, video and metadata into a single page-based bitstream. In video, Ogg files usually carry Theora video with Vorbis or Opus audio and use the .ogv extension, while audio-only files use .ogg, .oga or .opus.
Within containers & formats, Ogg stands out as a patent-free, streaming-oriented design specified in RFC 3533. It played a major role in early open web video, although WebM and MP4 have since replaced it in most video workflows.
How the Ogg page structure works
An Ogg stream is a sequence of pages, each beginning with the four-byte capture pattern OggS. A page holds a header and up to 255 segments of up to 255 bytes, so a single page can carry at most about 64 KB of payload. Codec packets are split into segments with a scheme called lacing, and a packet larger than one page continues across several pages.
Because every page starts with a recognizable pattern and ends with a CRC32 checksum, a decoder can resynchronize after data loss or start reading in the middle of a stream. This property made Ogg attractive for internet radio and live streaming, where a listener may join at any moment.
The table below lists the main fields of an Ogg page header and their purpose.
| Field | Size | Purpose |
|---|---|---|
| Capture pattern | 4 bytes | Marks the start of a page with OggS |
| Header type flags | 1 byte | Signal continuation, first page or last page |
| Granule position | 8 bytes | Codec-specific time or sample position |
| Bitstream serial number | 4 bytes | Identifies the logical stream |
| Page sequence number | 4 bytes | Detects lost or reordered pages |
| CRC checksum | 4 bytes | Verifies page integrity |
| Segment table | 1 to 255 bytes | Lists lacing values for the payload |
Logical bitstreams, multiplexing and the granule position
Each elementary stream inside an Ogg file is a logical bitstream with its own serial number. Ogg combines them in two ways: grouping interleaves pages of concurrent streams, such as video and audio, and chaining places complete streams one after another, which suits playlists or radio programs with changing metadata.
The granule position is the key timing field, but Ogg itself does not define its meaning. Each codec interprets it: for Vorbis and Opus it counts audio samples, while for Theora it encodes the last keyframe and the frame offset since that keyframe. This codec-dependent design keeps the container simple but forces demuxers to understand every codec they handle.
The following table shows the codecs most often found in Ogg and the role each one plays.
| Codec | Type | Typical extension | Status |
|---|---|---|---|
| Theora | Lossy video | .ogv | Legacy, no longer developed |
| Vorbis | Lossy audio | .ogg or .oga | Mature and widely supported |
| Opus | Lossy audio | .opus | Current recommended audio codec |
| FLAC | Lossless audio | .oga | Common for archival audio |
| Speex | Speech audio | .spx | Superseded by Opus |
| Skeleton | Metadata stream | Inside .ogv | Optional index and stream data |
Ogg compared with other container formats
Ogg differs from MP4 and MKV mainly in its lack of a mandatory global index. MP4 stores a moov atom that tells a player exactly where every sample lives, and MKV uses cues for the same job. A basic Ogg file must be searched by bisection to seek, which is slower over a network, although the optional Skeleton stream can add an index.
The comparison below places Ogg among its closest neighbors in the containers & formats Topic.
| Container | Licensing | Seeking method | Typical video codecs |
|---|---|---|---|
| Ogg | Royalty-free, open | Bisection or Skeleton index | Theora |
| WebM | Royalty-free, open | Cues index | VP8, VP9, AV1 |
| MKV | Open specification | Cues index | Almost any codec |
| MP4 | ISO standard | Moov atom sample tables | H.264, H.265, AV1 |
| MPEG-TS | ISO standard | Packet scanning | MPEG-2, H.264 |
WebM is in practice the successor of Ogg video on the web. It keeps the royalty-free goal but uses a Matroska-based structure and the more efficient VP8, VP9 and AV1 codecs, which outperform Theora at the same bitrate.
Practical use of Ogg today
Ogg remains highly relevant for audio and only marginally relevant for video. Opus and Vorbis in Ogg are standard in games, voice applications, open-source software and some streaming services, while .ogv video persists mainly in legacy archives and open-content repositories.
The decision table below shows when Ogg is a reasonable choice and when another container fits better.
| Use case | Recommendation | Reason |
|---|---|---|
| Game sound effects and music | Ogg Vorbis or Ogg Opus | Free, compact, widely supported by engines |
| Internet radio stream | Ogg Opus | Resynchronization and chaining support |
| New web video | WebM or MP4 instead | Better codecs and broader playback |
| Lossless audio archive | FLAC in Ogg or native FLAC | Open format without patent risk |
| Professional video editing | Avoid Ogg | Weak support in editing software |
Limitations and common misconceptions
The most frequent misconception is that Ogg is an audio codec. Ogg is only the container; Vorbis or Opus is the codec inside. A file named .ogg can therefore contain different audio formats, which is why Xiph.Org later recommended specific extensions and MIME types in RFC 5334.
- Slow seeking over networks: files without a Skeleton index require several range requests to find a position.
- Limited video codec choice: Theora is the only widely used video codec in Ogg, and it is no longer developed.
- Weak professional support: most editing applications and broadcast systems do not import Ogg video.
- Fragile timing logic: because granule positions are codec-specific, unusual codec combinations can confuse demuxers.
In simple terms
Ogg is a free digital envelope for sound and video. The envelope does not decide how the picture or sound is compressed; it simply holds those pieces together, keeps them in sync and lets a player read them in order.
Its special trait is that it cuts the content into small labeled pages, a bit like numbered sheets in a binder. If a few sheets go missing during an internet stream, the player finds the next sheet and keeps playing. Today Ogg is mainly used for audio, while newer envelopes such as WebM and MP4 have taken over most video.
A practical example
An independent game studio needs about 400 sound effects and 30 music tracks for a cross-platform game. Uncompressed WAV files would take roughly 2 GB, which is too much for a downloadable title, and the studio wants to avoid any codec licensing fees.
The audio lead encodes the music as Ogg Vorbis at about 160 kbit/s and the short effects as Ogg Opus. The game engine decodes both natively on Windows, Linux and consoles. Total audio size drops to roughly 180 MB, with no audible difference for players in blind listening tests run by the team.
For the trailer on the studio website, however, the team does not use Ogg video. They export WebM with VP9 and MP4 with H.264, because those containers play in every modern browser. The outcome shows the typical split: Ogg for audio, other containers for video.