28 September, 2007

Linux : converting wma to mp3

It was never this simple !!
The only thing you need is : MPlayer codecs (w32all-codecs). You probably already have them installed if videos (specially avi) are running fine on your distro

Change to the directory where the wma files are stored ....
Type in the following one-by-one in the terminal (a script file will also work .. and probably be much more simpler... but lets use the terminal !!)

Thanks to : http://www.linuxquestions.org/linux/answers/Applications_GUI_Multimedia/Convert_WMA_to_MP3)

//remove spaces
for i in *.wma; do mv "$i" `echo $i | tr ' ' '_'`; done

//remove uppercase
for i in *.[Ww][Mm][Aa]; do mv "$i" `echo $i | tr '[A-Z]' '[a-z]'`; done

//Rip with Mplayer / encode with LAME
for i in *.wma ; do mplayer -vo null -vc dummy -af resample=44100 -ao pcm -waveheader $i && lame -m s audiodump.wav -o $i; done

//convert file names
for i in *.wma; do mv "$i" "`basename "$i" .wma`.mp3"; done rm audiodump.wav

The only change you require is probably in the conversion script... wherein.. the -waveheader option is deprecated..
instead modify it as : -ao pcm:waveheader
and it'll work fine !!

simple and fast... eh !!

No comments: