Native codec recordings vs. RAW format


I’m trying to get a handle on audio format trade-offs… I’m focusing on scalability:

  1. If a connected caller is using g.711 codec, does Asterisk actually use less resources (i.e. CPU) if a playback soundfile is saved in g.711 format versus a raw audio format?
  2. I’ve seen some websites espouse the use of raw audio format… is this just a compromise to support any incoming caller codec with less transcoding effort than from mp3 or wav etc., while avoiding a copy of each soundfile in every codec supported?




  1. As soon as you use a codec to compress audio data, it’s sure it take more cpu ressouces to decode it than decoding the same data but not compressed (raw).

  2. Not sure to understand waht you mean


Let’s say I have a music on hold audio file saved in g.711 encoding (8-bit PCM logarithmic companding according to u-law).

If someone calls in and the call is using g.711 codec, it seems that asterisk should be smart enough to say “hey, my call is in g.711, the audio source is g.711, why not just stream the file out and skip all this decoding of source and encoding for playout business!” Maybe asterisk already does this (I don’t know).

That would in my mind reduce CPU consumption vs. the option of using a RAW format. RAW format is better than mp3, wav, or gsm (if the call is using a codec other than GSM). But still have to encode the RAW format to g.711 for output. Granted this is not much transcoding effort, but it would make a difference for a large machine with 100s or 1000s of active calls and no TDM interfaces.

Is this a new feature request (i.e. asterisk recognize that source is already encoded in desired output and bypass any transcoding steps) or is this already supported?