# Ogg Vorbis encoding format documentation

Last update to this document: July 2, 2002
Last update to Vorbis documentation: July 2, 2002

| As of writing, not all the below document links are live. They will be populated as we complete the documents.

## Documents

- Vorbis packet structure
- Temporal envelope shaping and blocksize
- Time domain segmentation and MDCT transform
- The resolution floor
- MDCT-domain fine structure

- The Vorbis probability model
- The Vorbis bitpacker

- Ogg bitstream overview
- Ogg logical bitstream and framing spec
- Vorbis packet->Ogg bitstream mapping

- Programming with libvorbis

## Description

Ogg Vorbis is a general purpose compressed audio format for high quality (44.1-48.0kHz, 16+ bit, polyphonic) audio and music at moderate fixed and variable bitrates (40-80 kb/s/channel). This places Vorbis in the same class as audio representations including MPEG-1 audio layer 3, MPEG-4 audio (AAC and TwinVQ), and PAC.

Vorbis is the first of a planned family of Ogg multimedia coding formats being developed as part of the Xiph.org Foundation's Ogg multimedia project. See http://www.xiph.org/ for more information.

## Vorbis technical documents

A Vorbis encoder takes in overlapping (but contiguous) short-time segments of audio data. The encoder analyzes the content of the audio to determine an optimal compact representation; this phase of encoding is known as analysis. For each short-time block of sound, the encoder then packs an efficient representation of the signal, as determined by analysis, into a raw packet much smaller than the size required by the original signal; this phase is coding. Lastly, in a streaming environment, the raw packets are then structured into a continuous stream of octets; this last phase is streaming. Note that the stream of octets is referred to both as a 'byte-' and 'bit-'stream; the latter usage is acceptible as the stream of octets is a physical representation of a true logical bit-by-bit stream.

A Vorbis decoder performs a mirror image process of extracting the original sequence of raw packets from an Ogg stream (stream decomposition), reconstructing the signal representation from the raw data in the packet (decoding) and them reconstituting an audio signal from the decoded representation (synthesis).

The Programming with libvorbis documents discuss use of the reference Vorbis codec library (libvorbis) produced by the Xiph.org Foundation.

The data representations and algorithms necessary at each step to encode and decode Ogg Vorbis bitstreams are described by the below documents in sufficient detail to construct a complete Vorbis codec. Note that at the time of writing, Vorbis is still in a 'Request For Comments' stage of development; despite being in advanced stages of development, input from the multimedia community is welcome.

### Vorbis analysis and synthesis

Analysis begins by seperating an input audio stream into individual, overlapping short-time segments of audio data. These segments are then transformed into an alternate representation, seeking to represent the original signal in a more efficient form that codes into a smaller number of bytes. The analysis and transformation stage is the most complex element of producing a Vorbis bitstream.

The corresponding synthesis step in the decoder is simpler; there is no analysis to perform, merely a mechanical, deterministic reconstruction of the original audio data from the transform-domain representation.

- Vorbis packet structure: Describes the basic analysis components necessary to produce Vorbis packets and the structure of the packet itself.
- Temporal envelope shaping and blocksize: Use of temporal envelope shaping and variable blocksize to minimize time-domain energy leakage during wide dynamic range and spectral energy swings. Also discusses time-related principles of psychoacoustics.
- Time domain segmentation and MDCT transform: Division of time domain data into individual overlapped, windowed short-time vectors and transformation using the MDCT
- The resolution floor: Use of frequency doamin psychoacoustics, and the MDCT-domain noise, masking and resolution floors
- MDCT-domain fine structure: Production, quantization and massaging of MDCT-spectrum fine structure

### Vorbis coding and decoding

Coding and decoding converts the transform-domain representation of the original audio produced by analysis to and from a bitwise packed raw data packet. Coding and decoding consist of two logically orthogonal concepts, back-end coding and bitpacking.

Back-end coding uses a probability model to represent the raw numbers of the audio representation in as few physical bits as possible; familiar examples of back-end coding include Huffman coding and Vector Quantization.

Bitpacking arranges the variable sized words of the back-end coding into a vector of octets without wasting space. The octets produced by coding a single short-time audio segment is one raw Vorbis packet.

- The Vorbis probability model
- The Vorbis bitpacker: Arrangement of variable bit-length words into an octet-aligned packet.

### Vorbis streaming and stream decomposition

Vorbis packets contain the raw, bitwise-compressed representation of a snippet of audio. These packets contain no structure and cannot be strung together directly into a stream; for streamed transmission and storage, Vorbis packets are encoded into an Ogg bitstream.

- Ogg bitstream overview: High-level description of Ogg logical bitstreams, how logical bitstreams (of mixed media types) can be combined into physical bitstreams, and restrictions on logical-to-physical mapping. Note that this document is not specific only to Ogg Vorbis.
- Ogg logical bitstream and framing spec: Low level, complete specification of Ogg logical bitstream pages. Note that this document is not specific only to Ogg Vorbis.
- Vorbis bitstream mapping: Specifically describes mapping Vorbis data into an Ogg physical bitstream.

Ogg is a Xiph.org Foundation effort to protect essential tenets of Internet multimedia from corporate hostage-taking; Open Source is the net's greatest tool to keep everyone honest. See About the Xiph.org Foundation for details.

Ogg Vorbis is the first Ogg audio CODEC. Anyone may freely use and distribute the Ogg and Vorbis specification, whether in a private, public or corporate capacity. However, the Xiph.org Foundation and the Ogg project (xiph.org) reserve the right to set the Ogg Vorbis specification and certify specification compliance.

Xiph.org's Vorbis software CODEC implementation is distributed under a BSD-like license. This does not restrict third parties from distributing independent implementations of Vorbis software under other licenses.

Ogg, Vorbis, Xiph.org Foundation and their logos are trademarks (tm) of the Xiph.org Foundation. These pages are copyright (C) 1994-2002 Xiph.org Foundation. All rights reserved.