[Asterisk-Users] How "expensive" are the different
codecs?(Regarding CPU time)
Jim Van Meggelen
jim at vanmeggelen.ca
Wed Dec 15 10:08:24 MST 2004
> -----Original Message-----
> From: asterisk-users-bounces at lists.digium.com
> [mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of
> Michael Vogel
> Sent: December 15, 2004 10:26 AM
> To: Asterisk Users Mailing List - Non-Commercial Discussion
> Subject: [Asterisk-Users] How "expensive" are the different
> codecs?(Regarding CPU time)
>
>
> Hi!
>
> The encoding, decoding and recoding cost cpu time, that's
> sure. But does
> this time differs much depending on the used codec?
Absolutely.
>
> Is - for example - a G729 faster than a GSM codec?
The Asterisk console command (at the CLI> prompt):
show translation
Will provide a matrix that gives an idea of the CPU penalty of each
codec on your system. One of my lab systems returned this (sorry, I
haven't licensed G.729 yet):
(view with a fixed-width font such as courier)
Translation times between formats (in milliseconds)
Source Format (Rows) Destination Format(Columns)
g723 gsm ulaw alaw g726 adpcm slin lpc10 g729 speex
ilbc
g723 - - - - - - - - - -
-
gsm - - 2 2 3 2 1 4 - -
18
ulaw - 3 - 1 3 2 1 4 - -
18
alaw - 3 1 - 3 2 1 4 - -
18
g726 - 4 3 3 - 3 2 5 - -
19
adpcm - 3 2 2 3 - 1 4 - -
18
slin - 2 1 1 2 1 - 3 - -
17
lpc10 - 4 3 3 4 3 2 - - -
19
g729 - - - - - - - - - -
-
speex - - - - - - - - - -
-
ilbc - 4 3 3 4 3 2 5 - -
-
The rule of thumb is generally this: the more bandwidth a codec uses,
the less CPU it will require. So G.711 uses the most bandwidth, but
almost no CPU. Conversely, a highly compressed codec will require the
CPU to perform complex calculations on it; the better the compression,
the more time it will take. Some codecs are better than others (GSM is
pretty easy on the CPU relative to it's bandwidth).
I'll paraphrase that old adage:
- Low Bandwidth
- Low CPU Use
- Reasonable Audio Quality
Pick any two.
Keep in mind that the only time a codec will eat up CPU is if
transcoding is required. If Asterisk does not need to convert between
formats, then the load on the CPU will be essentially the same,
regardless of the codec in use.
More information about the asterisk-users
mailing list