|Fundamentals

How Codecs Shape Call Quality

G.711, G.729, Opus, and the other codecs that shape VoIP call quality. How they work, what they trade off, and why the same network sounds different with each codec.

Every VoIP call passes through a codec. The codec determines how your voice is converted from an analog signal into digital data, how much that data is compressed, and how much bandwidth the resulting stream requires. It is one of the most important factors in call quality, and it is one that most people never think about because it is negotiated automatically between endpoints before the first word is spoken.

Understanding codecs is not about memorizing bitrate tables. It is about understanding why the same network conditions produce different call quality depending on which codec is in use, and why choosing the right codec for your environment matters more than most network optimizations. If you want to know what conditions your codec actually has to survive, a VoIP quality test measures the packet loss and jitter on your real network path.

What a codec does

The word "codec" is short for coder-decoder. The coder side takes analog audio from a microphone, samples it at regular intervals, and converts those samples into digital data. The decoder side takes the digital data and converts it back to analog audio for the speaker.

Between coding and decoding, some codecs also compress the data. Compression reduces bandwidth but introduces artifacts and makes the audio more fragile in the face of packet loss and jitter. This is the fundamental tradeoff in codec selection: bandwidth versus quality versus resilience.

Every codec produces a stream of RTP packets at regular intervals. The most common interval is 20 milliseconds, meaning 50 packets per second in each direction. Some codecs support different packet intervals (ptime), which affects packet count and per-packet overhead.

The major codecs

G.711 (u-law and a-law)

G.711 is the reference standard for VoIP audio quality. It samples audio at 8kHz and uses 8 bits per sample with no compression, producing a constant 64kbps stream. With IP, UDP, and RTP headers added, a G.711 call uses about 87kbps in each direction at the standard 20ms ptime.

There are two variants. G.711 u-law (also written μ-law) is used in North America and Japan. G.711 a-law is used in the rest of the world. The difference is in the companding algorithm used to map the analog signal to 8-bit samples. Both produce equivalent quality.

G.711's strengths are simplicity and predictability. There is no compression algorithm to introduce artifacts. No processing delay beyond the packetization interval. No variability in output quality based on audio content. What goes in comes out, minus whatever the network does to the packets in transit.

Its weakness is bandwidth. At 87kbps per call, G.711 uses roughly three times the bandwidth of compressed codecs. For most modern business internet connections, this is irrelevant — 100 simultaneous G.711 calls need less than 9Mbps. But on constrained links or high-density deployments, the bandwidth adds up. A bandwidth calculator can show you the exact per-call overhead for each codec so you can plan accordingly.

G.711 also has the best packet loss resilience of any narrowband codec. Because each packet contains uncompressed audio, a lost packet results in a simple gap that the receiver can fill with basic interpolation (repeating the last good audio frame). Compressed codecs lose more information per packet and are harder to conceal.

G.729

G.729 compresses voice audio to 8kbps, roughly one-eighth of G.711's bitrate. With packet overhead, a G.729 call uses about 32kbps. This made G.729 essential in the early days of VoIP when bandwidth was expensive and limited.

The compression works by modeling the human vocal tract and encoding a set of parameters that describe the speech rather than encoding the raw audio samples. The decoder uses these parameters to synthesize audio that sounds like the original. This is called CELP (Code-Excited Linear Prediction) coding.

The result sounds good for voice — clear and intelligible for most speakers in most conditions. But it does not sound like G.711. Compression artifacts are present, particularly on non-speech audio. Hold music, DTMF tones, modem signals, and fax transmissions all suffer noticeably through G.729 because the vocal tract model does not describe them well.

G.729 is more sensitive to packet loss than G.711. Because each packet encodes a compressed representation of the audio rather than raw samples, the decoder needs context from surrounding packets to reconstruct the signal accurately. A lost packet creates a gap that is harder to conceal. At 2-3% loss, G.729 calls sound noticeably worse than G.711 calls with the same loss.

G.729 was historically encumbered by patents, which required licensing fees. Those patents have expired, but the codec's market position has been largely supplanted by Opus for new deployments.

G.722

G.722 is the standard wideband codec, sampling audio at 16kHz instead of 8kHz. The higher sample rate captures frequencies up to 7kHz (compared to 3.4kHz for narrowband codecs), producing noticeably richer, more natural-sounding voice. This is what marketing calls "HD Voice."

G.722 uses 64kbps — the same as G.711 — but at wideband quality. This seems like a free upgrade, and in many environments it is. The catch is that both endpoints and every intermediate device must support G.722. If a call leg transits through a system that only supports narrowband codecs, the call will be transcoded down and the wideband quality is lost.

G.722 is widely supported on modern desk phones and softphones. If your VoIP provider and all your endpoints support it, it is worth enabling for the quality improvement.

Opus

Opus is the modern standard for real-time audio. It supports both narrowband and wideband audio, adjusts its bitrate dynamically based on network conditions, and includes sophisticated packet loss concealment. It was designed for the internet rather than adapted from telephone network standards.

Opus operates at bitrates from about 6kbps to 510kbps, with typical voice configurations using 24-48kbps. At the low end, it outperforms G.729 in quality at comparable bitrates. At the high end, it delivers wideband quality that exceeds G.722. Its adaptive bitrate capability means it can reduce compression on the fly when it detects network congestion, trading audio richness for reliability.

The packet loss concealment in Opus is significantly more advanced than older codecs. It uses forward error correction (FEC) techniques that encode redundant information into the stream, allowing the decoder to reconstruct lost packets from surrounding data. At moderate loss rates (2-5%), Opus maintains better audio quality than G.711, despite using less bandwidth.

Opus is standard in WebRTC and is increasingly supported by SIP-based VoIP platforms. Its main limitation is that older PBX systems, SIP trunking providers, and desk phones may not support it. Calls between an Opus-capable softphone and a provider that only supports G.711 will negotiate down to G.711.

Other codecs you may encounter

iLBC (internet Low Bitrate Codec). Designed specifically for packet loss resilience at low bitrates (13.3 or 15.2 kbps). Each packet is independently decodable, meaning a lost packet does not affect surrounding audio. Rarely used in new deployments but occasionally seen in legacy WebRTC applications.

GSM. The codec from mobile phone networks, sometimes used in low-bandwidth VoIP. Quality is acceptable for voice but noticeably compressed. Mostly a legacy choice.

G.726. An ADPCM codec that offers bitrates between G.711 and G.729 (16, 24, 32, or 40 kbps). Occasionally used but largely superseded by more modern options.

How codec negotiation works

When a VoIP call is initiated, the calling endpoint sends an INVITE message containing an SDP body that lists its supported codecs in order of preference. The receiving endpoint responds with its own SDP indicating which codec it has chosen from the offered list.

If the two endpoints share no common codec, the call fails. If they share multiple codecs, the answering endpoint typically selects the highest-preference codec that both support.

This negotiation is why you can have a phone configured for Opus that seamlessly falls back to G.711 when calling a provider that does not support Opus. The phone offered both, the provider selected G.711, and the call proceeds at narrowband quality. No error, no warning — just a silent quality downgrade that neither party may notice unless they are listening for it.

Transcoding: the hidden quality tax

When a call passes through a system that needs to convert between codecs — say, the inbound leg uses Opus but the outbound trunk only supports G.711 — the system must decode the audio from one codec and re-encode it in the other. This is transcoding.

Transcoding introduces three costs. First, processing load — decoding and re-encoding audio in real time requires CPU resources. At scale, this can be significant. Second, latency — the transcode step adds a small but nonzero delay. Third, and most important, quality loss. Every compression and decompression cycle introduces artifacts. A call that is compressed with G.729, decompressed, then recompressed with G.711 sounds worse than a call that used either codec end-to-end.

Transcoding between two lossy codecs is the worst case. The artifacts from the first codec are baked into the audio signal. The second codec then compresses that already-degraded signal, adding its own artifacts on top. The result is audibly degraded in a way that neither codec would produce on its own.

Avoiding unnecessary transcoding is one of the simplest ways to improve call quality. Use the same codec end-to-end when possible. If your provider's trunk supports G.711 and your phones support G.711, configure G.711 as the preferred codec and eliminate the transcode.

Choosing the right codec

The choice depends on your specific constraints.

If bandwidth is not a concern (most modern offices), use G.711 for maximum compatibility and consistent quality, or G.722/Opus for wideband quality if your entire call path supports it.

If bandwidth is constrained (remote sites on limited links, high-density call centers), G.729 reduces bandwidth significantly at an acceptable quality tradeoff. Opus at a constrained bitrate is a better choice if your infrastructure supports it.

If packet loss is a known issue (and you cannot fix it), Opus with FEC provides the best resilience. G.711 is the next best choice because of its simple loss concealment. G.729 is the worst choice in lossy environments.

If you are mixing endpoints (desk phones, softphones, mobile clients, WebRTC), you will likely end up with multiple codecs in play. Make sure your PBX or provider handles the negotiation cleanly and minimize transcoding by aligning codec preferences across endpoint types.

The codec is not usually the first thing to troubleshoot when calls sound bad. Network conditions — jitter, loss, congestion — cause the majority of quality problems regardless of codec. But the codec determines how gracefully the audio degrades when network conditions are imperfect. Understanding why voice is uniquely demanding and how your codec choice interacts with your network reality is part of building a VoIP deployment that sounds good consistently, not just when conditions are ideal.

Frequently Asked Questions

What is the best codec for VoIP call quality?+

G.711 (u-law or a-law) provides the highest and most consistent quality for narrowband voice because it uses no compression. If your bandwidth supports it (about 87kbps per call), G.711 is the safest choice. For wideband (HD) voice, Opus offers excellent quality with adaptive bitrate, but both endpoints and your VoIP provider must support it.

How much bandwidth does a VoIP call use?+

It depends entirely on the codec. A G.711 call uses about 87kbps in each direction including packet overhead. G.729 uses about 32kbps. Opus varies from about 24kbps to 64kbps depending on configuration. These numbers are per call, so multiply by your expected simultaneous call count for capacity planning. Our bandwidth calculator can show you the exact per-call overhead for each codec.

Does the codec affect how sensitive a call is to packet loss?+

Yes, significantly. Compressed codecs like G.729 are more affected by packet loss because each packet carries more audio information relative to the stream — losing one packet means losing a larger, harder-to-conceal chunk of audio. G.711 loses less audio per packet and is easier to conceal with interpolation. Opus has sophisticated built-in loss concealment that handles moderate loss better than most codecs.

What happens when two endpoints use different codecs?+

If the endpoints cannot agree on a common codec during SDP negotiation, the call fails. If they do agree but a middlebox (like an SBC or PBX) needs to convert between codecs for different call legs, that conversion is called transcoding. Transcoding adds latency, consumes processing resources, and reduces audio quality because it introduces a second round of compression artifacts.

codecg711g729opuscall-qualitybandwidthvoip-fundamentals

Share

Opens your messaging app. We do not collect or store any phone numbers.
Opens your email client. We do not collect or store any email addresses through sharing.

Want to know when we publish new articles? Sign up for updates