1 <?xml version="1.0" encoding="utf-8"?>
2 <!DOCTYPE rfc SYSTEM 'rfc2629.dtd' [
3 <!ENTITY rfc2119 PUBLIC '' 'https://xml2rfc.tools.ietf.org/tools/xml2rfc/public/rfc/bibxml/reference.RFC.2119.xml'>
4 <!ENTITY rfc3533 PUBLIC '' 'https://xml2rfc.tools.ietf.org/tools/xml2rfc/public/rfc/bibxml/reference.RFC.3533.xml'>
5 <!ENTITY rfc3629 PUBLIC '' 'https://xml2rfc.tools.ietf.org/tools/xml2rfc/public/rfc/bibxml/reference.RFC.3629.xml'>
6 <!ENTITY rfc4732 PUBLIC '' 'https://xml2rfc.tools.ietf.org/tools/xml2rfc/public/rfc/bibxml/reference.RFC.4732.xml'>
7 <!ENTITY rfc5334 PUBLIC '' 'https://xml2rfc.tools.ietf.org/tools/xml2rfc/public/rfc/bibxml/reference.RFC.5334.xml'>
8 <!ENTITY rfc6381 PUBLIC '' 'https://xml2rfc.tools.ietf.org/tools/xml2rfc/public/rfc/bibxml/reference.RFC.6381.xml'>
9 <!ENTITY rfc6716 PUBLIC '' 'https://xml2rfc.tools.ietf.org/tools/xml2rfc/public/rfc/bibxml/reference.RFC.6716.xml'>
11 <?rfc toc="yes" symrefs="yes" ?>
13 <rfc ipr="trust200902" category="std" docName="draft-ietf-codec-oggopus-00">
16 <title abbrev="Ogg Opus">Ogg Encapsulation for the Opus Audio Codec</title>
17 <author initials="T.B." surname="Terriberry" fullname="Timothy B. Terriberry">
18 <organization>Mozilla Corporation</organization>
21 <street>650 Castro Street</street>
22 <city>Mountain View</city>
25 <country>USA</country>
27 <phone>+1 650 903-0800</phone>
28 <email>tterribe@xiph.org</email>
32 <author initials="R." surname="Lee" fullname="Ron Lee">
33 <organization>Voicetronix</organization>
36 <street>246 Pulteney Street, Level 1</street>
40 <country>Australia</country>
42 <phone>+61 8 8232 9112</phone>
43 <email>ron@debian.org</email>
47 <author initials="R." surname="Giles" fullname="Ralph Giles">
48 <organization>Mozilla Corporation</organization>
51 <street>163 West Hastings Street</street>
52 <city>Vancouver</city>
55 <country>Canada</country>
57 <phone>+1 604 778 1540</phone>
58 <email>giles@xiph.org</email>
62 <date day="19" month="November" year="2012"/>
64 <workgroup>codec</workgroup>
68 This document defines the Ogg encapsulation for the Opus interactive speech and
70 This allows data encoded in the Opus format to be stored in an Ogg logical
72 Ogg encapsulation provides Opus with a long-term storage format supporting
73 all of the essential features, including metadata, fast and accurate seeking,
74 corruption detection, recapture after errors, low overhead, and the ability to
75 multiplex Opus with other codecs (including video) with minimal buffering.
76 It also provides a live streamable format, capable of delivery over a reliable
77 stream-oriented transport, without requiring all the data, or even the total
78 length of the data, up-front, in a form that is identical to the on-disk
85 <section anchor="intro" title="Introduction">
87 The IETF Opus codec is a low-latency audio codec optimized for both voice and
88 general-purpose audio.
89 See <xref target="RFC6716"/> for technical details.
90 This document defines the encapsulation of Opus in a continuous, logical Ogg
91 bitstream <xref target="RFC3533"/>.
94 Ogg bitstreams are made up of a series of 'pages', each of which contains data
95 from one or more 'packets'.
96 Pages are the fundamental unit of multiplexing in an Ogg stream.
97 Each page is associated with a particular logical stream and contains a capture
98 pattern and checksum, flags to mark the beginning and end of the logical
99 stream, and a 'granule position' that represents an absolute position in the
100 stream, to aid seeking.
101 A single page can contain up to 65,025 octets of packet data from up to 255
103 Packets may be split arbitrarily across pages, and continued from one page to
104 the next (allowing packets much larger than would fit on a single page).
105 Each page contains 'lacing values' that indicate how the data is partitioned
106 into packets, allowing a demuxer to recover the packet boundaries without
107 examining the encoded data.
108 A packet is said to 'complete' on a page when the page contains the final
109 lacing value corresponding to that packet.
112 This encapsulation defines the required contents of the packet data, including
113 the necessary headers, the organization of those packets into a logical
114 stream, and the interpretation of the codec-specific granule position field.
115 It does not attempt to describe or specify the existing Ogg container format.
116 Readers unfamiliar with the basic concepts mentioned above are encouraged to
117 review the details in <xref target="RFC3533"/>.
122 <section anchor="terminology" title="Terminology">
124 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD",
125 "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be
126 interpreted as described in <xref target="RFC2119"/>.
130 Implementations that fail to satisfy one or more "MUST" requirements are
131 considered non-compliant.
132 Implementations that satisfy all "MUST" requirements, but fail to satisfy one
133 or more "SHOULD" requirements are said to be "conditionally compliant".
134 All other implementations are "unconditionally compliant".
139 <section anchor="packet_organization" title="Packet Organization">
141 An Opus stream is organized as follows.
144 There are two mandatory header packets.
145 The granule position of the pages on which these packets complete MUST be zero.
148 The first packet in the logical Ogg bitstream MUST contain the identification
149 (ID) header, which uniquely identifies a stream as Opus audio.
150 The format of this header is defined in <xref target="id_header"/>.
151 It MUST be placed alone (without any other packet data) on the first page of
152 the logical Ogg bitstream, and must complete on that page.
153 This page MUST have its 'beginning of stream' flag set.
156 The second packet in the logical Ogg bitstream MUST contain the comment header,
157 which contains user-supplied metadata.
158 The format of this header is defined in <xref target="comment_header"/>.
159 It MAY span one or more pages, beginning on the second page of the logical
161 However many pages it spans, the comment header packet MUST finish the page on
165 All subsequent pages are audio data pages, and the Ogg packets they contain are
167 Each audio data packet contains one Opus packet for each of N different
168 streams, where N is typically one for mono or stereo, but may be greater than
169 one for, e.g., multichannel audio.
170 The value N is specified in the ID header (see
171 <xref target="channel_mapping"/>), and is fixed over the entire length of the
172 logical Ogg bitstream.
175 The first N-1 Opus packets, if any, are packed one after another into the Ogg
176 packet, using the self-delimiting framing from Appendix B of
177 <xref target="RFC6716"/>.
178 The remaining Opus packet is packed at the end of the Ogg packet using the
179 regular, undelimited framing from Section 3 of <xref target="RFC6716"/>.
180 All of the Opus packets in a single Ogg packet MUST be constrained to have the
182 The duration and coding modes of each Opus packet are contained in the
183 TOC (table of contents) sequence in the first few bytes.
184 A decoder SHOULD treat any Opus packet whose duration is different from that of
185 the first Opus packet in an Ogg packet as if it were an Opus packet with an
186 illegal TOC sequence.
189 The first audio data page SHOULD NOT have the 'continued packet' flag set
190 (which would indicate the first audio data packet is continued from a previous
192 Packets MUST be placed into Ogg pages in order until the end of stream.
193 Audio packets MAY span page boundaries.
194 A decoder MUST treat a zero-octet audio data packet as if it were an Opus
195 packet with an illegal TOC sequence.
196 The last page SHOULD have the 'end of stream' flag set, but implementations
197 should be prepared to deal with truncated streams that do not have a page
198 marked 'end of stream'.
199 The final packet on the last page SHOULD NOT be a continued packet, i.e., the
200 final lacing value should be less than 255.
201 There MUST NOT be any more pages in an Opus logical bitstream after a page
202 marked 'end of stream'.
206 <section anchor="granpos" title="Granule Position">
208 The granule position of an audio data page encodes the total number of PCM
209 samples in the stream up to and including the last fully-decodable sample from
210 the last packet completed on that page.
211 A page that is entirely spanned by a single packet (that completes on a
212 subsequent page) has no granule position, and the granule position field MUST
213 be set to the special value '-1' in two's complement.
217 The granule position of an audio data page is in units of PCM audio samples at
218 a fixed rate of 48 kHz (per channel; a stereo stream's granule position
219 does not increment at twice the speed of a mono stream).
220 It is possible to run an Opus decoder at other sampling rates, but the value
221 in the granule position field always counts samples assuming a 48 kHz
222 decoding rate, and the rest of this specification makes the same assumption.
226 The duration of an Opus packet may be any multiple of 2.5 ms, up to a
227 maximum of 120 ms.
228 This duration is encoded in the TOC sequence at the beginning of each packet.
229 The number of samples returned by a decoder corresponds to this duration
230 exactly, even for the first few packets.
231 For example, a 20 ms packet fed to a decoder running at 48 kHz will
232 always return 960 samples.
233 A demuxer can parse the TOC sequence at the beginning of each Ogg packet to
234 work backwards or forwards from a packet with a known granule position (i.e.,
235 the last packet completed on some page) in order to assign granule positions
236 to every packet, or even every individual sample.
237 The one exception is the last page in the stream, as described below.
241 All other pages with completed packets after the first MUST have a granule
242 position equal to the number of samples contained in packets that complete on
243 that page plus the granule position of the most recent page with completed
245 This guarantees that a demuxer can assign individual packets the same granule
246 position when working forwards as when working backwards.
247 For this to work, there cannot be any gaps.
248 In order to support capturing a stream that uses discontinuous transmission
249 (DTX), an encoder SHOULD emit packets that explicitly request the use of
250 Packet Loss Concealment (PLC) (i.e., with a frame length of 0, as defined in
251 Section 3.2.1 of <xref target="RFC6716"/>) in place of the packets that were
255 <section anchor="preskip" title="Pre-skip">
257 There is some amount of latency introduced during the decoding process, to
258 allow for overlap in the MDCT modes, stereo mixing in the LP modes, and
259 resampling, and the encoder will introduce even more latency (though the exact
260 amount is not specified).
261 Therefore, the first few samples produced by the decoder do not correspond to
262 real input audio, but are instead composed of padding inserted by the encoder
263 to compensate for this latency.
264 These samples need to be stored and decoded, as Opus is an asymptotically
265 convergent predictive codec, meaning the decoded contents of each frame depend
266 on the recent history of decoder inputs.
267 However, a decoder will want to skip these samples after decoding them.
271 A 'pre-skip' field in the ID header (see <xref target="id_header"/>) signals
272 the number of samples which SHOULD be skipped (decoded but discarded) at the
273 beginning of the stream.
274 This provides sufficient history to the decoder so that it has already
275 converged before the stream's output begins.
276 It may also be used to perform sample-accurate cropping of existing encoded
278 This amount need not be a multiple of 2.5 ms, may be smaller than a single
279 packet, or may span the contents of several packets.
283 <section anchor="pcm_sample_position" title="PCM Sample Position">
285 The PCM sample position is determined from the granule position using the
287 <figure align="center">
288 <artwork align="center"><![CDATA[
289 'PCM sample position' = 'granule position' - 'pre-skip' .
295 For example, if the granule position of the first audio data page is 59,971,
296 and the pre-skip is 11,971, then the PCM sample position of the last decoded
297 sample from that page is 48,000.
298 This can be converted into a playback time using the formula
299 <figure align="center">
300 <artwork align="center"><![CDATA[
301 'PCM sample position'
302 'playback time' = --------------------- .
309 The initial PCM sample position before any samples are played is normally '0'.
310 In this case, the PCM sample position of the first audio sample to be played
311 starts at '1', because it marks the time on the clock
312 <spanx style="emph">after</spanx> that sample has been played, and a stream
313 that is exactly one second long has a final PCM sample position of '48000',
314 as in the example here.
318 Vorbis streams use a granule position smaller than the number of audio samples
319 contained in the first audio data page to indicate that some of those samples
320 must be trimmed from the output (see <xref target="vorbis-trim"/>).
321 However, to do so, Vorbis requires that the first audio data page contains
322 exactly two packets, in order to allow the decoder to perform PCM position
323 adjustments before needing to return any PCM data.
324 Opus uses the pre-skip mechanism for this purpose instead, since the encoder
325 may introduce more than a single packet's worth of latency, and since very
326 large packets in streams with a very large number of channels might not fit
331 <section anchor="end_trimming" title="End Trimming">
333 The page with the 'end of stream' flag set MAY have a granule position that
334 indicates the page contains less audio data than would normally be returned by
335 decoding up through the final packet.
336 This is used to end the stream somewhere other than an even frame boundary.
337 The granule position of the most recent audio data page with completed packets
338 is used to make this determination, or '0' is used if there were no previous
339 audio data pages with a completed packet.
340 The difference between these granule positions indicates how many samples to
341 keep after decoding the packets that completed on the final page.
342 The remaining samples are discarded.
343 The number of discarded samples SHOULD be no larger than the number decoded
344 from the last packet.
348 <section anchor="start_granpos_restrictions"
349 title="Restrictions on the Initial Granule Position">
351 The granule position of the first audio data page with a completed packet MAY
352 be larger than the number of samples contained in packets that complete on
353 that page, however it MUST NOT be smaller, unless that page has the 'end of
355 Allowing a granule position larger than the number of samples allows the
356 beginning of a stream to be cropped or a live stream to be joined without
357 rewriting the granule position of all the remaining pages.
358 This means that the PCM sample position just before the first sample to be
359 played may be larger than '0'.
360 Synchronization when multiplexing with other logical streams still uses the PCM
361 sample position relative to '0' to compute sample times.
362 This does not affect the behavior of pre-skip: exactly 'pre-skip' samples
363 should be skipped from the beginning of the decoded output, even if the
364 initial PCM sample position is greater than zero.
368 On the other hand, a granule position that is smaller than the number of
369 decoded samples prevents a demuxer from working backwards to assign each
370 packet or each individual sample a valid granule position, since granule
371 positions must be non-negative.
372 A decoder MUST reject as invalid any stream where the granule position is
373 smaller than the number of samples contained in packets that complete on the
374 first audio data page with a completed packet, unless that page has the 'end
376 It MAY defer this action until it decodes the last packet completed on that
381 If that page has the 'end of stream' flag set, a demuxer MUST reject as invalid
382 any stream where its granule position is smaller than the 'pre-skip' amount.
383 This would indicate that more samples should be skipped from the initial
384 decoded output than exist in the stream.
385 If the granule position is smaller than the number of decoded samples produced
386 by the packets that complete on that page, then a demuxer MUST use an initial
387 granule position of '0', and can work forwards from '0' to timestamp
389 If the granule position is larger than the number of decoded samples available,
390 then the demuxer MUST still work backwards as described above, even if the
391 'end of stream' flag is set, to determine the initial granule position, and
392 thus the initial PCM sample position.
393 Both of these will be greater than '0' in this case.
397 <section anchor="seeking_and_preroll" title="Seeking and Pre-roll">
399 Seeking in Ogg files is best performed using a bisection search for a page
400 whose granule position corresponds to a PCM position at or before the seek
402 With appropriately weighted bisection, accurate seeking can be performed with
403 just three or four bisections even in multi-gigabyte files.
404 See <xref target="seeking"/> for general implementation guidance.
408 When seeking within an Ogg Opus stream, the decoder SHOULD start decoding (and
409 discarding the output) at least 3840 samples (80 ms) prior to the
410 seek target in order to ensure that the output audio is correct by the time it
411 reaches the seek target.
412 This 'pre-roll' is separate from, and unrelated to, the 'pre-skip' used at the
413 beginning of the stream.
414 If the point 80 ms prior to the seek target comes before the initial PCM
415 sample position, the decoder SHOULD start decoding from the beginning of the
416 stream, applying pre-skip as normal, regardless of whether the pre-skip is
417 larger or smaller than 80 ms, and then continue to discard the samples
418 required to reach the seek target (if any).
424 <section anchor="headers" title="Header Packets">
426 An Opus stream contains exactly two mandatory header packets:
427 an identification header and a comment header.
430 <section anchor="id_header" title="Identification Header">
432 <figure anchor="id_header_packet" title="ID Header Packet" align="center">
433 <artwork align="center"><![CDATA[
435 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
436 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
437 | 'O' | 'p' | 'u' | 's' |
438 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
439 | 'H' | 'e' | 'a' | 'd' |
440 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
441 | Version = 1 | Channel Count | Pre-skip |
442 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
443 | Input Sample Rate (Hz) |
444 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
445 | Output Gain (Q7.8 in dB) | Mapping Family| |
446 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ :
448 : Optional Channel Mapping Table... :
450 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
455 The fields in the identification (ID) header have the following meaning:
456 <list style="numbers">
457 <t><spanx style="strong">Magic Signature</spanx>:
458 <vspace blankLines="1"/>
459 This is an 8-octet (64-bit) field that allows codec identification and is
461 It contains, in order, the magic numbers:
472 Starting with "Op" helps distinguish it from audio data packets, as this is an
473 invalid TOC sequence.
474 <vspace blankLines="1"/>
476 <t><spanx style="strong">Version</spanx> (8 bits, unsigned):
477 <vspace blankLines="1"/>
478 The version number MUST always be '1' for this version of the encapsulation
480 Implementations SHOULD treat streams where the upper four bits of the version
481 number match that of a recognized specification as backwards-compatible with
483 That is, the version number can be split into "major" and "minor" version
484 sub-fields, with changes to the "minor" sub-field (in the lower four bits)
485 signaling compatible changes.
486 For example, a decoder implementing this specification SHOULD accept any stream
487 with a version number of '15' or less, and SHOULD assume any stream with a
488 version number '16' or greater is incompatible.
489 The initial version '1' was chosen to keep implementations from relying on this
490 octet as a null terminator for the "OpusHead" string.
491 <vspace blankLines="1"/>
493 <t><spanx style="strong">Output Channel Count</spanx> 'C' (8 bits, unsigned):
494 <vspace blankLines="1"/>
495 This is the number of output channels.
496 This might be different than the number of encoded channels, which can change
497 on a packet-by-packet basis.
498 This value MUST NOT be zero.
499 The maximum allowable value depends on the channel mapping family, and might be
501 See <xref target="channel_mapping"/> for details.
502 <vspace blankLines="1"/>
504 <t><spanx style="strong">Pre-skip</spanx> (16 bits, unsigned, little
506 <vspace blankLines="1"/>
507 This is the number of samples (at 48 kHz) to discard from the decoder
508 output when starting playback, and also the number to subtract from a page's
509 granule position to calculate its PCM sample position.
510 When cropping the beginning of existing Ogg Opus streams, a pre-skip of at
511 least 3,840 samples (80 ms) is RECOMMENDED to ensure complete
512 convergence in the decoder.
513 <vspace blankLines="1"/>
515 <t><spanx style="strong">Input Sample Rate</spanx> (32 bits, unsigned, little
517 <vspace blankLines="1"/>
518 This field is <spanx style="emph">not</spanx> the sample rate to use for
519 playback of the encoded data.
520 <vspace blankLines="1"/>
521 Opus has a handful of coding modes, with internal audio bandwidths of 4, 6, 8,
523 Each packet in the stream may have a different audio bandwidth.
524 Regardless of the audio bandwidth, the reference decoder supports decoding any
525 stream at a sample rate of 8, 12, 16, 24, or 48 kHz.
526 The original sample rate of the encoder input is not preserved by the lossy
528 <vspace blankLines="1"/>
529 An Ogg Opus player SHOULD select the playback sample rate according to the
531 <list style="numbers">
532 <t>If the hardware supports 48 kHz playback, decode at 48 kHz.</t>
533 <t>Otherwise, if the hardware's highest available sample rate is a supported
534 rate, decode at this sample rate.</t>
535 <t>Otherwise, if the hardware's highest available sample rate is less than
536 48 kHz, decode at the highest supported rate above this and resample.</t>
537 <t>Otherwise, decode at 48 kHz and resample.</t>
539 However, the 'Input Sample Rate' field allows the encoder to pass the sample
540 rate of the original input stream as metadata.
541 This may be useful when the user requires the output sample rate to match the
543 For example, a non-player decoder writing PCM format samples to disk might
544 choose to resample the output audio back to the original input sample rate to
545 reduce surprise to the user, who might reasonably expect to get back a file
546 with the same sample rate as the one they fed to the encoder.
547 <vspace blankLines="1"/>
548 A value of zero indicates 'unspecified'.
549 Encoders SHOULD write the actual input sample rate or zero, but decoder
550 implementations which do something with this field SHOULD take care to behave
551 sanely if given crazy values (e.g., do not actually upsample the output to
552 10 MHz if requested).
553 <vspace blankLines="1"/>
555 <t><spanx style="strong">Output Gain</spanx> (16 bits, signed, little
557 <vspace blankLines="1"/>
558 This is a gain to be applied by the decoder.
559 It is 20*log10 of the factor to scale the decoder output by to achieve the
560 desired playback volume, stored in a 16-bit, signed, two's complement
561 fixed-point value with 8 fractional bits (i.e., Q7.8).
562 To apply the gain, a decoder could use
563 <figure align="center">
564 <artwork align="center"><![CDATA[
565 sample *= pow(10, output_gain/(20.0*256)) ,
568 where output_gain is the raw 16-bit value from the header.
569 <vspace blankLines="1"/>
570 Virtually all players and media frameworks should apply it by default.
571 If a player chooses to apply any volume adjustment or gain modification, such
572 as the R128_TRACK_GAIN (see <xref target="comment_header"/>) or a user-facing
573 volume knob, the adjustment MUST be applied in addition to this output gain in
574 order to achieve playback at the desired volume.
575 <vspace blankLines="1"/>
576 An encoder SHOULD set this field to zero, and instead apply any gain prior to
577 encoding, when this is possible and does not conflict with the user's wishes.
578 The output gain should only be nonzero when the gain is adjusted after
579 encoding, or when the user wishes to adjust the gain for playback while
580 preserving the ability to recover the original signal amplitude.
581 <vspace blankLines="1"/>
582 Although the output gain has enormous range (+/- 128 dB, enough to amplify
583 inaudible sounds to the threshold of physical pain), most applications can
584 only reasonably use a small portion of this range around zero.
585 The large range serves in part to ensure that gain can always be losslessly
586 transferred between OpusHead and R128_TRACK_GAIN (see below) without
588 <vspace blankLines="1"/>
590 <t><spanx style="strong">Channel Mapping Family</spanx> (8 bits,
592 <vspace blankLines="1"/>
593 This octet indicates the order and semantic meaning of the various channels
594 encoded in each Ogg packet.
595 <vspace blankLines="1"/>
596 Each possible value of this octet indicates a mapping family, which defines a
597 set of allowed channel counts, and the ordered set of channel names for each
598 allowed channel count.
599 The details are described in <xref target="channel_mapping"/>.
601 <t><spanx style="strong">Channel Mapping Table</spanx>:
602 This table defines the mapping from encoded streams to output channels.
603 It is omitted when the channel mapping family is 0, but REQUIRED otherwise.
604 Its contents are specified in <xref target="channel_mapping"/>.
610 All fields in the ID headers are REQUIRED, except for the channel mapping
611 table, which is omitted when the channel mapping family is 0.
612 Implementations SHOULD reject ID headers which do not contain enough data for
613 these fields, even if they contain a valid Magic Signature.
614 Future versions of this specification, even backwards-compatible versions,
615 might include additional fields in the ID header.
616 If an ID header has a compatible major version, but a larger minor version,
617 an implementation MUST NOT reject it for containing additional data not
619 However, implementations MAY reject streams in which the ID header does not
620 complete on the first page.
623 <section anchor="channel_mapping" title="Channel Mapping">
625 An Ogg Opus stream allows mapping one number of Opus streams (N) to a possibly
626 larger number of decoded channels (M+N) to yet another number of output
627 channels (C), which might be larger or smaller than the number of decoded
629 The order and meaning of these channels are defined by a channel mapping,
630 which consists of the 'channel mapping family' octet and, for channel mapping
631 families other than family 0, a channel mapping table, as illustrated in
632 <xref target="channel_mapping_table"/>.
635 <figure anchor="channel_mapping_table" title="Channel Mapping Table"
637 <artwork align="center"><![CDATA[
639 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
642 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
643 | Coupled Count | Channel Mapping... :
644 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
649 The fields in the channel mapping table have the following meaning:
650 <list style="numbers" counter="8">
651 <t><spanx style="strong">Stream Count</spanx> 'N' (8 bits, unsigned):
652 <vspace blankLines="1"/>
653 This is the total number of streams encoded in each Ogg packet.
654 This value is required to correctly parse the packed Opus packets inside an
655 Ogg packet, as described in <xref target="packet_organization"/>.
656 This value MUST NOT be zero, as without at least one Opus packet with a valid
657 TOC sequence, a demuxer cannot recover the duration of an Ogg packet.
658 <vspace blankLines="1"/>
659 For channel mapping family 0, this value defaults to 1, and is not coded.
660 <vspace blankLines="1"/>
662 <t><spanx style="strong">Coupled Stream Count</spanx> 'M' (8 bits, unsigned):
663 This is the number of streams whose decoders should be configured to produce
665 This MUST be no larger than the total number of streams, N.
666 <vspace blankLines="1"/>
667 Each packet in an Opus stream has an internal channel count of 1 or 2, which
668 can change from packet to packet.
669 This is selected by the encoder depending on the bitrate and the audio being
671 The original channel count of the encoder input is not preserved by the lossy
673 <vspace blankLines="1"/>
674 Regardless of the internal channel count, any Opus stream can be decoded as
675 mono (a single channel) or stereo (two channels) by appropriate initialization
677 The 'coupled stream count' field indicates that the first M Opus decoders are
678 to be initialized in stereo mode, and the remaining N-M decoders are to be
679 initialized in mono mode.
680 The total number of decoded channels, (M+N), MUST be no larger than 255, as
681 there is no way to index more channels than that in the channel mapping.
682 <vspace blankLines="1"/>
683 For channel mapping family 0, this value defaults to C-1 (i.e., 0 for mono
684 and 1 for stereo), and is not coded.
685 <vspace blankLines="1"/>
687 <t><spanx style="strong">Channel Mapping</spanx> (8*C bits):
688 This contains one octet per output channel, indicating which decoded channel
689 should be used for each one.
690 Let 'index' be the value of this octet for a particular output channel.
691 This value MUST either be smaller than (M+N), or be the special value 255.
692 If 'index' is less than 2*M, the output MUST be taken from decoding stream
693 ('index'/2) as stereo and selecting the left channel if 'index' is even, and
694 the right channel if 'index' is odd.
695 If 'index' is 2*M or larger, the output MUST be taken from decoding stream
697 If 'index' is 255, the corresponding output channel MUST contain pure silence.
698 <vspace blankLines="1"/>
699 The number of output channels, C, is not constrained to match the number of
700 decoded channels (M+N).
701 A single index value MAY appear multiple times, i.e., the same decoded channel
702 might be mapped to multiple output channels.
703 Some decoded channels might not be assigned to any output channel, as well.
704 <vspace blankLines="1"/>
705 For channel mapping family 0, the first index defaults to 0, and if C==2,
706 the second index defaults to 1.
707 Neither index is coded.
713 After producing the output channels, the channel mapping family determines the
714 semantic meaning of each one.
715 Currently there are three defined mapping families, although more may be added:
716 <list style="symbols">
717 <t>Family 0 (RTP mapping):
718 <vspace blankLines="1"/>
719 Allowed numbers of channels: 1 or 2.
720 <list style="symbols">
721 <t>1 channel: monophonic (mono).</t>
722 <t>2 channels: stereo (left, right).</t>
724 <spanx style="strong">Special mapping</spanx>: This channel mapping value also
725 indicates that the contents consists of a single Opus stream that is stereo if
726 and only if C==2, with stream index 0 mapped to output channel 0 (mono, or
727 left channel) and stream index 1 mapped to output channel 1 (right channel)
729 When the 'channel mapping family' octet has this value, the channel mapping
730 table MUST be omitted from the ID header packet.
731 <vspace blankLines="1"/>
733 <t>Family 1 (Vorbis channel order):
734 <vspace blankLines="1"/>
735 Allowed numbers of channels: 1...8.
737 Each channel is assigned to a speaker location in a conventional surround
739 Specific locations depend on the number of channels, and are given below
740 in order of the corresponding channel indicies.
741 <list style="symbols">
742 <t>1 channel: monophonic (mono).</t>
743 <t>2 channels: stereo (left, right).</t>
744 <t>3 channels: linear surround (left, center, right)</t>
745 <t>4 channels: quadraphonic (front left, front right, rear left, rear right).</t>
746 <t>5 channels: 5.0 surround (front left, front center, front right, rear left, rear right).</t>
747 <t>6 channels: 5.1 surround (front left, front center, front right, rear left, rear right, LFE).</t>
748 <t>7 channels: 6.1 surround (front left, front center, front right, side left, side right, rear center, LFE).</t>
749 <t>8 channels: 7.1 surround (front left, front center, front right, side left, side right, rear left, rear right, LFE)</t>
751 This set of surround configurations and speaker location orderings is the same
752 as the one used by the Vorbis codec. <xref target="vorbis-mapping"/>
753 The ordering is different from the one used by the
754 WAVE <xref target="wave-multichannel"/> and
755 FLAC <xref target="flac"/> formats,
756 although the configurations match, so correct ordering requires permutation
757 of the output channels when encoding from or decoding to those formats.
758 'LFE' here refers to a Low Frequency Effects, often mapped to a subwoofer
759 with no particular spacial position.
760 Implementations SHOULD identify 'side' or 'rear' speaker locations with
761 'surround' and 'back' as appropriate when interfacing with audio formats
762 or systems which prefer that terminology.
763 <vspace blankLines="1"/>
765 <t>Family 255 (no defined channel meaning):
766 <vspace blankLines="1"/>
767 Allowed numbers of channels: 1...255.<vspace/>
768 Channels are unidentified.
769 General-purpose players SHOULD NOT attempt to play these streams, and offline
770 decoders MAY deinterleave the output into separate PCM files, one per channel.
771 Decoders SHOULD NOT produce output for channels mapped to stream index 255
772 (pure silence) unless they have no other way to indicate the index of
776 The remaining channel mapping families (2...254) are reserved.
777 A decoder encountering a reserved channel mapping family value SHOULD act as
778 though the value is 255.
779 <vspace blankLines="1"/>
780 An Ogg Opus player MUST play any Ogg Opus stream with a channel mapping family
781 of 0 or 1, even if the number of channels does not match the physically
782 connected audio hardware.
783 Players SHOULD perform channel mixing to increase or reduce the number of
791 <section anchor="comment_header" title="Comment Header">
793 <figure anchor="comment_header_packet" title="Comment Header Packet"
795 <artwork align="center"><![CDATA[
797 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
798 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
799 | 'O' | 'p' | 'u' | 's' |
800 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
801 | 'T' | 'a' | 'g' | 's' |
802 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
803 | Vendor String Length |
804 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
808 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
809 | User Comment List Length |
810 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
811 | User Comment #0 String Length |
812 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
814 : User Comment #0 String... :
816 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
817 | User Comment #1 String Length |
818 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
824 The comment header consists of a 64-bit magic signature, followed by data in
825 the same format as the <xref target="vorbis-comment"/> header used in Ogg
826 Vorbis (without the final "framing bit"), Ogg Theora, and Speex.
827 <list style="numbers">
828 <t><spanx style="strong">Magic Signature</spanx>:
829 <vspace blankLines="1"/>
830 This is an 8-octet (64-bit) field that allows codec identification and is
832 It contains, in order, the magic numbers:
843 Starting with "Op" helps distinguish it from audio data packets, as this is an
844 invalid TOC sequence.
845 <vspace blankLines="1"/>
847 <t><spanx style="strong">Vendor String Length</spanx> (32 bits, unsigned,
849 <vspace blankLines="1"/>
850 This field gives the length of the following vendor string, in octets.
851 It MUST NOT indicate that the vendor string is longer than the rest of the
853 <vspace blankLines="1"/>
855 <t><spanx style="strong">Vendor String</spanx> (variable length, UTF-8 vector):
856 <vspace blankLines="1"/>
857 This is a simple human-readable tag for vendor information, encoded as a UTF-8
858 string <xref target="RFC3629"/>.
859 No terminating null octet is required.
860 <vspace blankLines="1"/>
861 This tag is intended to identify the codec encoder and encapsulation
862 implementations, for tracing differences in technical behavior.
863 User-facing encoding applications can use the 'ENCODER' user comment tag
864 to identify themselves.
865 <vspace blankLines="1"/>
867 <t><spanx style="strong">User Comment List Length</spanx> (32 bits, unsigned,
869 <vspace blankLines="1"/>
870 This field indicates the number of user-supplied comments.
871 It MAY indicate there are zero user-supplied comments, in which case there are
872 no additional fields in the packet.
873 It MUST NOT indicate that there are so many comments that the comment string
874 lengths would require more data than is available in the rest of the packet.
875 <vspace blankLines="1"/>
877 <t><spanx style="strong">User Comment #i String Length</spanx> (32 bits,
878 unsigned, little endian):
879 <vspace blankLines="1"/>
880 This field gives the length of the following user comment string, in octets.
881 There is one for each user comment indicated by the 'user comment list length'
883 It MUST NOT indicate that the string is longer than the rest of the packet.
884 <vspace blankLines="1"/>
886 <t><spanx style="strong">User Comment #i String</spanx> (variable length, UTF-8
888 <vspace blankLines="1"/>
889 This field contains a single user comment string.
890 There is one for each user comment indicated by the 'user comment list length'
897 The vendor string length and user comment list length are REQUIRED, and
898 implementations SHOULD reject comment headers that do not contain enough data
899 for these fields, or that do not contain enough data for the corresponding
900 vendor string or user comments they describe.
901 Making this check before allocating the associated memory to contain the data
902 may help prevent a possible Denial-of-Service (DoS) attack from small comment
903 headers that claim to contain strings longer than the entire packet or more
904 user comments than than could possibly fit in the packet.
908 The user comment strings follow the NAME=value format described by
909 <xref target="vorbis-comment"/> with the same recommended tag names.
910 One new comment tag is introduced for Ogg Opus:
911 <figure align="center">
912 <artwork align="left"><![CDATA[
916 representing the volume shift needed to normalize the track's volume.
917 The gain is a Q7.8 fixed point number in dB, as in the ID header's 'output
919 This tag is similar to the REPLAYGAIN_TRACK_GAIN tag in
920 Vorbis <xref target="replay-gain"/>, except that the normal volume
921 reference is the <xref target="EBU-R128"/> standard.
924 An Ogg Opus file MUST NOT have more than one such tag, and if present its
925 value MUST be an integer from -32768 to 32767, inclusive, represented in
926 ASCII with no whitespace.
927 If present, it MUST correctly represent the R128 normalization gain relative
928 to the 'output gain' field specified in the ID header.
929 If a player chooses to make use of the R128_TRACK_GAIN tag, it MUST be
930 applied <spanx style="emph">in addition</spanx> to the 'output gain' value.
931 If an encoder wishes to use R128 normalization, and the output gain is not
932 otherwise constrained or specified, the encoder SHOULD write the R128 gain
933 into the 'output gain' field and store a tag containing "R128_TRACK_GAIN=0".
934 That is, it should assume that by default tools will respect the 'output gain'
935 field, and not the comment tag.
936 If a tool modifies the ID header's 'output gain' field, it MUST also update or
937 remove the R128_TRACK_GAIN comment tag.
940 To avoid confusion with multiple normalization schemes, an Opus comment header
941 SHOULD NOT contain any of the REPLAYGAIN_TRACK_GAIN, REPLAYGAIN_TRACK_PEAK,
942 REPLAYGAIN_ALBUM_GAIN, or REPLAYGAIN_ALBUM_PEAK tags.
945 There is no Opus comment tag corresponding to REPLAYGAIN_ALBUM_GAIN.
946 That information should instead be stored in the ID header's 'output gain'
953 <section anchor="packet_size_limits" title="Packet Size Limits">
955 Technically valid Opus packets can be arbitrarily large due to the padding
956 format, although the amount of non-padding data they can contain is bounded.
957 These packets might be spread over a similarly enormous number of Ogg pages.
958 Encoders SHOULD use no more padding than required to make a variable bitrate
959 (VBR) stream constant bitrate (CBR).
960 Decoders SHOULD avoid attempting to allocate excessive amounts of memory when
961 presented with a very large packet.
962 The presence of an extremely large packet in the stream could indicate a
963 memory exhaustion attack or stream corruption.
964 Decoders SHOULD reject a packet that is too large to process, and display a
968 In an Ogg Opus stream, the largest possible valid packet that does not use
969 padding has a size of (61,298*N - 2) octets, or about 60 kB per
971 With 255 streams, this is 15,630,988 octets (14.9 MB) and can
972 span up to 61,298 Ogg pages, all but one of which will have a granule
974 This is of course a very extreme packet, consisting of 255 streams, each
975 containing 120 ms of audio encoded as 2.5 ms frames, each frame
976 using the maximum possible number of octets (1275) and stored in the least
977 efficient manner allowed (a VBR code 3 Opus packet).
978 Even in such a packet, most of the data will be zeros as 2.5 ms frames
979 cannot actually use all 1275 octets.
980 The largest packet consisting of entirely useful data is
981 (15,326*N - 2) octets, or about 15 kB per stream.
982 This corresponds to 120 ms of audio encoded as 10 ms frames in either
983 LP or Hybrid mode, but at a data rate of over 1 Mbps, which makes little
984 sense for the quality achieved.
985 A more reasonable limit is (7,664*N - 2) octets, or about 7.5 kB
987 This corresponds to 120 ms of audio encoded as 20 ms stereo MDCT-mode
988 frames, with a total bitrate just under 511 kbps (not counting the Ogg
989 encapsulation overhead).
990 With N=8, the maximum number of channels currently defined by mapping
991 family 1, this gives a maximum packet size of 61,310 octets, or just
993 This is still quite conservative, as it assumes each output channel is taken
994 from one decoded channel of a stereo packet.
995 An implementation could reasonably choose any of these numbers for its internal
1000 <section anchor="implementation" title="Implementation Status">
1002 What follows is a brief summary of major implementations of this
1003 draft, and their status.
1004 Note that this section should be removed before final publication
1005 as an RFC as per <xref target="draft-sheffer-running-code"/>.
1008 <section anchor="impl-opus-tools" title="opus-tools">
1010 The initial development implementation of this draft was in the
1011 opusenc, opusdec, and opusinfo command-line utilties, part of the
1012 opus-tools package and repository.
1013 While still 'development' status (pre-1.0) these utilities are
1014 in active public use, and have shipped with some recent Linux
1015 distributions and in homebrew.
1016 Together they implement basic read, write and playback support of
1017 Ogg Opus files including metadata, multichannel, start and end
1018 trimming, the gain field, live streams, and chained files, but currently do
1019 not support seeking.
1020 This implementation is open source.
1022 <t><list style="symbols">
1023 <t><eref target="https://git.xiph.org/?p=opus-tools.git"/></t>
1024 <t><eref target="http://www.opus-codec.org/downloads/"/></t>
1028 <section anchor="impl-opusfile" title="opusfile">
1030 The opusfile library is a separate implementation of this draft as a helper
1031 library for demuxing and decoding.
1032 Like opus-tools, it supports metadata, multichannel, start and end trimming,
1033 the gain field, live streams, and chained files.
1034 Its primary focus is efficient seeking, including over HTTP(S) and in chained
1036 It currently does not create Ogg Opus files.
1037 This library is in early development and is not widely deployed, though several
1038 projects are currently using it, including xmms2, taglib, and cmus, and it is
1039 shipped in some Linux distributions and in homebrew.
1040 This implementation is open source.
1042 <t><list style="symbols">
1043 <t><eref target="https://git.xiph.org/?p=opusfile.git"/></t>
1044 <t><eref target="http://www.opus-codec.org/downloads/"/></t>
1048 <section anchor="impl-firefox" title="Firefox">
1050 The Firefox web browser is a widely deployed implementation of
1052 Basic playback support with the HTML5 <audio> element, including start
1053 and end trimming, the gain field, live streams, multiplexing with other
1054 streams (for, e.g., the <video> tag), and seeking, was added in
1055 Firefox 15, in production release starting August 28, 2012.
1056 Multichannel support was added in Firefox 17, in production release
1057 starting November 20, 2012.
1058 Metadata support was added in Firefox 18, in production release starting
1060 Chained files (as streams only, with seeking disabled) will be supported in
1061 Firefox 20, scheduled to enter production release in early April, 2013.
1062 This implementation is open source.
1064 <t><list style="symbols">
1065 <t><eref target="https://mozilla.org/firefox/"/></t>
1066 <t><eref target="https://hacks.mozilla.org/2012/08/opus-support-for-webrtc/"/></t>
1067 <t><eref target="https://bugzilla.mozilla.org/show_bug.cgi?id=674225"/></t>
1068 <t><eref target="https://bugzilla.mozilla.org/show_bug.cgi?id=748144"/></t>
1069 <t><eref target="https://bugzilla.mozilla.org/show_bug.cgi?id=778050"/></t>
1070 <t><eref target="https://bugzilla.mozilla.org/show_bug.cgi?id=455165"/></t>
1074 <section anchor="impl-chrome" title="Chrome">
1076 Google's Chrome web browser has support for this draft with the
1077 HTML5 <audio> element in M25 and M26, the dev and
1078 canary channels respectively as of January, 2013.
1079 This implementation currently does not support end trimming, the gain tag,
1080 chained files, or the .opus extension.
1081 Both M25 and M26 require passing --enable-opus-playback to the executable
1082 to enable support at the time of this writing.
1083 This implementation is based on open source code in
1084 Chromium and WebKit.
1086 <t><list style="symbols">
1087 <t><eref target="https://www.google.com/intl/en/chrome/browser/"/></t>
1088 <t><eref target="https://www.google.com/intl/en/chrome/browser/canary.html"/></t>
1089 <t><eref target="http://code.google.com/p/chromium/issues/detail?id=104241"/></t>
1093 <section anchor="impl-gstreamer" title="GStreamer">
1095 The GStreamer media framework includes an implementation of
1097 It supports metadata, multichannel, start and end trimming, the gain field,
1098 live streams, chained files, multiplexing with other streams (e.g., video),
1100 Support was first added in early 2011, and is part of the 0.11 and 1.0.x
1102 The code implementing this draft is in the gst-plugins-bad collection,
1103 which generally indicates unsupported and/or experimental code,
1104 despite its release status.
1105 This implementation is open source.
1107 <t><list style="symbols">
1108 <t><eref target="http://gstreamer.net/"/></t>
1109 <t><eref target="http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/"/></t>
1113 <section anchor="impl-ffmpeg" title="FFmpeg">
1115 The popular media framework and conversion tool FFmpeg implements
1117 End trimming is not implemented, so file durations are not exactly
1119 This implementation is open source.
1121 <t><list style="symbols">
1122 <t><eref target="http://ffmpeg.org/"/></t>
1126 <section anchor="impl-libav" title="libav">
1128 The development repository for libav implements this draft,
1130 This implementation is open source.
1132 <t><list style="symbols">
1133 <t><eref target="http://libav.org/"/></t>
1137 <section anchor="impl-vlc" title="VLC">
1139 VLC is another widely deployed implementation of demuxing, decoding, and
1140 playback support for this draft.
1141 It supports metadata, multichannel, start and end trimming, the gain field,
1142 live streams, seeking, chained files (though seeking does not work
1143 correctly with chained files), and multiplexing with other streams (e.g.,
1145 Opus support was added in version 2.0.4, released on October 18, 2012.
1146 This implementation is open source.
1148 <t><list style="symbols">
1149 <t><eref target="http://www.videolan.org/vlc/"/></t>
1150 <t><eref target="http://git.videolan.org/?p=vlc.git"/></t>
1151 <t><eref target="http://trac.videolan.org/vlc/ticket/7185"/></t>
1155 <section anchor="impl-foobar2k" title="foobar2000">
1157 A popular Windows application, foobar2000 implements read, write, and playback
1158 support for this draft.
1159 It supports metadata, multichannel, start and end trimming, the gain field,
1160 live streams, chained files, and seeking.
1161 Opus support was added in version 1.1.14, released on August 17, 2012.
1162 Encoding support is implemented using opusenc from opus-tools.
1163 This implementation is closed source.
1165 <t><list style="symbols">
1166 <t><eref target="http://www.foobar2000.org/"/></t>
1170 <section anchor="impl-rockbox" title="Rockbox">
1172 Rockbox is an established alternative firmware for portable music players
1173 (typically small, embedded devices) that implements demuxing, decoding, and
1174 playback support for this draft.
1175 It supports metadata, start and end trimming, the gain field, and seeking.
1176 It does not currently support multichannel or chained files.
1177 Opus is currently only supported in development builds, though it is scheduled
1178 to be included in the next stable release (3.13).
1179 This implementation is open source.
1181 <t><list style="symbols">
1182 <t><eref target="http://www.rockbox.org/"/></t>
1183 <t><eref target="http://git.rockbox.org/?p=rockbox.git"/></t>
1184 <t><eref target="http://gerrit.rockbox.org/r/#/c/300/"/></t>
1190 <section anchor="security" title="Security Considerations">
1192 Implementations of the Opus codec need to take appropriate security
1193 considerations into account, as outlined in <xref target="RFC4732"/>.
1194 This is just as much a problem for the container as it is for the codec itself.
1195 It is extremely important for the decoder to be robust against malicious
1197 Malicious payloads must not cause the decoder to overrun its allocated memory
1198 or to take an excessive amount of resources to decode.
1199 Although problems in encoders are typically rarer, the same applies to the
1201 Malicious audio streams must not cause the encoder to misbehave because this
1202 would allow an attacker to attack transcoding gateways.
1206 Like most other container formats, Ogg Opus files should not be used with
1207 insecure ciphers or cipher modes that are vulnerable to known-plaintext
1209 Elements such as the Ogg page capture pattern and the magic signatures in the
1210 ID header and the comment header all have easily predictable values, in
1211 addition to various elements of the codec data itself.
1215 <section anchor="content_type" title="Content Type">
1217 An "Ogg Opus file" consists of one or more sequentially multiplexed segments,
1218 each containing exactly one Ogg Opus stream.
1219 The RECOMMENDED mime-type for Ogg Opus files is "audio/ogg".
1223 If more specificity is desired, one MAY indicate the presence of Opus streams
1224 using the codecs parameter defined in <xref target="RFC6381"/>, e.g.,
1225 <figure align="center">
1226 <artwork align="left"><![CDATA[
1227 audio/ogg; codecs=opus
1230 for an Ogg Opus file.
1234 The RECOMMENDED filename extension for Ogg Opus files is '.opus'.
1238 When Opus is concurrently multiplexed with other streams in an Ogg container,
1239 one SHOULD use one of the "audio/ogg", "video/ogg", or "application/ogg"
1240 mime-types, as defined in <xref target="RFC5334"/>.
1241 Such streams are not strictly "Ogg Opus files" as described above,
1242 since they contain more than a single Opus stream per sequentially
1243 multiplexed segment, e.g. video or multiple audio tracks.
1244 In such cases the the '.opus' filename extension is NOT RECOMMENDED.
1248 <section title="IANA Considerations">
1250 This document has no actions for IANA.
1254 <section anchor="Acknowledgments" title="Acknowledgments">
1256 Thanks to Greg Maxwell, Christopher "Monty" Montgomery, and Jean-Marc Valin for
1257 their valuable contributions to this document.
1258 Additional thanks to Andrew D'Addesio, Greg Maxwell, and Vincent Penqeurc'h for
1259 their feedback based on early implementations.
1263 <section title="Copying Conditions">
1265 The authors agree to grant third parties the irrevocable right to copy, use,
1266 and distribute the work, with or without modification, in any medium, without
1267 royalty, provided that, unless separate permission is granted, redistributed
1268 modified works do not contain misleading author, version, name of work, or
1269 endorsement information.
1275 <references title="Normative References">
1283 <reference anchor="EBU-R128" target="http://tech.ebu.ch/loudness">
1285 <title>"Loudness Recommendation EBU R128</title>
1286 <author fullname="EBU Technical Committee"/>
1287 <date month="August" year="2011"/>
1291 <reference anchor="vorbis-comment"
1292 target="http://www.xiph.org/vorbis/doc/v-comment.html">
1294 <title>Ogg Vorbis I Format Specification: Comment Field and Header
1295 Specification</title>
1296 <author initials="C." surname="Montgomery"
1297 fullname="Christopher "Monty" Montgomery"/>
1298 <date month="July" year="2002"/>
1302 <reference anchor="vorbis-mapping"
1303 target="http://www.xiph.org/vorbis/doc/Vorbis_I_spec.html#x1-800004.3.9">
1305 <title>The Vorbis I Specification, Section 4.3.9 Output Channel Order</title>
1306 <author initials="C." surname="Montgomery"
1307 fullname="Christopher "Monty" Montgomery"/>
1308 <date month="January" year="2010"/>
1314 <references title="Informative References">
1316 <!--?rfc include="http://xml.resource.org/public/rfc/bibxml/reference.RFC.3550.xml"?-->
1319 <reference anchor="draft-sheffer-running-code"
1320 target="https://tools.ietf.org/html/draft-sheffer-running-code-01#section-2">
1322 <title>Improving "Rough Consensus" with Running Code</title>
1323 <author initials="Y." surname="Sheffer" fullname="Yaron Sheffer"/>
1324 <author initials="A." surname="Farrel" fullname="Adrian Farrel"/>
1325 <date month="December" year="2012"/>
1329 <reference anchor="flac"
1330 target="https://xiph.org/flac/format.html">
1332 <title>FLAC - Free Lossless Audio Codec Format Description</title>
1333 <author initials="J." surname="Coalson" fullname="Josh Coalson"/>
1334 <date month="January" year="2008"/>
1338 <reference anchor="replay-gain"
1339 target="http://wiki.xiph.org/VorbisComment#Replay_Gain">
1341 <title>VorbisComment: Replay Gain</title>
1342 <author initials="C." surname="Parker" fullname="Conrad Parker"/>
1343 <author initials="M." surname="Leese" fullname="Martin Leese"/>
1344 <date month="June" year="2009"/>
1348 <reference anchor="seeking"
1349 target="http://wiki.xiph.org/Seeking">
1351 <title>Granulepos Encoding and How Seeking Really Works</title>
1352 <author initials="S." surname="Pfeiffer" fullname="Silvia Pfeiffer"/>
1353 <author initials="C." surname="Parker" fullname="Conrad Parker"/>
1354 <author initials="G." surname="Maxwell" fullname="Greg Maxwell"/>
1355 <date month="May" year="2012"/>
1359 <reference anchor="vorbis-trim"
1360 target="http://xiph.org/vorbis/doc/Vorbis_I_spec.html#x1-130000A.2">
1362 <title>The Vorbis I Specification, Appendix A: Embedding Vorbis into an
1364 <author initials="C." surname="Montgomery"
1365 fullname="Christopher "Monty" Montgomery"/>
1366 <date month="November" year="2008"/>
1370 <reference anchor="wave-multichannel"
1371 target="http://msdn.microsoft.com/en-us/windows/hardware/gg463006.aspx">
1373 <title>Multiple Channel Audio Data and WAVE Files</title>
1374 <author fullname="Microsoft Corporation"/>
1375 <date month="March" year="2007"/>