Blog
VoIP

Voice Codecs: G.711, G.729 and Opus in Practice

Compare G.711, G.729 and Opus codecs in terms of bandwidth, quality and practical use. Learn when to use each one and how to configure codec priority in your softswitch.

SipPulse - Technical TeamJune 16, 20257 min read
Share
Voice Codecs: G.711, G.729 and Opus in Practice

Why Codec Choice Matters

The voice codec determines how audio is compressed and transmitted in a VoIP call. The wrong choice can result in excessive bandwidth consumption, poor audio quality, or unnecessary CPU load from transcoding. For ISPs, STFC carriers, and contact centers, understanding the differences between codecs is essential for network sizing and subscriber satisfaction.

G.711: The Reference Standard

G.711 is the oldest and most widely used codec in telephony networks. It operates in two variants:

  • G.711 alaw (A-law): used in Europe and most of the world, including Brazil.
  • G.711 ulaw (mu-law): used in North America and Japan.

Key characteristics:

  • Bitrate: 64 kbps per direction (128 kbps full-duplex)
  • Quality: MOS around 4.1 to 4.4 (excellent)
  • Complexity: very low, no significant compression
  • Bandwidth per call: approximately 87 kbps with RTP/UDP/IP overhead (20ms packets)

G.711 is the right choice when bandwidth is not a constraint, such as in LAN networks, data centers, or dedicated interconnection links. Its main advantage is the absence of encoding latency and universal compatibility with any SIP equipment.

G.729: Efficiency for Limited Bandwidth

G.729 compresses voice to a fraction of what G.711 consumes:

  • Bitrate: 8 kbps per direction
  • Quality: MOS around 3.7 to 3.9 (good)
  • Complexity: medium (requires DSP processing)
  • Bandwidth per call: approximately 31 kbps with RTP/UDP/IP overhead (20ms packets)

G.729 is widely used when bandwidth is limited or expensive, such as on WAN links, internet-based interconnection, or operations with large volumes of concurrent calls. The downside is that each G.729 to G.711 transcoding (or vice versa) adds latency and consumes CPU.

Note on licensing: the G.729 patent has expired, making it free to use without royalty payments. The G.729a (Annex A) variant offers lower computational complexity with similar quality.

Opus: The Modern Codec

Opus is an open, royalty-free codec developed by the IETF (RFC 6716). It is the default codec for WebRTC and has been gaining traction in modern VoIP operations:

  • Bitrate: adaptive, from 6 to 510 kbps
  • Quality: MOS above 4.5 at bitrates above 20 kbps (excellent to superior)
  • Complexity: medium to high
  • Bandwidth per call: variable, typically 20 to 40 kbps for excellent voice quality

Opus automatically adapts to network conditions, reducing bitrate when it detects congestion and increasing it when bandwidth is available. It supports both voice (narrowband and wideband) and high-fidelity audio.

The primary use case for Opus today is in WebRTC applications (web softphones, browser integrations) and in VoIP networks seeking superior quality without the bandwidth cost of G.711.

Practical Comparison

CodecBitrateBandwidth/callMOSBest use
G.71164 kbps~87 kbps4.1-4.4LAN, dedicated interconnection
G.7298 kbps~31 kbps3.7-3.9WAN, limited links
Opus6-510 kbps~20-40 kbps4.0-4.9WebRTC, modern applications

Codec Negotiation in SIP (SDP)

When two parties start a SIP call, codec negotiation happens via SDP (Session Description Protocol) within INVITE and 200 OK methods. In SDP, each codec is identified by a payload type:

  • G.711 ulaw: payload type 0
  • G.711 alaw: payload type 8
  • G.729: payload type 18
  • Opus: dynamic payload type (typically 111)

The order of codecs in the m=audio line of the SDP defines priority. The first codec listed is preferred. The SipPulse SoftSwitch allows you to configure this priority flexibly per subscriber, per route, or per service profile.

Transcoding Cost

When both sides of a call use different codecs, the intermediary element (softswitch or SBC) needs to transcode. Each transcoded session consumes significantly more resources:

  • A G.711 passthrough session consumes almost zero CPU on the media relay.
  • A G.729 to G.711 transcoded session can consume 10 to 20 times more CPU.

For large-scale operations, minimize transcoding by configuring endpoints to support the same codecs and prioritizing compatible codecs in SDP negotiation.

Codec Configuration in SipPulse SoftSwitch

The SipPulse SoftSwitch offers granular control over codec configuration through its management interface. With capacity of up to 1,000 CAPS (calls per second) and support for Class 4 and Class 5 switching, the SoftSwitch manages codec negotiation efficiently even in high-volume operations.

Configuration per Subscriber Profile

In the SipPulse SoftSwitch interface, you can define the list of allowed codecs for each subscriber profile:

  • Residential subscribers: prioritize G.711 alaw for maximum quality on fiber networks, with G.729 as fallback for congestion scenarios.
  • Enterprise subscribers: enable G.711 alaw and Opus, offering HD quality when the endpoint supports it.
  • Contact center SIP trunks: configure G.711 as primary to ensure compatibility with dialing platforms, and G.729 for bandwidth savings on long-distance trunks.

Configuration per Route

The SipPulse SoftSwitch allows you to define specific codecs per outbound route:

  • Local interconnection routes: G.711 alaw as primary, ensuring maximum quality on dedicated links between carriers.
  • Internet-based interconnection routes: G.729 as primary, saving bandwidth without perceptible quality sacrifice.
  • WebRTC routes: Opus as primary, leveraging adaptive bitrate for connections with variable quality.

Codec Monitoring in CDRs

The SipPulse SoftSwitch records the negotiated codec in each CDR (Call Detail Record), allowing the operator to track:

  • Codec distribution by route and by time period
  • Percentage of calls that required transcoding
  • Transcoding impact on quality (correlating codec with MOS metrics when available)

Transcoding in SipPulse SBC

The SipPulse SBC complements the SoftSwitch in codec management, acting as the transcoding point at the network edge. Integrated with RTPEngine, the SipPulse SBC performs transcoding transparently:

  • Codec conversion at the edge: when an external endpoint uses a codec different from the one configured on the internal network, the SBC converts automatically with no perceptible impact on latency.
  • WebRTC support: the SBC converts Opus (used by WebRTC browsers) to G.711 or G.729 (used by traditional SIP equipment), allowing contact center agents to use browser-based softphones to handle calls from subscribers with conventional IP phones.
  • Selective transcoding: the SBC can be configured to transcode only when necessary, passing through when both sides support the same codec, saving processing resources.

Transcoding Capacity

The SipPulse SBC supports up to 4,000 concurrent calls per channel. In passthrough mode (no transcoding), capacity is maximized. In transcoding mode, capacity varies depending on the codec pair involved, but the architecture allows horizontal scaling by adding media processing channels as demand grows.

Practical Recommendations for ISPs and Carriers

Based on SipPulse's experience with STFC and contact center operations in Brazil, we recommend:

  1. Standardize G.711 alaw on the internal network: this eliminates the need for transcoding between your own network elements.
  2. Use G.729 on internet-based interconnections: this reduces bandwidth consumption on shared links without significant quality impact.
  3. Enable Opus for WebRTC: if your operation includes web softphones or integration with Zoom/Teams via Oleg on the SipPulse SBC, Opus offers the best quality-to-bandwidth ratio.
  4. Monitor transcoding: use the SipPulse SoftSwitch CDR reports to identify routes with high transcoding percentages and optimize endpoint codec configuration.
  5. Configure the SipPulse SBC for selective transcoding: avoid transcoding when both sides support the same codec, reserving media resources for situations that truly require conversion.

References

#codecs#G.711#G.729#Opus#VoIP#quality

Related Articles