Greg
Indeed.
- Messages
- 1,600
It always annoys me to have to convert M4As for use on my MP3 player, etc., so I've created this BASH script to convert any M4As in a directory to MP3 all at once.
I kinda stole some of the the middle part with all the sed junk from somewhere on the internet, and I'd give him credit, but I don't remember where I got it from
To use it you need faad and lame.
To use it just place it in /usr/bin/, navigate to your desired directory, and run it. It will create a separate folder named "MP3" for all of the MP3s, and will leave your original M4As alone. If you don't like how it names them then just edit line 15, you can figure it out. If your M4As don't have proper tags and it is screwing up the filenames, then comment out line 15 and the end result will probably be something like "originalfilename.m4a.mp3"
I posted this because I hate seeing the Linux section dead for so long :happy:
I kinda stole some of the the middle part with all the sed junk from somewhere on the internet, and I'd give him credit, but I don't remember where I got it from
To use it you need faad and lame.
Code:
#!/bin/bash
mkdir "MP3"
for file in *.m4a; do
faad -o "MP3/temp.wav" "$file"
faad -i "$file" 2>MP3/tags.txt
title=`grep 'title: ' MP3/tags.txt|sed -e 's/title: //'`
artist=`grep 'artist: ' MP3/tags.txt|sed -e 's/artist: //'`
album=`grep 'album: ' MP3/tags.txt|sed -e 's/album: //'`
genre=`grep 'genre: ' MP3/tags.txt|sed -e 's/genre: //'`
track=`grep 'track: ' MP3/tags.txt|sed -e 's/track: //'`
year=`grep 'year: ' MP3/tags.txt|sed -e 's/year: //'`
lame -h -b 192 --tt "$title" --ta "$artist" --tl "$album" --tn "$track" --ty "$year" "MP3/temp.wav" "MP3/$file".mp3
rm "MP3/temp.wav"
rm MP3/tags.txt
mv "MP3/$file".mp3 "MP3/$artist - $title".mp3
done
I posted this because I hate seeing the Linux section dead for so long :happy: