OGG Format: An In-Depth Look

OGG format header image

What is the OGG Format?

OGG files are a free an open container format primarily used for audio files, and use the .ogg extension. OGG audio files store music with less bandwidth because the OGG format saves audio data that applies Vorbis to your data. This compresses individual streams in various ways, including Theora for video and Opus and OggPCM for audio. You can also store song metadata, including track data and information on the artist, with OGG. They are more efficient than MP3 files and can include artist and track information and metadata.

OGG is a free and open format that anyone can use without licensing or royalty fees. The Xiph.Org Foundation maintains the OGG format. However, in 2007, the Xiph.Org Foundation recommended using OGG primarily for audio, which is why most OGG files store audio data compressed with Vorbis. OGG files that adopt other compression schemes, such as FLAC or Speex, are saved as .OGA files.

This article, part of our series on video formats, covers the following topics:

OGG Containers and OGG Vorbis

OGG files are made up of one or more pages, also known as containers. Each page begins with the ASCII characters OggS followed by a version number. On identifying those bytes at the beginning of a file, the player becomes aware that the file is an OGG container, which performs bounding and error checking for streaming data.

The OGG format supports true streaming with no need to load the entire file before playing, eliminating memory limitations when large files are being played. Streams can last for hours, and only the part currently playing must be loaded into memory.

What Are VorbisComments?

Metadata is important for media files, because it contains such information as song title, composer and performer names, and copyright details. OGG supports several metadata formats, the most common one being VorbisComment, which consists of key-value pairs of up to 16 exabytes, an almost limitless size.

How Are OGG Files Encoded?

As a popular encoding protocol for OGG audio files, Vorbis is lossy, i.e., irreversible. To achieve more compression, Vorbis deletes certain information for the files.


Whether the data loss is significant depends on the level of compression. Vorbis encodes with variable bitrate. You can set the file quality between -2 (or -1, depending on the software) and 10, with 0 being equivalent to the quality of a phone call (64 KB/sec.). A quality setting of 10 requires about 500 KB/sec.

Vorbis delivers higher quality than MP3 at the same level of compression. The encoding depth, typically 16 bits, can be deeper. A Vorbis stream, which can carry up to 255 channels, supports mono, stereo, subwoofer channels, quadraphonic channels, and so on.

Related content: Video Transcoding: A Practical Guide

What Is Multitrack OGG (MOGG)?

MOGG is a package for storing OGG files that are considered tracks of the same album or collection.

OGG File Architecture and OGG Header Structure

In the OGG format, each page or container has a header with information that helps players recognize the page as part of an OGG file and then put the containers together, called a bitstream, to play an audio file.

The OGG format enables multiplexing, i.e., multiple bitstreams in a single file and bitstreams listed in the order of the seek time of the audio data. You can also append bitstreams to existing files so that the bitstreams are decoded in sequence, a step known as chaining.

The following image shows the structure and content of an OGG page header.


The header contains these details:

  • Capture pattern (32 bits): A pattern that starts with OggS and that contains a unique number with which players can resynchronize in case of data loss.
  • Version (8 bits): The OGG bitstream’s version number.
  • Header type (8 bits): The page type, which can be a continuation of a previous page (encoded as 0), the beginning of the stream (1), or the end of the stream (2).
  • Granule position (64 bits): A time marker, whose exact meaning is determined by the codec.
  • Bitstream serial number (32 bits): The role of the current page in the logical bitstream, e.g., a value that denotes that the current page contains Vorbis (audio) content.
  • Page sequence number (32 bits): A serial number that denotes the position of the current page in the stream and that enables implementations that detect data loss.
  • Checksum (32 bits): A value that enables verification of whether the data is corrupted. Pages that fail the checksum are discarded.
  • Page segments (8 bits): The number of segments in the current page (up to 255).
  • Segment table: The length of each segment (between 0-255 bytes) in the page body.

OGG Versus MP3: Differences and Pros and Cons

MP3 reduces the file size and maintains the original quality by means of lossy compression. Even though both MP3 and Vorbis OGG can reach a maximum bitrate of 320 KB/sec., Vorbis OGG sounds better than MP3.

OGG files are smaller in size than WAV files. They are also superior to MP3 files in terms of sound quality and file size, and offer a high bitrate that matches the highest setting of most streaming services.

Why the quality difference? Because for all that Vorbis also encodes with lossy compression, it applies a more advanced encoding scheme, which results in higher sound quality. Nonetheless, MP3 is preferred by many because it is compatible with all platforms.

Here are the main differences between OGG and MP3:

  • Licensing: OGG is a free, open-source format; MP3 is copyrighted.
  • Codecs: OGG is suitable for audio, video, text (captions), and metadata; MP3, primarily for audio.
  • Size: OGG produces a smaller file size than MP3.
  • Compression: Both OGG and MP3 encode with lossy compression.
  • Compatibility: OGG is compatible with music-streaming platforms; MP3 is universally compatible.
  • Quality: Even though both OGG and MP3 can reach a maximum of 320 KB/sec., OGG at 192 KB/sec. is superior to MP3.
  • Channels: OGG offers two to 256 channels; MP3, two separate channels and joint stereo.

Here are the main pros and cons of OGG:


  • OGG can store more audio channels than MP3.
  • The OGG format saves various files, including video, audio, and text.
  • OGG is free and open-source.


  • OGG is not universally compatible.
  • The OGG format causes high battery consumption.

Here are the main pros and cons of MP3:


  • MP3 is universally compatible.
  • The MP3 format generates smaller sizes than OGG.
  • MP3 is relatively easy to transform.


  • MP3 yields a lower quality than OGG when reaching higher bitrates.
  • MP3 is susceptible to malware or virus attacks.

Automated Video-Format Conversion With Cloudinary

Formats and codecs abound for encoding videos, with some formats doing a better job   compressing and reducing file size without impairing visual quality. Since different browsers support different video formats and codecs, the best solution to save bandwidth and optimize delivery time is to deliver the best format for the requesting browser.

Setting the fetch_format parameter to auto (f_auto in URLs) causes Cloudinary to automatically select the format and codec based on the requesting browser. For example, Chrome users would most likely receive a VP9-encoded WebM file; Safari users, an HEVC-encoded MP4 file. If a browser does not support either of those formats, Cloudinary delivers the video as an H.264-encoded MP4 file, which works in almost all browsers.

In brief, Cloudinary seamlessly performs the following tasks based on the parameters in delivery URLs:

  • Dynamically transform videos on the fly to any format, style, and dimension.
  • Apply effects and other visual enhancements.
  • Optimize videos so that they are of minimal file size and high quality for an enhanced user experience and nominal bandwidth.

Interested? Have a try for free by first signing up for a free Cloudinary account.