OggOpus: Difference between revisions

From XiphWiki
Jump to navigation Jump to search
(→‎Draft spec: Jean-Marc's design from last night's discussion)
(→‎Draft spec: Consolidate drafts after discussion)
Line 14: Line 14:
=== Draft spec ===
=== Draft spec ===


Ralph's suggestion: Two headers: id, comment
Granulepos is the count of decodeable samples at a fixed rate of 48 kHz.
 
Two headers: id, comment


Id header:
Id header:


  - 8 byte magic signature 'Opus\0\0\0\0'
  - 8 byte magic signature 'OpusHead' (64 bits)
  - <custom mode flags>
- 4 byte Input sample rate (32 bits, max 192 kHz)
- 1 byte channel mapping flags (bool in byte)
- 1 byte channel count (8 bits)
- 2 byte pre-gap (16 bits)
  - <optional channel mapping?>


Comment header:
Comment header:


  - follows the vorbis-comment header design used in OggVorbis, OggTheora, and Speex.
  - 8 byte magic signature 'OpusTags' (64 bits)
- Magic is 'Opus\0\0\001'
- rest follows the vorbis-comment header design used in OggVorbis, OggTheora, and Speex.
 
  ** Vendor string (always present)
Jean-Marc's notes, from IRC:
  ** tag=value metadata strings (zero or more)
 
Header:
  - "OpusHead" (64 bits)
  - Sampling rate (32 bits, max 192)
  - Channel mapping (bool in byte)
  - Channels (8 bits)
  - Pre-gap (16 bits)
Extra:
  - number of streams (8 bits)
  - string of bytes (8 bits)
Comment:
  - "OpusTags"
      - vendor

Revision as of 12:47, 28 July 2011

Ogg mapping for Opus

The IETF Opus codec is a low-latency audio codec optimized for both voice and general-purpose audio. See [tools.ietf.org/html/draft-ietf-codec-opus the spec] for technical details.

Almost everything about this codec is either fixed or dynamically switchable, so the usual id and setup header parameters in the header packets of an Ogg encapsulation aren't useful. In particular, bitrate, frame size, mono/stereo, and coding modes are all dynamically switchable from packet to packet. A one-byte header on each data packet defines the parameters for that particular packet.

Remaining parameters we need to signal are:

  • magic number for stream identification
  • comment/metadata tags

Additionally there's been a desire to support some kind of channel bonding for surround, and some kind of option signalling for "Opus Custom", in particular the granulerate.

Draft spec

Granulepos is the count of decodeable samples at a fixed rate of 48 kHz.

Two headers: id, comment

Id header:

- 8 byte magic signature 'OpusHead' (64 bits)
- 4 byte Input sample rate (32 bits, max 192 kHz)
- 1 byte channel mapping flags (bool in byte)
- 1 byte channel count (8 bits)
- 2 byte pre-gap (16 bits)
- <optional channel mapping?>

Comment header:

- 8 byte magic signature 'OpusTags' (64 bits)
- rest follows the vorbis-comment header design used in OggVorbis, OggTheora, and Speex.
 ** Vendor string (always present)
 ** tag=value metadata strings (zero or more)