GSMCalls

Codecs

CodecAlso known as Voice codec, Audio codec

Definition

A codec (coder-decoder) is an algorithm that converts analogue speech into a digital bitstream for transmission and back into audio at the far end. VoIP codecs trade bitrate, audio bandwidth, delay and processing load against each other; common examples are G.711, G.729, G.722 and Opus.

Common VoIP codecs compared

CodecStandardBitrateAudio bandTypical use
G.711ITU-T G.71164 kbit/s300–3400 Hz (narrowband)Default trunk codec, PSTN interconnect
G.729ITU-T G.7298 kbit/sNarrowbandLow-bandwidth and wholesale links
G.722ITU-T G.72264 kbit/s50–7000 Hz (wideband)HD voice desk phones
OpusIETF RFC 67166–510 kbit/sUp to 20 kHz (fullband)WebRTC, apps, variable networks
AMR-WB3GPP / ITU-T G.722.26.6–23.85 kbit/sWidebandMobile HD voice, VoLTE

Bitrates above are codec payload only. RTP, UDP and IP headers add about 16 kbit/s at 20 ms packetisation, which dominates for low-bitrate codecs.

Negotiation and transcoding

Endpoints list the codecs they support, in order of preference, in the SDP of a SIP INVITE; the answer selects one. If two legs of a call cannot agree, a PBX or SBC must transcode, which costs CPU, adds a few milliseconds and, between two lossy codecs, reduces quality. The best designs keep one codec end to end where possible and only transcode at a single, deliberate point.

Codecs in mobile gateway calls

Mobile networks use their own codecs (AMR, AMR-WB and EVS on VoLTE), so a GSM gateway always has a conversion point. GSMCalls uses G.711 or G.729 on the trunk side and G.722 or Opus on the device side where supported, and the Smart Bridge carries wideband G.722 audio from the phone; see GSM gateway without a PC.

Frequently asked questions

Which VoIP codec has the best quality?

Wideband codecs such as Opus and G.722 sound clearer than narrowband G.711 or G.729, provided both ends and every hop in between support them.

Which codec uses the least bandwidth?

Among common VoIP codecs, G.729 at 8 kbit/s payload (about 31 kbit/s on Ethernet) and low-rate Opus are the most efficient.

What happens if both sides do not share a codec?

The call fails with a 488 Not Acceptable Here, unless a PBX or SBC in the path transcodes between them.

Further reading

All glossary terms