[LAU] Batch conversion from Apple AAC to mp3?

Julien Claassen julien at c-lab.de
Sat Dec 25 01:37:22 UTC 2010


Hello Mark!
   You can batch convert the aac files to mp3. If you directory structure is 
very consistent, you can do even the complete structure in one script. I thik 
there is a direct aac decoder, but if you don't find one or someone else can 
point you at it, mplayer will do the trick. For one directory this would be:
for F in *.aac; do
   mplayer -ao pcm:file=$F.wav $F
   lame -h $F.wav $F.mp3;
done
   So in a bigger context, say you have all the albums resting in one place, 
you might pack this loop into another:
for D in *; do
   cd $D
   for F in *.aac; do
   [what you've seen before...]
   mkdir /new/directory/$D
   mv *.mp3 /new/directory/$d
   rm *.wav
   cd ..;
done
   NOTE: This only works, if the directories and files don't have spaces in 
them. You can usually quote the variables you use like "$D" and that should 
help. But there were some cases - and please excuse me, if I don't remember 
them right now, being late and having partied -, where even this didn't work 
correctly. Mind you, I think this was using "find" somewhere in the euqation.
   If you have artist/album, you wrap the for D in * loop in another saying:
for A in *; do
   cd A
   mkdir /new/directory/$A
   for D in *; do;
   ...
   cd ..;
done
   NOTE2: You will losse the tags this way.
   Oh and if you want to correct the filenames to not end in .aac.mp3 you can 
use mmv:
mmv "*.aac.mp3" "#1.mp3"
   in the for F in *.aac; do loop, as the last line. Don't forget to add the 
semicolon.
   Sorry, if this mail was rather upside down and round and round. I am a bit 
fuzzy. Yet still I hope, that I could be of some assistence.
   Kindly yours
           Julien

--------
Music was my first love and it will be my last (John Miles)

======== FIND MY WEB-PROJECT AT: ========
http://ltsb.sourceforge.net
the Linux TextBased Studio guide
======= AND MY PERSONAL PAGES AT: =======
http://www.juliencoder.de


More information about the Linux-audio-user mailing list