Sunday, August 17, 2008

A better way to convert .wma to .mp3

Some months ago I posted on how to make this conversion (an unfortunate relic from my days as a Windows user is that I have about 40 GB of my music collection as .wma files which may cause some problems at times in Linux).
As this is a two step process, I suggested at the time that it should be possible to pipe the output from the first step to the second step to make this conversion a one-stage process.
Alas, my efforts totally failed.
Just to show that I'm a much better googler than I am a coder, I came across this great script from here which not only cuts the process down to one step only BUT also lets you convert any number of .wma files successively to .mp3. So, instead of converting each file individually, you can convert a whole album or a whole collection to .mp3 with just one terminal command.
So, this is absolutely marvelous for me.
The procedure is:

1. Make sure both mplayer and lame are installed
2. Move all the .wma files you want to convert to the same folder.
3. cd to that folder in a terminal
4. Now copy and paste this script, press enter and let it do it's thing:

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

5. When it finishes, (typically takes about 10 seconds, or less, per song), your folder that you cd'ed to will contain your chosen music as .mp3 files.

Edit (7-09-08):
For this script to work, the user must have Create&Delete permissions for all the.wma files to be converted. If not, will just get errors before it stops. Sudo doesn't get over the problem.

4 comments:

  1. I always use TuneClone to help me convert wma to mp3. it works great for me.

    ReplyDelete
  2. @dudude
    Thanks for that comment.
    However, from what I can see, TuneClone is only usable in Windows AND it's not free.

    ReplyDelete
  3. prefer to use MelodyCan Audio Converter.

    1. easy to use, only a few clicks to put files into my iPod
    2. very fast conversion which saved me lots of time - 50x
    3. had a good balance between file size and output video quality

    http://www.melodycan.com/convert_audio.html

    ReplyDelete
  4. @Ann
    Thanks for your recommendation but, once again, MelodyCan Audio Converter seems to be a Windows-only utility (only comes, AFAICS, as an .exe file) and is not free.
    But, chacun à son goût.

    ReplyDelete