Introduction
Opus is an open, royalty-free lossy codec standardised by the IETF in 2012 as RFC 6716, which RFC 8251 updated in 2017 with corrections to the normative decoder. It combines two earlier codecs, SILK for speech and CELT for music, and works well from low-rate voice calls to high-quality music. It is used in WebRTC, Discord, WhatsApp and other voice and video services.
An .opus file is Opus audio in an Ogg container, as defined in
RFC 7845; its media type is audio/ogg, with codecs=opus where a
codec parameter is given (RFC 5334, RFC 7845). The Ogg page layer and
comments are the same as for every Ogg
stream.
Structure
The file is a sequence of Ogg pages, each starting with OggS. The first
packet is the identification header, beginning OpusHead: a version, the
channel count, the pre-skip (samples to drop at the start), the original sample rate,
an output gain and the channel mapping. The second packet, beginning
OpusTags, holds the encoder name and comments such as
TITLE and ARTIST. The audio packets follow. Opus always
decodes at 48 kHz, and the Ogg granule position counts 48 kHz samples whatever the
original rate was.
0OggS page OpusHead identification headervaries…OggS pages OpusTags comment headervaries…OggS pages audio packets, last page flaggedrepeated
Links
Software
- VLC media player – free player for almost any audio or video file (Windows, macOS, Linux, mobile)
- foobar2000 – free music player and converter (Windows, macOS, mobile)
- Audacity – free audio editor that opens and exports Opus (Windows, macOS, Linux)
- opus-tools – the
opusencandopusdeccommand-line encoder and decoder (Windows, macOS, Linux) - FFmpeg – command-line tool that encodes and decodes Opus (Windows, macOS, Linux)
Developers
- libopus – the reference Opus encoder and decoder (C)
- libopusfile – library for reading and seeking in .opus files (C)