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
Org. Link
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
vireas - 12. Dez, 17:30