Post
Voice codec guide
A codec converts audio into packets and reconstructs it at the far end. Codec choice affects bandwidth, delay, CPU use, resilience to loss, and interoperability.
| Codec | Typical use | Approx. payload rate | Practical notes |
|---|---|---|---|
| G.711 PCMU/PCMA | PSTN-like wide interoperability | 64 kbps | Very low algorithmic complexity; total network rate is higher after overhead |
| G.722 | Wideband business voice | 64 kbps nominal | Better speech bandwidth than G.711; often signalled with an 8 kHz RTP clock despite wideband audio |
| Opus | Web, mobile, conferencing | Variable | Flexible bit rate, packetization, and bandwidth; excellent general-purpose choice when both ends support it |
| G.729 | Legacy low-bandwidth deployments | 8 kbps | Licensing and interoperability considerations; avoid treating it as a modern default |
| iLBC | Loss-tolerant legacy voice | 13.33/15.2 kbps | Older ecosystem; verify endpoint support |
| AMR/AMR-WB | Mobile networks | Variable | Common in cellular contexts; support depends on the carrier and media path |
Terms to understand
- Payload rate: compressed audio only.
- Packetization / ptime: audio duration carried in one RTP packet, often 20 ms.
- RTP clock rate: timestamp frequency used by RTP; it is not always the same as the encoded bit rate.
- Packet loss concealment: receiver techniques that mask missing audio.
- Transcoding: decoding one codec and re-encoding another; it consumes resources and can reduce quality.
Choosing a codec
- Start with codecs supported end-to-end, including the carrier and SBC.
- Prefer a wideband codec for modern internal calls when interoperability allows it.
- Keep a widely interoperable fallback for PSTN and emergency paths.
- Avoid unnecessary transcoding.
- Test with realistic packet loss, jitter, mobile handoff, and VPN paths.
Never compare codecs by payload rate alone. Packet size, transport overhead, silence suppression, encryption, and network encapsulation all change the bandwidth requirement.