Posted by: Lloyd Puckitt on: October 14, 2007
Original script page;
Asterisk music on hold
This script converts a directory full of MP3s to another directory with the same files in native formats (WAV, GSM and U-Law) – see recipe Music-on-hold without MPG123 for an overview of how this works.
FROMDIR=”/root/mp3s”
TODIR=”/root/transcodes”
for i in $FROMDIR/*.mp3
do
BASEFILE=$(basename $i .mp3)
echo Converting $BASEFILE
mpg123 -s –rate 44100 –mono $FROMDIR/$BASEFILE.mp3 > $TODIR/$BASEFILE.raw
sox -r [...]