A codec (short for coder-decoder) is the method a phone, softphone, video app or gateway uses to turn sound or video into digital data that can travel over a network, and to turn that data back into sound or video at the other end. Every VoIP call, SIP trunk call and video meeting uses at least one codec. The codec affects how the call sounds, how much bandwidth it uses and how well it copes with network problems, and both ends of a call must agree on one or have something in the middle that converts between them.
At a glance
- Common voice codecs include G.711 (traditional phone quality), G.729 (low bandwidth), G.722 (wideband, or “HD voice”) and Opus (adaptive, common in browser and app calling).
- Codec choice trades off sound quality, bandwidth use and tolerance of jitter and packet loss.
- The two ends negotiate a shared codec when a call is set up, typically through SIP signaling.
- When there is no shared codec, a gateway or session border controller can transcode, which adds delay and may reduce quality.
- Compressed codecs can break fax, modem and some alarm panel signals.
What problem it solves
Networks carry data, not sound. A codec samples the speaker’s voice, converts it into a stream of digital values, often compresses it, and splits it into packets. At the far end, a matching decoder rebuilds the sound. Without an agreed codec, the two ends of a call could not understand each other’s audio.
Codecs also let buyers balance quality against capacity. An uncompressed or lightly compressed codec sounds closer to a traditional phone line and is less sensitive to small problems, but uses more bandwidth. Heavier compression saves bandwidth, which mattered more when sites had slow links and still matters on constrained connections, but can reduce clarity and makes the call more vulnerable to lost packets.
How it works
Encoding. The codec samples the audio many thousands of times a second and represents each sample as data. Narrowband codecs such as G.711 and G.729 capture roughly the frequency range of a traditional phone call. Wideband codecs such as G.722 and Opus capture a wider range, so voices sound fuller and easier to understand.
Compression and packetization. Many codecs compress the audio to reduce the bit rate. The encoded audio is then split into small packets, commonly every 20 milliseconds, each carrying network headers. Those headers add meaningful overhead, so the bandwidth a call actually uses on the network is noticeably higher than the codec’s own bit rate.
Negotiation. When a call is set up, each side lists the codecs it supports in order of preference, usually as part of Session Initiation Protocol (SIP) signaling. They pick one both support. Browser-based calling built on WebRTC does the same, and Opus is a common choice there.
Coping with network problems. Jitter and packet loss damage audio regardless of codec. Some codecs, Opus in particular, adapt their bit rate and include techniques to conceal or recover lost audio; older codecs rely more on the phone’s jitter buffer and loss concealment. Call quality scores such as mean opinion score (MOS) are often estimated with the codec in mind, since each has a different best-case score.
Transcoding. If a desk phone only supports one codec and the carrier only accepts another, a session border controller or provider gateway converts between them. Each conversion adds processing delay and can lose some quality.
Tones and fax. Touch-tone digits are often sent as separate signaling events rather than in the audio, because compression can distort them. Fax and modem signals are similarly fragile, which is why fax over IP commonly relies on G.711 passthrough or the T.38 protocol.
If you are planning a move to SIP trunks, see our SIP trunking solution page.
When it matters for buyers
- Moving to VoIP, UCaaS or SIP trunks. Confirm which codecs your phones, PBX, SBC and provider share, so calls are not transcoded unnecessarily.
- Sizing internet or WAN links. Peak concurrent calls multiplied by per-call bandwidth for your codec tells you how much capacity voice needs.
- Call quality complaints. Codec mismatches, transcoding and heavily compressed codecs on a lossy network are common causes worth ruling out.
- Fax, alarm and elevator lines. These analog devices often need specific codec settings or a different service entirely.
- Wanting clearer calls. HD voice only works end to end when both phones, every system in between and the far end support a wideband codec.
Questions to ask vendors
- Which codecs do you support on SIP trunks and on your phones and apps, and in what order of preference?
- Is HD voice supported end to end, including on calls to and from the public telephone network?
- Where in your network, if anywhere, will our calls be transcoded?
- What per-call bandwidth figure should we use for planning, including overhead?
- How do you handle touch-tone digits, fax and analog devices such as alarm panels?
- Can we set codec preferences per site, for example on a site with a constrained connection?
How it differs from SIP
A codec and SIP do different jobs on the same call. SIP is a signaling protocol: it sets up, changes and ends the call, and during setup it carries the list of codecs each side supports. The codec handles the media itself, turning voice into data and back. A call can use SIP with any of several codecs, and the same codec can be used by systems that do not use SIP at all.
