Convert wma to mp3 or ogg
Yesterday i have download latest ASOT from Armin Van Buuren. In archive i have found wma file (whose encoding format is owned by Microsoft). As wma is not open format i think about recoding to ogg or mp3.
I have look around ubuntu packages repository, and find easy way how can i do this. For wma2ogg or wma2mp3 conversion you need installed few common programs:
- MPlayer
- oggenc (from vorbis-tools package)
- lame
Also i have write small shell script to perform batch conversion. However it works only with files from current directory, and with files what has only one period in file name (for example ASOT-280.wma)
Following script will convert all wma files to ogg format:
#!/bin/bash
for i in *.wma ;
do
ii=`echo $i | cut -d'.' -f1`
`mplayer -vo null -vc dummy -af resample=44100 \
-ao pcm:waveheader:file=$ii.wav $i`
`oggenc -q 5 $ii.wav`
done
(!) Do not forget to manually remove original wma and temporarily created wav files.
I will not explain here all mplayer and oggenc params. If you would like to know more, please look to man pages ;-)
If you would like to convert wma to mp3 you need replace line:
`oggenc -q 5 $ii.wav
with
`lame -m j -h --vbr-new -b 192 $ii.wav -o $ii.mp3`
That’s all.