Codecs

From FreeSWITCH Wiki
Jump to: navigation, search

Contents

Introduction

A codec is a compression scheme for a media stream or path. See this article for more information on the technical stuff: http://en.wikipedia.org/wiki/Codec.

HD Audio support

FreeSWITCH supports most HD audio codecs including Speex, G.722, G.722.1 (Siren) and SILK; BroadVoice codecs were added by Brian (bkw) just 90 minutes after official release.

Codecs in FreeSWITCH

FreeSWITCH supports a large number of VoIP compression codecs out of the box, however the default config does not enable them all for all transport types.

Where are the codecs? modules.conf.xml file

Codecs are built from various modules and from the core FreeSWITCH source (no need to load modules for them, they are in CORE_PCM_MODULE, eg: they're built in in core FreeSWITCH). For codecs not in core, you need to compile and load the corresponding module.

Following is the results from fs_cli command "show codec" in a default installation:

type,name,ikey
codec,ADPCM (IMA),mod_spandsp
codec,AMR,mod_amr
codec,G.711 alaw,CORE_PCM_MODULE
codec,G.711 ulaw,CORE_PCM_MODULE
codec,G.722,mod_spandsp
codec,G.723.1 6.3k,mod_g723_1
codec,G.726 16k,mod_spandsp
codec,G.726 16k (AAL2),mod_spandsp
codec,G.726 24k,mod_spandsp
codec,G.726 24k (AAL2),mod_spandsp
codec,G.726 32k,mod_spandsp
codec,G.726 32k (AAL2),mod_spandsp
codec,G.726 40k,mod_spandsp
codec,G.726 40k (AAL2),mod_spandsp
codec,G.729,mod_g729
codec,GSM,mod_spandsp
codec,H.261 Video (passthru),mod_h26x
codec,H.263 Video (passthru),mod_h26x
codec,H.263+ Video (passthru),mod_h26x
codec,H.263++ Video (passthru),mod_h26x
codec,H.264 Video (passthru),mod_h26x
codec,LPC-10,mod_spandsp
codec,PROXY PASS-THROUGH,CORE_PCM_MODULE
codec,PROXY VIDEO PASS-THROUGH,CORE_PCM_MODULE
codec,Polycom(R) G722.1/G722.1C,mod_siren
codec,RAW Signed Linear (16 bit),CORE_PCM_MODULE
codec,Speex,mod_speex
codec,iLBC,mod_ilbc

vars.xml file

The vars.xml file contains the the following right near the top of the file (line 59 and 60):

  <X-PRE-PROCESS cmd="set" data="global_codec_prefs=G722,PCMA,PCMU,GSM"/>
  <X-PRE-PROCESS cmd="set" data="outbound_codec_prefs=G722,PCMA,PCMU,GSM"/>

Note: iLBC@30i configures the iLBC codec to default to 30ms frames instead of 20ms frames which will allow you to receive iLBC calls from Asterisk servers which unfortunately do not correctly send their iLBC codec preferences.

Most transports (channels) have a config block at the top of their configuration file like the following:

<settings>
  <param name="codec-prefs" value="XXXXXXX"/>
</settings>

Note: There are generally other lines inside the <settings> block, but you can safely ignore them for now.

dingaling.conf.xml file

The default dingaling.conf.xml config contains the following (codec related) settings:

<settings>
  <param name="codec-prefs" value="PCMU"/>
</settings>

While you may use almost any codec you wish when using dingaling to talk between two FreeSWITCH servers, the official Google Talk(tm) client has some very peculiar quirks in its codec handling.

sofia.conf.xml file

The default sofia.conf.xml config contains the following (codec related) settings:

<settings>
 <param name="inbound-codec-prefs" value="$${global_codec_prefs}"/>
 <param name="outbound-codec-prefs" value="$${global_codec_prefs}"/>
</settings>

This allows Sofia-SIP to inherit the global_codec_prefs which we configured in vars.xml. I suggest you leave it that way, however you may manually specify a codec list if you wish.

Codec List

Transcodable codecs

The following codecs can be used when setting codec_string and absolute_codec_string.

  • iSAC
  • CODEC2 2550bps) 8000hz 20ms
  • SILK Skype Audio codec.
    • Provided by mod_silk.
  • iLBC@30i - iLBC using mode=30 which will win in all cases.
  • Speex
    • speex@8000h@20i - Speex 8kHz using 20ms ptime.
    • speex@16000h@20i - Speex 16kHz using 20ms ptime.
    • speex@32000h@20i - Speex 32kHz using 20ms ptime.
  • BroadVoice.
    • BV32 - BroadVoice 16kHz, 32kb/s wideband
    • BV16 - BroadVoice 8kHz, 16kb/s narrowband
      • Provided by mod_bv.
  • Siren
    • G7221@16000h - G722.1 16kHz (aka Siren 7)
    • G7221@32000h - G722.1C 32kHz (aka Siren 14)
  • CELT wideband.
    • CELT@32000h - CELT 32kHz, only 10ms supported
    • CELT@48000h - CELT 48kHz, only 10ms supported
  • DVI4@8000h@20i - IMA ADPCM 8kHz using 20ms ptime. (multiples of 10)
  • DVI4@16000h@40i - IMA ADPCM 16kHz using 40ms ptime. (multiples of 10)
  • GSM@40i - GSM 8kHz using 40ms ptime. (GSM is done in multiples of 20, Default is 20ms)
  • G722 - G722 16kHz using default 20ms ptime. (multiples of 10)
  • G726-16 - G726 16kbit adpcm using default 20ms ptime. (multiples of 10)
  • G726-24 - G726 24kbit adpcm using default 20ms ptime. (multiples of 10)
  • G726-32 - G726 32kbit adpcm using default 20ms ptime. (multiples of 10)
  • G726-40 - G726 40kbit adpcm using default 20ms ptime. (multiples of 10)
  • AAL2-G726-16 - Same as G726-16 but using AAL2 packing. (multiples of 10)
  • AAL2-G726-24 - Same as G726-24 but using AAL2 packing. (multiples of 10)
  • AAL2-G726-32 - Same as G726-32 but using AAL2 packing. (multiples of 10)
  • AAL2-G726-40 - Same as G726-40 but using AAL2 packing. (multiples of 10)
  • LPC - LPC10 using 90ms ptime (only supports 90ms at this time in FreeSWITCH)
  • G729 - G729 in transcoding mode
  • PCMU - G711 8kHz ulaw using default 20ms ptime. (multiples of 10)
  • PCMA - G711 8kHz alaw using default 20ms ptime. (multiples of 10)
  • L16 - L16 isn't recommended for VoIP but you can do it. L16 can exceed the MTU Rather quickly.
    • Provided in core PCM module.

Pass-through audio codecs

  • G729 - G729 in passthru mode. (mod_g729 / mod_com_g729)
  • G723 - G723.1 in passthru mode. (mod_g723_1)
  • AMR - AMR in passthru mode. (mod_amr)
  • AMR-WB (G.722.2) - AMR-WB in passthru mode. (mod_amr_wb)

Pass-through video codecs

  • H261 - H.261 Video
  • H263 - H.263 Video
  • H263-1998 - H.263-1998 Video
  • H263-2000 - H.263-2000 Video
  • H264 - H.264 Video
    • Provided by mod_h26X.
  • Theora passthrough.
    • Provided by mod_theora.
  • MP4 Video passthrough.
    • Provided by mod_mp4v.


media proxying

FreeSWITCH can proxy media between endpoints if is NATed or you want to do low usage of your CPU

why Should i use proxy media?

  • Low CPU usage*
  • Nat handling (RTP Side)
  • Pass through not supported Codecs like G721 / G728 / G719 / AMR and some other codecs*
  • Video conferencing through external MCU

Codecs ofered by Proxy_media

  • PROXY PASS-THROUGH to pass audio media in proxy mode
  • PROXY VIDEO PASS-THROUGH to pass video media in proxy mode

See Also

See Also