Installing Media Conversion Libraries

 

Asterisk itself can transcode many audio formats such as g722, alaw and ulaw to name a few. Over the years FreePBX itself has required a few binaries to deal with importing MP3s and generating some wav files. These two binaries are important today so make sure they are installed before reading the rest of this article:

  • sox (general conversion utility)

  • mpg123 (allows uploading of MP3 files)

However Asterisk itself is unable to convert many files into HTML5 compatible audio types even with the two programs above!

What is an "HTML5 compatible audio file"?

Before HTML5, there was no standard for playing audio files on a web page. Before HTML5, audio files could only be played with a plug-in (like quicktime). With HTML5 audio files are able to be played back natively in your browser!

Great! So generate the HTML5 files for me

Unfortunately every browser supports a formats of audio files. We can't just generate a wav file and expect all browsers to understand it.

Wikipedia has a list of the different formats supported by different browsers – see the table at https://en.wikipedia.org/wiki/HTML5_Audio .

Ok. So can you generate the different formats?

This is where the fun begins. Unfortunately due to licensing and legalities we are not able to distribute anything that makes MP3 or MP4 (M4A) files. However it's not illegal for you to compile the binaries for these programs yourself. After you've installed them FreePBX can transcode your audio files for you!

So what do I have to do?

There are different options for different types of files. After looking at the table above you need to decide what you want to support. After the libraries have been installed FreePBX will automatically detect them and use them to create files.

WAV

WAV files can be generated through either Asterisk itself or through SOX. In nearly all distributions you can download and install SOX through rpm repositories (yum install sox or apt-get install sox)

OGG (OGA)

OGG/OGA files can be generated through SOX. You can download and install SOX through rpm repositories (yum install sox or apt-get install sox)

MP3

MP3 files are usually generated through a program called LAME. There are several install guides for LAME online. A good starting point would be: http://lame.sourceforge.net/

MP4 (M4A)

MP4/M4A files are usually generated through a program called FFMPEG. There are several install guides for FFMPEG online. A good starting point would be: https://www.ffmpeg.org/

Return to Documentation Home I Return to Sangoma Support