WARNING!!: THE FOLLOWING SCRIPT CONVERTS .M4A'S TO .MP3'S. THE PROCESS CONVERTS .M4A'S TO .WAV'S FIRST, WHICH ARE QUITE LARGE(~400MB), SO BE SURE TO HAVE SOME EXTRA SPACE ON YOUR HARD DRIVE SO THE SCRIPT CAN COMPLETE. THE ORIGINAL FILES AS WELL AS THE .WAVS ARE DELETED AT THE END OF THE SCRIPT. IF YOU DON'T WANT THIS TO HAPPEN REMOVE THE APPROPRIATE LINES FROM THE BOTTOM. YOU HAVE BEEN WARNED!!!
WARNING!!: THE FOLLOWING CONVERSION PROCESS STRIPS THE FILES OF ANY META-DATA(i.e Artists,Albums) ASSOCIATED WITH THEM. YOU WILL HAVE TO RE-APPLY THE META-DATA WITH SOME OTHER APP. YOU HAVE BEEN WARNED!!
NOTE: This HOWTO assumes you have mplayer and lame installed.
1. First of of all make a file for the conversion script and call it whatever you please. Copy the following into that file. I named my allinone.sh
CODE
#!/bin/bash
#
# Dump m4a to wav (first step in conversion)
for i in *.m4a
do
mplayer -ao pcm "$i" -aofile "$i.wav"
done
#!/bin/bash
#
#Second step... use lame to convert into .mp3
for i in *.wav
do
lame -h -b 192 "$i" "$i.mp3"
done
#!/bin/bash
#
# Remove extrenuous extensions.
for i in *.mp3
do
x=`echo "$i"|sed -e 's/m4a.wav.mp3/mp3/'`
mv "$i" "$x"
done
rm *.wav
rm *.m4a
2. Now give the file execution access with chmod +x allinone.sh
3.Next get your .m4a files you want to convert organized. Mine are still in the directory structure that iTunes has, Artists as root directories with Albums as subdirectories. Or maybe you have all your music in one folder
CODE
albert@albert-linux ~/albert-drive/music/metallica/black album $ ls
01 enter sandman.m4a 05 wherever i may roam.m4a 09 of wolf and man.m4a
02 sad but true.m4a 06 don't tread on me.m4a 10 the god that failed.m4a
03 holier than thou.m4a 07 through the never.m4a 11 my friend of misery.m4a
04 the unforgiven.m4a 08 nothing else matters.m4a 12 the struggle within.m4a
4. Run the script from the location you saved it with ./allinone.sh
5. Depending on the size/number of files in the directory you run the script on it may take some time to complete. But the result is .mp3's from .m4a's!!
6. Re-apply meta-data if you wish....rinse/repeate/enjoy