Converting m4a to mp3 via Script

by bitznbitez

I have a bunch of music in m4a ( Mpeg4 Audio ) format that I think came via iTunes imports.   I have long ago quit using iTunes and am just using Banshee on linux, formerly Ubuntu but now Mint.    I am unable to play these songs on a Windows XP system because the Media Player does not recognize the format.   I cannot install iTunes in order to play them because the laptop is not mine and I am prohibited from installing software.

The solution of course is to convert the songs to mp3 on the linux system so I can play them on Windows Media Player.    The following will work on Ubuntu and Mint, etc.

First install two packages, faab and lame

sudo bash

apt-get install faab
apt-get install lame

Then I cd’d into the tree containing the files I wished to convert.   As always I kept a backup copy of all the files in case something went wrong my music would not be lost.   I ran the following script

open (FILES,"find . -name '*.m4a' -print | sed '/\.m4a/s///' |") || die "Cannot open file list";

    chomp $_;
    printf("faad -o - \"%s.m4a\" | lame - \"%s.mp3\"\n", $_, $_);

The results of this script were redirected to convert_it.bash and then I ran “bash convert_it.bash”

This worked fine except for three files that had double quotation marks, rather than make the script more robust I converted them by hand.