| config | s | c |
+-+-+-+-+-+-+-+-+ `
The first five bits define the configuration (operating mode, audio bandwidth, and frame size), bit 5 indicates mono or stereo, and bits 6–7 define whether the packet contains one, two, or arbitrary numbers of frames.
Dual-Core Architecture and the Hybrid Mode
Opus combines SILK (for LPC-based speech) and CELT (for transform-based audio) into a single engine:
1. SILK-only Mode: Used for speech from 6 kbit/s up to roughly 20 kbit/s. Audio bandwidth caps at wideband (16 kHz sampling equivalent). 2. Hybrid Mode: Used exclusively for superwideband and fullband speech between roughly 16 kbit/s and 32 kbit/s. SILK encodes the lower spectrum (0–8 kHz), while CELT models the upper spectrum (8–20 kHz) via MDCT bands. 3. CELT-only Mode: Used for generic audio or ultra-low-latency speech from 32 kbit/s up to 510 kbit/s, offering pure transform coding with algorithmic latencies down to 5 ms.
The exact bitrate thresholds for mode transitions are implementation-defined in the encoder, rather than locked by the standard. I would check the specific libopus version's internal thresholds in silk/control_audio_bandwidth.c to verify transition behaviors under non-default tuning profiles.
Dynamic Bitrate and Bandwidth Adaptation Without SDP Signaling
When a cellular device transitions from 802.11ax Wi-Fi to a congested LTE cell edge, available uplink bandwidth can drop from 300 kbit/s to 12 kbit/s in milliseconds.
In traditional SIP architectures using codecs like G.711, G.722, or AAC, altering the stream's structural parameters requires an out-of-band Session Description Protocol (SDP) renegotiation via an offer/answer exchange. Under standard conditions, an SDP renegotiation takes between 100 ms and 800 ms. Media continues to saturate the bottleneck during this exchange, causing buffers to overflow, queueing latency to spike, and intermediate routers to drop packets.
Opus solves this entirely in-band. The remote encoder does not need to signal the local decoder to change bitrates, frame durations (from 20 ms up to 60 ms or down to 2.5 ms), or bandwidth allocations (narrowband to fullband). The decoder parses the TOC byte of the next incoming RTP packet payload and reconfigures its synthesis pipeline inline.
Signaling via RFC 7587 defines only initial negotiation envelopes using parameters like maxaveragebitrate, maxplaybackrate, and useinbandfec. Once established, the sender adjusts bitrates frame-by-frame based on RTCP Receiver Reports or Transport-wide Congestion Control (TWCC) feedback, without modifying the underlying SDP session.
Network Impairment Characteristics and Failure Boundaries
Packet loss concealment and error recovery mechanics dictate whether a codec functions over residential links and mobile networks.
What Breaks Under Packet Loss and Jitter
Under high jitter and burst packet loss, Opus degrades progressively before failing catastrophically along predictable boundaries. If network jitter exceeds the depth of the receiver's adaptive jitter buffer, late-arriving packets are dropped as lost. When this occurs, the decoder invokes its internal Packet Loss Concealment (PLC).
In SILK mode, PLC extrapolates LPC filter parameters and decays the pitch excitation gain. If a single 20 ms packet is lost, the concealment is largely transparent. However, if burst loss drops three or more consecutive frames (>60 ms), the autoregressive state of the linear predictor diverges from the encoder's true state. The excitation energy must be rapidly attenuated to avoid harsh transient buzzes, resulting in complete audio muting by 80 ms to 100 ms of continuous loss.
When valid packets arrive again, the LPC state is mismatched. This mismatch manifests as audible clipping, dullness, or "underwater" phase artifacts while the pitch predictor restabilizes.
In CELT mode, burst loss breaks the 50% overlap-add phase continuity across successive MDCT windows. CELT's PLC synthesizes spectral shape by decaying previous frame band energies with randomized phases. If packet loss exceeds roughly 15%, CELT exhibits rapid tonal modulation, commonly heard as a metallic, ringing artifact, caused by phase cancellation across the synthesis boundary.
In-Band Forward Error Correction Mechanics
To resist loss without paying the full bandwidth penalty of RFC 2198 redundancy, Opus embeds an asymmetrical Forward Error Correction (FEC) mechanism directly into the primary bitstream.
` Frame N-1 Bitstream Frame N Bitstream [Primary Payload N-1] [TOC][FEC Payload N-1][Primary Payload N] | | (Lost in transit) (Received successfully) | Decoded to reconstruct approximate Frame N-1 `
This mechanism—referred to within the SILK source code as Low Bit-Rate Redundancy (LBRR)—is controlled via the useinbandfec=1 declaration in RFC 7587.
The operation works as follows:
1. When configured loss thresholds are crossed (e.g., the encoder receives feedback indicating >5% packet loss), the encoder generates a secondary, highly compressed representation of frame $N-1$ alongside primary frame $N$. 2. This secondary payload strips high-frequency spectral bands, lowers the LPC prediction order, and reduces the target bit budget, often consuming only 20% to 30% of the bits used by the primary frame. 3. If packet $N-1$ is dropped by an intermediate router but packet $N$ arrives, the receiver inspects the TOC flag, extracts the embedded redundant payload, and synthesizes frame $N-1$ prior to processing frame $N$.
This technique does not protect against burst losses spanning two or more sequential packets. If both packet $N-1$ and packet $N$ drop, the embedded FEC data is lost alongside the primary payload, forcing the receiver back into standard PLC extrapolation.
CELT does not support this form of in-band FEC. In CELT mode, application designs requiring packet loss resilience must rely entirely on packetization tuning (e.g., bundling multiple 10 ms or 20 ms frames into a single larger transport packet) or external packet-level FEC schemes like FlexFEC.
The Practical Rule
Select Opus for real-time systems not because it generates the highest laboratory MOS score for a static bandwidth, but because its unified TOC architecture, dynamic rate decoupling, and integrated SILK/CELT pipelines prevent audio dropouts when networks drift, drop packets, and jitter. If your application constraints include a closed ecosystem running over a private network with static latency, non-variable bitrates, and hardware DSP offloads, standardizing on G.722.2, EVS, or AAC-LD will yield marginal efficiency gains. If your packets transit the public Internet across changing access networks, run Opus, configure useinbandfec=1, sample at 48 kHz, pack 20 ms frames, and tie your congestion control estimator directly to the encoder’s target bitrate API.
Terms used in this note
A codec is an algorithm that compresses audio for transmission. A jitter buffer is a queue that absorbs variable arrival times before playback. Packet loss concealment is the substitution a decoder performs when a frame never arrives.
- Sample rate — how many times per second the signal is measured
- Frame size — the block of samples a codec encodes at once
- Lookahead — the delay a codec needs before it can encode
- Bitrate — bits per second the stream consumes
- Jitter — variation in packet arrival time
- Playout delay — total time from capture to speaker
- Concealment — what the decoder invents for a missing frame
- Transcoding — decoding and re-encoding between formats
- Comfort noise — synthetic background added during silence
- RTP — the transport that carries real-time media
- RTCP — the control protocol reporting on an RTP session
- Narrowband — speech-band audio, roughly 300 to 3400 Hz