CARVIEW |
Opus WebCodecs Registration
More details about this document
- This version:
- https://w3c.github.io/webcodecs/opus_codec_registration.html
- Latest published version:
- https://www.w3.org/TR/webcodecs-opus-codec-registration/
- Feedback:
- GitHub
- Editors:
- Paul Adenot (Mozilla)
- Eugene Zemtsov (Google LLC)
- Former Editors:
- Bernard Aboba (Microsoft Corporation)
- Chris Cunningham (Google Inc.)
- Participate:
- Git Repository.
- File an issue.
- Version History:
- https://github.com/w3c/webcodecs/commits
Copyright © 2025 World Wide Web Consortium. W3C® liability, trademark and permissive document license rules apply.
Abstract
This registration is entered into the [webcodecs-codec-registry].
It describes, for Opus, the (1) fully qualified codec strings, (2) the
codec-specific EncodedAudioChunk
[[internal data]]
bytes, (3) the AudioDecoderConfig.description
bytes, (4) the values of EncodedAudioChunk
[[type]]
,
and (5) the codec-specific extensions to AudioEncoderConfig
The registration is not intended to include any information on whether a codec format is encumbered by intellectual property claims. Implementers and authors are advised to seek appropriate legal counsel in this matter if they intend to implement or use a specific codec format. Implementers of WebCodecs are not required to support the Opus codec.
This registration is non-normative.
Status of this document
This section describes the status of this document at the time of its publication. A list of current W3C publications and the latest revision of this technical report can be found in the W3C standards and drafts index at https://www.w3.org/TR/.
Feedback and comments on this specification are welcome. GitHub Issues are preferred for discussion on this specification. Alternatively, you can send comments to the Media Working Group’s mailing-list, public-media-wg@w3.org (archives). This draft highlights some of the pending issues that are still to be discussed in the working group. No decision has been taken on the outcome of these issues including whether they are valid.
This document was published by the Media Working Group as an Editor’s Draft. The group does not expect this document to become a W3C Recommendation.
Publication as an Editor’s Draft does not imply endorsement by W3C and its Members.
The W3C Patent Policy does not carry any licensing requirements or commitments on this document.
This document is governed by the 03 November 2023 W3C Process Document.
1. Fully qualified codec strings
The codec string is "opus"
.
2. EncodedAudioChunk data
An EncodedAudioChunk
containing Opus can be in two different formats.
If the bitstream is in opus
format, EncodedAudioChunk
have to be Opus packets, as described in section
3 of [OPUS]
If the bitstream is in ogg
format, EncodedAudioChunk
have to be audio data packets, as described in section
3 of [OPUS-IN-OGG].
3. AudioDecoderConfig description
description
can be optionally set to an Identification
Header, described in section 5.1 of [OPUS-IN-OGG].
If a description
has been set, the bitstream is assumed
to be in ogg
format.
If a description
has not been set, the bitstream is
assumed to be in opus
format.
4. EncodedAudioChunk type
The [[type]]
for an EncodedAudioChunk
containing
Opus is always "key
".
NOTE: Once the initialization has succeeded, any packet can be decoded at any time without error, but this might not result in the expected audio output.
5. AudioEncoderConfig extensions
partial dictionary AudioEncoderConfig {OpusEncoderConfig opus ; };
opus
, of type OpusEncoderConfig- Contains codec specific configuration options for the Opus codec.
5.1. OpusEncoderConfig
dictionary {
OpusEncoderConfig OpusBitstreamFormat format = "opus";OpusSignal signal = "auto";OpusApplication application = "audio"; [EnforceRange ]unsigned long long frameDuration = 20000; [EnforceRange ]unsigned long complexity ; [EnforceRange ]unsigned long packetlossperc = 0;boolean useinbandfec =false ;boolean usedtx =false ; };
To check if an OpusEncoderConfig
is valid, run these steps:
-
If
frameDuration
is not a valid frame duration, which is described section 2.1.4 of [RFC6716], returnfalse
. -
If
complexity
is specified and not within the range of0
and10
inclusively, returnfalse
. -
If
packetlossperc
is specified and not within the range of0
and100
inclusively, returnfalse
. -
Return
true
.
format
, of type OpusBitstreamFormat, defaulting to"opus"
- Configures the format of output
EncodedAudioChunk
s. SeeOpusBitstreamFormat
. signal
, of type OpusSignal, defaulting to"auto"
- Specificies the type of audio signal being encoded. See
OpusSignal
. application
, of type OpusApplication, defaulting to"audio"
- Specificies the encoder’s intended application. See
OpusApplication
. frameDuration
, of type unsigned long long, defaulting to20000
- Configures the frame duration, in microseconds, of output
EncodedAudioChunk
s. complexity
, of type unsigned long- Configures the encoder’s computational complexity, as described in section 2.1.9.
of [RFC6716]. The valid range is
0
to10
, with10
representing the highest complexity. If no value is specificied, the default value is platform-specific: User Agents SHOULD set a default of5
for mobile platforms, and a default of9
for all other platforms. packetlossperc
, of type unsigned long, defaulting to0
-
Configures the encoder’s expected packet loss percentage. The valid range is
0
to100
.NOTE: The packet loss percentage might be updated over the course of an encoding, and it is recommended for User Agents to support these reconfigurations.
useinbandfec
, of type boolean, defaulting tofalse
- Specifies whether the encoder provides Opus in-band Forward Error Correction (FEC), as described by section 2.1.7. of [RFC6716].
usedtx
, of type boolean, defaulting tofalse
- Specifies if the encoder uses Discontinuous Transmission (DTX), as described by section 2.1.9. of [RFC6716].
5.2. OpusBitstreamFormat
enum {
OpusBitstreamFormat "opus" ,"ogg" , };
The OpusBitstreamFormat
determines if extra-data are necessary to decode the
encoded audio stream.
opus
- No metadata are necessary to decode the encoded audio stream.
ogg
- The metadata of the encoded audio stream are provided at configuration via
AudioDecoderConfig.description
.
5.3. OpusSignal
enum {
OpusSignal "auto" ,"music" ,"voice" , };
The OpusSignal
indicates the default value for the type of signal being encoded.
auto
- The audio signal is not specified to be of a particular type.
music
- The audio signal is music.
voice
- The audio signal is voice or speech.
5.4. OpusApplication
enum {
OpusApplication "voip" ,"audio" ,"lowdelay" , };
The OpusApplication
indicates the default value for the encoder’s intended
application.
voip
- Process signal for improved speech intelligibility.
audio
- Favor faithfulness to the original input.
lowdelay
- Configure the minimum possible coding delay by disabling certain modes of operation.
6. Privacy Considerations
Please refer to the section Privacy Considerations in [WEBCODECS].
7. Security Considerations
Please refer to the section Security Considerations in [WEBCODECS].
Conformance
Document conventions
Conformance requirements are expressed with a combination of descriptive assertions and RFC 2119 terminology. The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in the normative parts of this document are to be interpreted as described in RFC 2119. However, for readability, these words do not appear in all uppercase letters in this specification.
All of the text of this specification is normative except sections explicitly marked as non-normative, examples, and notes. [RFC2119]
Examples in this specification are introduced with the words “for example”
or are set apart from the normative text
with class="example"
,
like this:
Informative notes begin with the word “Note”
and are set apart from the normative text
with class="note"
,
like this:
Note, this is an informative note.
Index
Terms defined by this specification
- application, in § 5.1
- "audio", in § 5.4
- audio, in § 5.4
- "auto", in § 5.3
- auto, in § 5.3
- complexity, in § 5.1
- format, in § 5.1
- frameDuration, in § 5.1
- "lowdelay", in § 5.4
- lowdelay, in § 5.4
- "music", in § 5.3
- music, in § 5.3
- "ogg", in § 5.2
- ogg, in § 5.2
- "opus", in § 5.2
-
opus
- dict-member for AudioEncoderConfig, in § 5
- enum-value for OpusBitstreamFormat, in § 5.2
- OpusApplication, in § 5.4
- OpusBitstreamFormat, in § 5.2
- OpusEncoderConfig, in § 5.1
- OpusSignal, in § 5.3
- packetlossperc, in § 5.1
- signal, in § 5.1
- usedtx, in § 5.1
- useinbandfec, in § 5.1
- "voice", in § 5.3
- voice, in § 5.3
- "voip", in § 5.4
- voip, in § 5.4
Terms defined by reference
-
[WEBCODECS] defines the following terms:
- "key"
- AudioEncoderConfig
- EncodedAudioChunk
- [[internal data]]
- [[type]]
- description
-
[WEBIDL] defines the following terms:
- EnforceRange
- boolean
- unsigned long
- unsigned long long
References
Normative References
- [RFC2119]
- S. Bradner. Key words for use in RFCs to Indicate Requirement Levels. March 1997. Best Current Practice. URL: https://datatracker.ietf.org/doc/html/rfc2119
- [WEBCODECS]
- Paul Adenot; Eugene Zemtsov. WebCodecs. URL: https://w3c.github.io/webcodecs/
- [WEBIDL]
- Edgar Chen; Timothy Gu. Web IDL Standard. Living Standard. URL: https://webidl.spec.whatwg.org/
Informative References
- [OPUS]
- RFC 6716: Definition of the Opus Audio Codec. September 2012. URL: https://datatracker.ietf.org/doc/html/rfc6716
- [OPUS-IN-OGG]
- RFC 7845: Ogg Encapsulation for the Opus Audio Codec. April 2016. URL: https://datatracker.ietf.org/doc/html/rfc7845
- [RFC6716]
- JM. Valin; K. Vos; T. Terriberry. Definition of the Opus Audio Codec. September 2012. Proposed Standard. URL: https://www.rfc-editor.org/rfc/rfc6716
- [WEBCODECS-CODEC-REGISTRY]
- Paul Adenot; Bernard Aboba. WebCodecs Codec Registry. URL: https://w3c.github.io/webcodecs/codec_registry.html
IDL Index
partial dictionary AudioEncoderConfig {OpusEncoderConfig opus ; };dictionary {
OpusEncoderConfig OpusBitstreamFormat format = "opus";OpusSignal signal = "auto";OpusApplication application = "audio"; [EnforceRange ]unsigned long long frameDuration = 20000; [EnforceRange ]unsigned long complexity ; [EnforceRange ]unsigned long packetlossperc = 0;boolean useinbandfec =false ;boolean usedtx =false ; };enum {
OpusBitstreamFormat "opus" ,"ogg" , };enum {
OpusSignal "auto" ,"music" ,"voice" , };enum {
OpusApplication "voip" ,"audio" ,"lowdelay" , };