Pages

Convert wma to ogg

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.

No comments:

Post a Comment