VoIP Codec Comparison & Bandwidth Math
Understand the engineering tradeoffs between payload compression, DSP transcoding, IP overhead, and overall Mean Opinion Score (MOS) in carrier networks.
What a Codec Does & The Bandwidth Tradeoff
A codec (Coder-Decoder) relies on the Nyquist theorem and Digital Signal Processing (DSP) to sample analog audio waveforms and quantize them into digital payloads. The primary engineering decision revolves around the tradeoff between algorithmic compression (saving bandwidth) versus audio fidelity (measured as Mean Opinion Score, or MOS).
| Codec | Bitrate | Bandwidth w/ Overhead | MOS | Notes |
|---|---|---|---|---|
| G.711 μ-law | 64 kbps | ~87 kbps | ~4.2 | North American PSTN default. Uncompressed, high quality, requires no transcoding penalty. Standard payload payload type 0. |
| G.711 A-law | 64 kbps | ~87 kbps | ~4.2 | European and international PSTN default. Functionally identical to μ-law in overhead. Standard payload type 8. |
| G.729 / G.729a | 8 kbps | ~32 kbps | ~3.9 | Highly compressed, traditionally licensed codec. Useful on severely constrained links but adds DSP transcoding load at the SBC. |
| G.722 | 64 kbps | ~87 kbps | ~4.5 | Wideband HD audio. Excellent for intra-network SIP calls but is fundamentally not carried across standard PSTN TDM links. |
| Opus | 6–510 kbps | ~40–100 kbps | ~4.5+ | Modern variable-bitrate WebRTC codec. Exceptionally resilient to packet loss, but always requires transcoding for final PSTN delivery. |
Real Bandwidth Math & Packet Overhead
Novice administrators mistakenly calculate capacity based on raw payload bitrates. The physical wire reality is drastically different. A standard G.711 payload operates at 64 kbps. However, encapsulating that audio into IP packets introduces massive overhead.
Assuming a standard 20ms packetization rate (50 packets per second), each packet requires 40 bytes of headers (20 bytes IPv4, 8 bytes UDP, 12 bytes RTP). This injects 16 kbps of mandatory overhead. Factoring in Ethernet framing, a '64 kbps' G.711 call actually consumes approximately 87.2 kbps on the wire. Because voice is symmetric, 100 concurrent channels will demand a stable 8.7 Mbps of bi-directional dedicated bandwidth.
Media Handling Best Practices
Proper negotiation and routing of the RTP media stream is critical for maintaining toll-quality infrastructure.
| Topic | Engineering Detail |
|---|---|
| Codec Negotiation (SDP) | Codecs are negotiated via the Session Description Protocol (SDP) offer/answer model within the SIP INVITE. Aligning your equipment's offer order with the upstream carrier's preferred codec (typically G.711u) avoids unnecessary transcoding, thereby preserving MOS and reducing latency. |
| Transcoding Implications | Transcoding between disjointed codecs (e.g., G.729 to G.711) requires DSP resources, inherently introduces a 10-30ms processing delay, and permanently degrades the Mean Opinion Score (MOS) of the audio stream due to re-quantization. |
| RTP vs SRTP | Standard RTP transmits audio as unencrypted UDP packets. Secure RTP (SRTP) encrypts the payload using AES. However, SRTP key exchange occurs in the SDP; therefore, SRTP is only meaningfully secure if the signaling channel itself is encrypted (SIP over TLS). |
| DTMF Transport | DTMF should be transported out-of-band using RFC 2833 / 4733 (telephone-event) or SIP INFO. In-band audio DTMF relies on raw frequencies, which are irreparably distorted and rendered unrecognizable by compressed codecs like G.729. |
| T.38 vs G.711 Pass-Through | Fax transmission requires pure, lossless transit. T.38 (Fax Relay) converts fax tones into a data protocol over IP, providing reliability. Alternatively, G.711 pass-through can work on pristine connections but mandates turning off echo cancellation and VAD. Fax definitively fails over compressed G.729 links. |
| Jitter, Packet Loss, and Latency Targets | To maintain toll-quality voice, wholesale IP links must adhere to strict thresholds: one-way latency below 150ms (ITU G.114), jitter under 30ms, and packet loss rigorously maintained below 1%. |
Codec Negotiation & SDP Offer/Answer
Codecs are negotiated dynamically during call setup using the Session Description Protocol (SDP) housed within the SIP INVITE body. The originating switch sends an 'offer' array of supported payload types. The terminating switch replies with an 'answer' selecting the preferred matching format.
If you misalign your priority list, the network is forced to invoke transcoding.
The Brutal Reality of Transcoding
Transcoding occurs when disparate networks cannot agree on a common media format, forcing an intermediary SBC to decode the audio, re-quantize it, and re-encode it in transit. This introduces severe penalties.
First, transcoding heavily exhausts costly DSP resources on the SBC. Second, it injects unavoidable mathematical latency (typically 10-30ms). Third, lossy compression algorithms permanently degrade the MOS. Transcoding from G.729 back to G.711 never restores the lost audio data—it only serves to wrap a low-quality stream in a larger bandwidth footprint.
Wideband, HD Audio, and the PSTN
Wideband codecs like G.722 and Opus sample audio at 16kHz or higher, capturing a much wider frequency spectrum. However, standard PSTN TDM links are rigidly hardcoded to a 3.1kHz narrowband pass. Attempting to send HD audio across legacy tandem switches results in immediate downsampling, entirely negating the wideband advantages.
Quality Targets for Toll-Grade Voice
To ensure uncompromising voice quality, wholesale networks must vigorously defend Layer 3 routing thresholds.
Strict operational ceilings dictate that one-way latency must never exceed 150ms (ITU G.114). Jitter variations must be smoothed below 30ms via dynamic edge buffers. Crucially, UDP packet loss must be fiercely contained below 1%. Exceeding these bounds causes immediate, audible robotic distortion and catastrophic DSP failure on compressed links.
Frequently Asked Questions
Ready to Connect?
Experience enterprise-grade wholesale termination and origination with transparent pricing and real-time control.
