12
Dez
2005

How to convert from WMA to MP3

Converting Windows Media Audio files into MP3 format is rather easy with mplayer and lame. My car stereo plays MP3s, so WMA is of no use to me!

This code is based on this script but I have to wonder why they overwrote the wma file?
Piping the output of mplayer into lame is left as an easy lesson for the reader!

for i in *.wma ; do mplayer -vo null -vc dummy -af resample=44100 -ao pcm -waveheader "$i" && lame -m j -h --vbr-new -b 160 audiodump.wav -o "`basename "$i" .wma`.mp3"; done; rm -f audiodump.wav
In case you don’t want the big temporary file, you can use a fifo. Here’s my script:
#!/bin/bash
#
# Dump wma to mp3

for i in *.wma
do
if [ -f $i ]; then
rm -f “$i.wav”
mkfifo “$i.wav”
mplayer -vo null -vc dummy -af resample=44100 -ao pcm -waveheader “$i” -aofile “$i.wav” &
dest=`echo “$i”|sed -e ’s/wma$/mp3/’`
lame -h -b 192 “$i.wav” “$dest”
rm -f “$i.wav”
fi
done

Comment by Scott Carlson — Monday, August 22nd, 2005 @ 1:04 am 

The latest version of mplayer complains about -ao pcm -waveheader - actually, it just needs to be replaced with -ao pcm:waveheader, and everything works again. Btw, thanks for the instruction, it is both useful and educational ;)

Comment by Petar — Wednesday, September 14th, 2005 @ 11:06 am

#

For latest versions of mplayer (on Fedora Core 4), you will need the following instead:

for i in *.wma
do
filename=`basename "$i" .wma`

#Rip with Mplayer / encode with LAME
echo "Ripping $i"
mplayer -quiet -vo null -vc dummy -af volume=0,resample=44100:0:1 -ao pcm:waveheader "$i"
echo "Encoding $i to "$filename".mp3"
lame -quiet -m s audiodump.wav -o "$filename".mp3

rm audiodump.wav
done

Comment by Ranchan — Thursday, December 1st, 2005 @ 12:15 am

#

On SuSE 9.3, (MPlayer 1.0-pre7) got it working (with the FIFO) sweetly with


#!/bin/bash
#
# Dump wma to mp3
for i in *.wma
do
if [ -f "$i" ]; then
rm -f "$i.wav"
mkfifo "$i.wav"
mplayer -quiet -vo null -vc dummy -af volume=0,resample=44100:0:1 -ao pcm:waveheader:file="$i.wav" "$i" &
dest=`echo "$i"|sed -e 's/wma$/mp3/'`
lame -V0 -h -b 160 --vbr-new "$i.wav" "$dest"
rm -f "$i.wav"
fi
done

I like hq VBR, but you can change the lame settings as you like. Note the MPlayer settings have changed.

Comment by Peter Ndiku — Friday, December 2nd, 2005 @ 12:52 pm

Org. Link
logo

vireas

Suche

 

Aktuelle Beiträge

C i s c o  V...
can get always the latest version of C i s c o  V...
vireas - 12. Jul, 11:07
WM5: Custom text on today...
You can set a small custom text message on the bottom...
vireas - 15. Mai, 21:44
WM5: Increase Performance...
Boost Windows Mobile 5 performance up to 20 percent [HKLM\System\Stor ageManager\FATFS]...
vireas - 15. Mai, 21:42
WM5: Speed Up your Pocket...
This tweak might help improving visual performance...
vireas - 15. Mai, 21:41
Windows Ordner
-Es ist nicht möglich unter Windows einen Ordner anzulegen...
vireas - 22. Feb, 13:37

Archiv

Dezember 2005
Mo
Di
Mi
Do
Fr
Sa
So
 
 
 
 1 
 3 
 4 
 5 
 6 
 7 
 8 
 9 
10
11
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
 
 

Status

Online seit 7695 Tagen
Zuletzt aktualisiert: 12. Jul, 11:07
vireas-plug

KnowHow
KnowHow - Mobiles
Tools
Profil
Abmelden
Weblog abonnieren