m4a2mp3.sh

My buddy rips and encodes his CDs with the AAC codec. This proves to be an issue if your mp3 player doesn’t support .m4a’s. Here’s a nice script to convert the m4a’s to mp3 using for loops and faad. You will need to install faad if you do not already have it installed.

#!/bin/bash
#
# Dump m4a to wav (first step in conversion)
#-ao pcm:file=<filename> instead.
for i in *.m4a
do
faad -o - "$i" | lame -h -b 192 - "${i%m4a}mp3"
done

You can change the bitrate to whatever you prefer. In this script it is set to 192kbps. This value is set by the -b flag.

Leave a Reply

You must be logged in to post a comment.