Converting MP3 to Asterisk PBX recordings

How to install FFmpeg on Ubuntu 14.04

FFmpeg has been removed from Ubuntu 14.04 and was replaced by Libav. This decision has been reversed so that FFmpeg is available now in Ubuntu 15.04 again, but there is still no official package for 14.04. In this tutorial, I will show you how to install FFmpeg from mc3man ppa.

Install ffmpeg Package

Add FFMpeg PPA Repository to Ubuntu 14.04 LTS

sudo add-apt-repository ppa:mc3man/trusty-media -y
More info: https://launchpad.net/~mc3man/+archive/ubuntu/trusty-media
Press [ENTER] to continue or ctrl-c to cancel adding it

 

Update the package list & Install ffmpeg

sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get install ffmpeg

 

Converting your MP3s

Command line for encoding all your mp3’s in some directory using ffmpeg to a mono WAV and PCM u-Law file of 64kbits/s at 8000Hz sample rate.
These files will sound fine down a phone line. But not at a disco! The resulting WAV and PCM u-Law files will be larger then the original mp3, but that’s no big deal.

for f in `ls *.mp3` ; do FILE=$(basename $f .mp3) ; ffmpeg -i $FILE.mp3 -ar 8000 -ac 1 -ab 64 $FILE.wav -ar 8000 -ac 1 -ab 64 -f mulaw $FILE.pcm -map 0:0 -map 0:0 ; done
Icon

If your filenames have spaces in them, you’ll need to modify the command to something like this:

 

 

 

IFS=$'\n' ; for f in `ls -1 *.mp3` ; do FILE=$(basename "$f" .mp3) ; ffmpeg -i "$FILE.mp3" -ar 8000 -ac 1 -ab 64 "$FILE.wav" -ar 8000 -ac 1 -ab 64 -f mulaw "$FILE.pcm" -map 0:0 -map 0:0 ; done