RTP Payload Format for the Opus Speech and Audio Codec
Extracted elements (26)
Stereo operation is signaled in-band within the Opus bitstream itself, requiring no special arrangement in the RTP payload format. Similarly, FEC encoding decisions are entirely controlled by the encoder with no special payload precautions needed.
VBR achieves higher audio quality than CBR at the same average bitrate and is recommended for voice transmission. CBR may be chosen to prevent potential information leakage when encrypting the stream; when converting a VBR stream to CBR, the Opus internal padding mechanism (not the RTP padding bit) is RECOMMENDED because the RTP padding bit is unencrypted.
Any compliant Opus decoder is capable of ignoring FEC information when not needed, so encoding with FEC cannot cause interoperability problems. Every receiver MUST be able to receive and decode stereo signals regardless of the 'stereo' parameter preference.
For SDP signaling, only the highest Opus clock rate (48000 Hz) is used, though the actual media clock rate is signaled inside the payload. The decoder MUST be capable of decoding every received clock rate. The RTP clock rate in 'a=rtpmap' is always 48000/2.
Using Comfort Noise as defined in RFC 3389 with Opus is discouraged; instead, the Opus decoder's built-in frame loss concealment generates comfort noise for DTX gaps. Receivers distinguish DTX from packet loss by gaps in the RTP sequence number.
Any unknown parameter in an SDP offer MUST be ignored by the receiver and MUST be removed from the answer.
Applications that use RTP over UDP SHOULD implement their own congestion control above the UDP layer (per RFC 5405), since UDP does not provide congestion control.
If FEC cannot be used on the receiving side, FEC SHOULD NOT be used as it leads to inefficient network resource usage. Decoder support for FEC SHOULD be indicated at session setup time.
Optional media type parameters 'maxaveragebitrate', 'maxplaybackrate', 'stereo', 'cbr', 'useinbandfec', and 'usedtx', when present, MUST be included in the 'a=fmtp' attribute in SDP and MUST NOT be specified in an SSRC-specific 'fmtp' source-level attribute.
The average bitrate SHOULD NOT exceed the available network bandwidth to avoid congestion. If no target bitrate is specified, the bitrates in Section 3.1.1 are RECOMMENDED.
The 'maxptime' SDP parameter MUST be handled in the same way as 'ptime' as defined by RFC 3264's offer/answer handling.
The receiving side MUST be prepared to receive duplicate RTP packets. The receiver MUST provide at most one of those payloads to the Opus decoder for decoding, and MUST discard the others.
The RTP clock rate in 'a=rtpmap' MUST be 48000, and the number of channels MUST be 2, regardless of the actual audio sampling rate or whether the content is mono or stereo.
The sender MUST NOT send with an average bitrate higher than the 'maxaveragebitrate' parameter as it might overload the network and/or receiver.
When 'stereo' is 0, a sender sending to a single destination MUST NOT use stereo. Gateways sending to multiple destinations SHOULD NOT use stereo when 'stereo' is 0, as this wastes network resources.
When using DTX, the transmitter MUST drop whole frames only, based on the size of the last transmitted frame, to ensure successive RTP timestamps differ by a multiple of 120 and to allow the receiver to use whole frames for concealment.
Opus frames may represent 2.5, 5, 10, 20, 40, or 60 ms of audio. Multiple frames can be combined into a single packet up to 120 ms total. Timestamp increments per frame size are: 120 (2.5 ms), 240 (5 ms), 480 (10 ms), 960 (20 ms), 1920 (40 ms), 2880 (60 ms).
The 'cbr' parameter (0 or 1, default 0) is a unidirectional receive-only parameter indicating whether the decoder prefers constant bitrate (1) or variable bitrate (0). When cbr=1, the maximum average bitrate can still change to adapt to network conditions.
The 'maxplaybackrate' parameter (range 8000–48000 Hz, default 48000) is a unidirectional receive-only hint indicating the maximum output sampling rate the receiver can render; the encoder SHOULD NOT encode frequencies above the specified audio bandwidth.
The RTP timestamp is incremented at a fixed 48000 Hz clock rate for all Opus modes and all sampling rates. The unit is samples per single (mono) channel, corresponding to the first encoded sample in the frame. For non-48000 Hz content, the sampling rate must be adjusted to 48000 Hz for timestamp purposes.
The 'sprop-maxcapturerate' and 'sprop-stereo' parameters are unidirectional sender-only parameters that allow the receiver to set up a reduced-complexity audio processing pipeline; they do not affect interoperability and the receiver MUST be capable of receiving any signal.
The 'useinbandfec' parameter (0 or 1, default 0) signals that the decoder can take advantage of Opus in-band FEC. The receiver MUST be able to process packets that include FEC information even if the FEC part is discarded.
This document registers the 'audio/opus' media subtype with IANA. Required parameter: 'rate' (must be 48000). Optional parameters include: maxplaybackrate, sprop-maxcapturerate, maxptime, ptime, maxaveragebitrate, stereo, sprop-stereo, cbr, useinbandfec, usedtx.
This payload format and Opus encoding do not exhibit significant non-uniformity in receiver-end computational load and are unlikely to pose a denial-of-service threat due to receipt of pathological datagrams.
Use of VBR is subject to the security considerations in RFC 6562, as variable bitrate audio may leak information about the content when encrypted. RTP packets using this format are subject to RFC 3550 security considerations and applicable RTP profiles (RTP/AVP, RTP/AVPF, RTP/SAVP, RTP/SAVPF). Applications SHOULD use one or more appropriate strong security mechanisms.
The RTP payload for Opus consists of exactly one Opus packet (as defined in RFC 6716 Section 3) appended directly after the RTP header, with no additional framing. An RTP payload MUST contain exactly one Opus packet.