How to Avoid G711<->G729 Transcoding CPU Penalty
g711u(/a, aka ulaw/alaw) is a free codec with the highest voice quality and low CPU costs, but it consumes high bandwidth. g729a is a low bandwidth codec but has high CPU penalty, because of that many voice broadcast (and similar) systems avoid g729a – but that’s a mistake.
There are many blogs out there that explain the difference between g729a and g711u such as “g711 vs g729 codec” which also explain how to install in Asterisk the free g729a codec implementation (note that g729a is under patent). To be brief, g729a consumes much more CPU and much less bandwidth with somewhat degraded voice quality. g711u has the best voice quality, low CPU, but consumes high bandwidth.
When using g729a in call-centers, voice broadcasts and more, it is important to remember that the CPU cost of g729a is only when you need to *encode the voice into g729a format*. Let’s take a look at the following example scenarios:
X-Lite as g711u -> Asterisk (transcoding g711u to g729a) -> CommPeak
In this scenario, the Asterisk will be a CPU bottleneck because as more agents are calling, Asterisk will need to decode the g711u and encode it to g729a, then send the RTP (=voice) packets to CommPeak.
Pros: Free softphone for each agent; low bandwidth for voice traffic = low cost internet.
Cons: Doesn’t sound as good as g711u; Asterisk becomes a CPU bottleneck and has a finite number of calls it can handle (without a hardware upgrade).
Vicidial performs Voice Broadcast -> Asterisk (transcoding prerecorded wav files to g729a) -> CommPeak
Vicidial makes a call, the callee answers; Asterisk transcodes the prerecorded wav (.mp3, .gsm) to g729a and sends the RTP packets to CommPeak.
Pros: A user can easily place audio files using any format; Asterisk will convert any format to the relevant codec (g729a) and send the traffic out; low bandwidth.
Cons: High CPU cost at each call because of wav to g729a transcoding.
Bria (commercial version of X-Lite) with g729 -> Asterisk (packet to packet bridging, g729a is passthrough) -> CommPeak
Because Bria encodes the voice in g729a, Asterisk has no need to transcode the voice packets to any other format; it can then pass the packets as-is to CommPeak.
Pros: Asterisk can handle much more traffic; low bandwidth.
Cons: Higher one-time cost per seat; CPU will still be high in conference calls or any other call where Asterisk requires to interfere with the audio (audio mixing).
Vicidial performs Voice Broadcast of .g729a files -> Asterisk (g729a passthrough) -> CommPeak
Because the files were already prerecorded in g729a, Asterisk has no reason to perform any transcode and so there is no CPU intensive task to do.
Pros: Much higher capacity per Asterisk installation; low CPU; still same bandwidth.
Cons: Higher one-time cost per installation (in countries where the g729a patent applies); user might need to convert files to g729a and then upload.
If bandwidth doesn’t come cheap for you, it is best to use g729a and make sure that you perform the g729a voice encoding outside of your central bottleneck (Asterisk). Agent seats are a scalable resource (and the CPU cost on their workstation is minor), but Asterisk is not. In the case of voice broadcast, in most scenarios you simply want to encode the files in the codec you plan to send traffic with. Cost is a valuable consideration in voice broadcasts so it’s best to upload the files in g729a and send the traffic encoded in g729a.
Some people find it difficult to send voice broadcasts in g729a only because of the lack of wav to g729a converters. In the past it used to be a bigger issue but today you can find many of them such as this: (“Command line encoder and decoder“) or use Asterisk console to perform the transcoding.
Want to learn more about CommPeak and our range of services? Visit our voice termination website for more information.