How to convert pesky .m4a to .mp3
I recently got a bunch of m4a files from a mac user from her band...I know I can play it with amarok but not xmms. Also why not just use mp3s which you know everyone and their grandma can use. So below is a quick bash script to automate the process. I'm sure there is a quicker way...but you can use this to convert to mp3s or ogg vorbis or whatever format you like.
Code:
#!/bin/bash
#
# Dump m4a to wav (first step in conversion)
y=`pwd`
cd "$1"
echo changing directory to $1
sleep 15
echo converting the damned .m4as to mp3s
for i in *.m4a
do
mplayer -ao pcm "$i" -aofile "$i.wav"
done
echo converting the damned .wavs to mp3s
for i in *.wav
do
lame -h -b 192 "$i" "$i.mp3"
done
echo renameding the damned mp3s
for i in *.mp3
do
x=`echo "$i"|sed -e 's/m4a.wav.mp3/mp3/'`
mv "$i" "$x"
done
rm *.wav
rm *.m4a
cd $y
echo changing back to $y
Re: How to convert pesky .m4a to .mp3
You should try downloading a program called "gnormalize". It will allow you to convert one or an entire directory of MP4 files into MP3 or another output format. Works great, and has a graphical interface to boot.
http://gnormalize.sourceforge.net/
Re: How to convert pesky .m4a to .mp3
Quote:
Originally Posted by dbeckham32
You should try downloading a program called "gnormalize". It will allow you to convert one or an entire directory of MP4 files into MP3 or another output format. Works great, and has a graphical interface to boot.
http://gnormalize.sourceforge.net/
thanks for the info will install it on my desktop. I wrote the script for the fileserver which holds my music which doens't have X installed so I wanted something to do over ssh. However I will definately in the future convert files before I move them to my fileserver. Thanks again
Re: How to convert pesky .m4a to .mp3
lol, funny thing is, I had to convert a bunch of m4a's that my bro gave me to mp3's so I can transfer them to my ipod with gtkpod, and had come up with this script:
Quote:
#!/bin/bash
for i in *.m4a; do
out=$(ls "$i" | sed -e 's/.m4a//g')
faad -w "$i" > "$out.wav"
done
for i in *.m4b; do
out=$(ls "$i" | sed -e 's/.m4b//g')
faad -w "$i" > "$out.wav"
done
for i in *.wav; do
out=$(ls "$i" | sed -e 's/.wav//g')
lame -h -b 64 "$i" "$out.mp3"
done
rm *.wav
Your's seems to give more info than mine does, but mine uses faad instead of mplayer. Great minds think quite similar.
Also, I've heard about gnormailize, but hadn't tryed it out. Wish I would have seen it before I set this up as a nautilus script lol
Re: How to convert pesky .m4a to .mp3
The second script worked better for me. I misfired on the first script and ended up wiping out my songs...my bad, just didn't read the script thouroughly enough
Re: How to convert pesky .m4a to .mp3
Well, unfortunately the mp3's I ended up with were nothing but static. ...trying to find another way
Re: How to convert pesky .m4a to .mp3
just to save anyone reading this in the future a bit of effort. You can go to http://multimedia.t27.ca/ and run the script from that page. When done you will be able to simply right click on the file you wish to convert, and the option will be there in your context menu.
Thanks to Tim.
Re: How to convert pesky .m4a to .mp3
sorry for being a newb but...
im not sure what i need to change (in order to convert a given music file from .aac to .mp3) exactly, I got as far as installing faad im using the second script:
#!/bin/bash
for i in *.m4a; do
out=$(ls "$i" | sed -e 's/.m4a//g')
faad -w "$i" > "$out.wav"
done
for i in *.m4b; do
out=$(ls "$i" | sed -e 's/.m4b//g')
faad -w "$i" > "$out.wav"
done
for i in *.wav; do
out=$(ls "$i" | sed -e 's/.wav//g')
lame -h -b 64 "$i" "$out.mp3"
done
rm *.wav
this is what i tried i installed faad.....
projectmayhem@projectmayhem-lapbottom:~$ .m4a; do
bash: syntax error near unexpected token `do'
projectmayhem@projectmayhem-lapbottom:~$ out=$(ls "$i" | sed -e 's/.m4a//g')
ls: cannot access : No such file or directory
projectmayhem@projectmayhem-lapbottom:~$ faad -w "$i" > "$out.wav"out=$(ls "$i" | sed -e 's/.m4a//g')
ls: cannot access : No such file or directory
The program 'faad' is currently not installed. You can install it by typing:
sudo apt-get install faad
bash: faad: command not found
projectmayhem@projectmayhem-lapbottom:~$ faad -w "$i" > "$out.wav"sudo apt-get install faad
The program 'faad' is currently not installed. You can install it by typing:
sudo apt-get install faad
bash: faad: command not found
projectmayhem@projectmayhem-lapbottom:~$ sudo apt-get install faad
here is i what i got after i installed faad:
projectmayhem@projectmayhem-lapbottom:~$ out=$(ls "$i" | sed -e 's/.m4a//g')
ls: cannot access : No such file or directory
projectmayhem@projectmayhem-lapbottom:~$ faad -w "$i" > "$out.wav"
projectmayhem@projectmayhem-lapbottom:~$
it seemd logical in my newb mind to only put in the part before the first done...just to be safe...dont know what im doing and dont want to mess up something by puting in a bad script, by me not changing a variable correctly or some thing....
Re: How to convert pesky .m4a to .mp3
Great script! However, you may want to consider using named pipes to avoid the intermediate .wav step i.e.
Code:
mkfifo pipe.wav
lame [whatever options] pipe.wav output.mp3
mplayer -ao pcm:file=pipe.wav source.m4a
Re: How to convert pesky .m4a to .mp3
please some one tell me how to use these scripts properly. please?