VoIP codecs have a direct impact on the quality, compression, and bandwidth usage of VoIP calls. The most common is G.711, which is a narrowband codec configured to provide crystal-clear voice communication.
G.711 has its merits, but it isn’t always the best. In fact, a few other VoIP codecs have advanced features that are better suited for certain scenarios.
What do VoIP codecs do?
The term codec stands for compression and decompression — or code and decode.
During a call, voice signals are converted into digital data packets before being transmitted over the internet. VoIP codecs further compress that data to ensure it gets to the receiver quickly. Its goal is maintaining optimal bandwidth usage without sacrificing audio quality. On the receiving end, the compressed data is decompressed and converted back into voice signals.
There are several codecs supported by VoIP providers, so the sender and receiver will often have to “negotiate” and decide on the best codec to use. For communication to work, both the sender and receiver must use the same codec — one that’s supported by both devices.
VoIP codecs rely on a several important components, including:
- Sample rate: During a call, analog voice data is “sampled” at regular intervals and converted into data packets. Each sample contains a piece of digital audio data. The sample rate is the frequency (in Hz) at which a VoIP codec can measure and collect samples. High sample rates produce higher fidelity audio but require more bandwidth. Low sample rates require less bandwidth but capture less detail, leading to poor call quality.
- Bandwidth: Measured in bits per second (bps), bandwidth represents the amount of data that can be transmitted over a network channel. Though most VoIP bandwidth requirements are low, some codecs require high bandwidth usage, which can come at the cost of latency.
- Bitrate: This is the amount of data captured in a sample. It determines audio quality. Codecs with high bit rates will produce better sound quality.
Why is G.711 such a popular choice?
People use it because it’s a safe bet — it’s simple, free, and designed specifically for telephony.
Narrowband codecs, like G.711, prioritize speech rather than music. This makes it suitable for scenarios in which clear, low-latency voice communication is top priority.
Unlike other codecs, it doesn’t compress voice data. Instead, it uses PCM, or Pulse Control Modulation, operating at a fixed bit rate of 64kbps with a sample rate of 8kHz. Since voice data has a narrow frequency range of up to 4kHz, it’s able to accurately capture human voices with minimal distortion.
There are two variants of the G.711 codec: μ-law and A-law. The μ-law variant is used in Japan and North America, while the A-law variant is predominantly used in Europe.
However, it poses a problem. Because G.711 doesn’t compress voice, it uses more data and has a relatively high bandwidth requirement. This can be an issue when there’s limited available bandwidth or the telephone network has a low capacity. In this case, you’re better off using a codec that’s optimized around bandwidth.
Four additional VoIP codecs and when to use them
Every codec has its strengths and weaknesses, giving you the option to choose one that aligns with your needs. Here are four alternative VoIP codecs you can try if G.711 doesn’t cut it.
G.722: Superior audio quality
G.722 is a royalty-free, wideband codec covering a frequency range of 50Hz to 7kHz, offering HD audio. Compared to G.711 — which only covers up to 4kHz — this codec captures a greater range of human speech.
Naturally, G.722 has a high bandwidth requirement, operating at three different bitrates of 48kbps, 56kbps, and 64kbps. Its sample rate is 16kHz, which is double the sample rate of G.711. Nevertheless, both codecs use a similar amount of bandwidth — the main difference is that G.711 is fixed at 64kbps, while G.722 has a variable bitrate.
G.722 uses a compression technique known as Subband Adaptive Differential Pulse Code Modulation (SB-ADPCM).
With it, audio signals are separated into subbands. Higher-frequency signals are compressed separately from lower-frequency signals. This helps produce high-quality audio that sounds natural while optimizing the use of available bandwidth.
The major drawback of G.722 is compatibility — it’s not widely supported by VoIP providers.
However, there are a few that support it. When your devices allow, it’s a reliable VoIP codec that’s great for scenarios that require superior voice quality or when a connection is unstable.
Opus: Low latency in low bandwidth situations
Opus is an ultra-wideband codec with a frequency range of 50Hz to 20kHz. Like G.722, it’s (more than) capable of HD voice.
It’s also open-source and royalty-free with no recurring licensing fees — anyone can use it at no cost.
Catering for both narrow and wideband, Opus has a variable bitrate ranging from as low as 8kbps up to 512kbps. It can also adjust bandwidth usage to the state of your network on top of a very high sample rate of up to 48kHz.
Despite its growing popularity, Opus isn’t as widely supported as G.711 nor is it as wide-ranged as G.722.
Its main drawback is complexity — it uses advanced compression techniques that require more processing power. Nevertheless, it still produces better audio than G.711 at low bitrates.
Ultimately, Opus is ideal in scenarios that require low latency over low bandwidth. It’s also useful when you need to transmit music, which operates at a much wider frequency range than human speech — namely, from 20Hz to 20kHz.
G.729: Moderate quality in high network traffic scenarios
In contrast to Opus, G.729 is a narrowband VoIP codec that operates with a fixed bitrate of just 8kbps. It’s significantly less than the 64kbps of both G.711 and G.722.
But it has a sample rate of 8kHz, which is the same as G.711.
G.729 uses an aggressive compression technique that produces micro data packets from analog voice signals. As such, it only offers moderate audio quality compared to the others.
Its real power is in high traffic, low bandwidth environments because it can support a higher volume of simultaneous calls, much like you’d see in a call center. G.729 can also ensure good voice communication in scenarios where the network is severely limited.
AMR-WB: For capturing more than voice
AMR-WB stands for Adaptive Multi-Rate Wideband. It’s also known as G.722.2, which is a more advanced version of the G.722 codec.
G.722.2 operates on a frequency range of 50Hz to 7kHz and can capture HD audio. It also has variable bit rates from 6.6kbps to 23.85kbps, meaning it can adapt to changing network conditions.
This codec is ideal for both speech and music, which is why it’s widely used in mobile phone networks. In contrast, G.711 was intended for use in traditional telephone communication through the PSTN.
G.722.2 also enjoys widespread support, ensuring interoperability across different VoIP devices and systems.
High-level VoIP codecs recap
G.711 is a reliable codec for traditional voice communication, but it isn’t your only option. Other high-quality codecs include:
- G.722: Superior audio quality and flexibility.
- Opus: Low latency when dealing with network instability.
- G.729: Acceptable quality in high-traffic environments.
- AMR-WB: Capture HD voice and music.