Using ffmpeg to convert to Asterisk Native SLN

Asterisk's Native SLN audio format (1.2 and up) is "raw" or headerless "wav" format, little endian 16-bit signed PCM a.k.a. signed linear (hence SLN). While it seems that SoX or Audacity should be able to convert to this format, neither seems to be able to write little-endian 16-bit PCM.

ffmpeg, one of the best swiss-army-knife-type audio/video conversion programs, specifically supports signed 16-bit little-endian PCM. To convert just about any audio (anything ffmpeg can handle) to the appropriate format for Asterisk music-on-hold:

ffmpeg -i "[input file]" -ar 8000 -ac 1 -acodec pcm_s16le -f s16le "[output file].sln"

You may also want to add a volume modifier, to make the music appropriately quiet for music-on-hold, and ffmpeg allows this to be specified in dB gain like "-vol -15dB".

See also

Asterisk | Applications | Functions | Variables | Expressions | Asterisk FAQ

Created by: ilg, Last modification: Thu 05 of Dec, 2013 (07:44) by john8675309
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+