How to bulk convert WMA to MP3

So you just downloaded an entire album, and it’s in .wma (windows media audio) format, and you, of course, like any normal person want it in the .mp3 format.

What do you do?

There’s plenty of software solutions out there…

… but none of these really did what I wanted.

I decided to make my own tool.

My premiss was to make a bulk wma to mp3 converter for windows, that appears on context menus.

I figured that I could probably get away with using the “Send To” context menus instead.

I also figured that I could use the windows release of ffmpeg (windows binary contained within the 7zip files which open with WinRAR) at the core to do the actual conversion.

My advice would be to extract ffmpeg.exe to your “system32″ directory so we can call it from anywhere.

I figured out by using WinFF, that the command is as follows:

ffmpeg -i “in.wma” -acodec libmp3lame -ab 160k -ac 2 -ar 44100 “out.mp3″
Note: WinFF uses “mp3″ instead of “libmp3lame” due to the way it’s compiled

The next step was to figure out how to pass the arguments to ffmpeg.exe so it knew the input and output file.

In the end I settled on VBscript, thanks to a very handy documentation entitled “Introduction to VBScript“.

What I needed to do in psudo terms is as follows:

Get <arguments> as <input>
For Each <input> as <item>
Check <item> is a “.wma” file
Replace .wma with .mp3 on end of <item>
Run ffmpeg
Tell us when it’s all done

In VBS, you are unable to “replace”, so instead I simply trimmed the last 3 chrs (wma) and added “mp3″.

Also to insert quotes (since there’s no escaping) you simply use chr(34).

Another article worth mentioning is entitled “Running Programs From WSH Scripts“. It helps explain the difference between Run and Exec, and the ways in which to use them.

Here’s the script I ended up with:

Set objS = WScript.Arguments
i = 0
For Each objIN in objS
If objINext = “wma” Then
objExec=”ffmpeg.exe -i “&chr(34)&objIN&chr(34)&” -acodec libmp3lame -ab 160k -ac 2 -ar 44100 “&chr(34)&objOUT&chr(34)
Set objShell = CreateObject(“WScript.Shell”)
objShell.Run(objExec), 1, true
End If
i = i + 1
WScript.Echo “Done!”

Go to Start -> Run, enter: “sendto”, click OK or press Enter.

Create a New Text Document in there, open it, and paste in the above script, then rename it to “wma-to-mp3.vbs”.

That’s it, all done!

Now when you right click on a WMA file, and go to the “Send To” menu, you will see an option called “wma-to-mp3.vbs”, click on that, and the process will begin.

Note: I am aware that there are limits to this script, but it does the job. Let me know of any improvements you make, and enjoy!

About admin

Website Administrator
This entry was posted in Uncategorized. Bookmark the permalink.

13 Responses to How to bulk convert WMA to MP3

  1. Justin says:

    Doing this costs A LOT of sound quality.

  2. Anonymous says:

    Awsome! Thanks!

  3. Scott says:

    It keeps giving me a “character” error, either line one or line 5 depending on which text type I save the script as? any ideas?

  4. Scott says:

    well I got it to run the script. the issue is that when you copy from “firefox” the quotation marks become smart quotes and the script can’t read them. I finally figured out that you had to open that up in wordpad change the quotes by retyping them, also the longest line of code needs to all be on one line, and it needs to be saved in “unicode text”

  5. Scott says:

    It runs the script, but nothing happens? what’s wrong? it’s supposed to convert the existing wma into an mp3 right there in the folder right? any of the test wma’s I’ve used the script on, opens the “lame” looking dialog box for a split second, then says done, but nothing changes to the file, or if it does it doesn’t tell me where the new one is located?

  6. hm2k says:

    With regards to the quotes, yes, unfortunately wordpress encodes them stupidly, and i’ve not yet got around to figuring out how to disable that. You just need to manually put real quotes in.

    As for the rest, you must be doing something wrong.

    Use WScript.Echo objExec to return the string, then type that into a cmd, see if it works from there.

    It should display an error, and you can take it from there.

  7. anon says:

    vbs replace function

    but its more sensible to do what you are doing in this instance any way

  8. 3l1t3 says:

    Thank you very much worked great , exactly what I needed I could right click multiple selected files too, which converted all the files into the same folder , Maybe you can help me with my other task of printing a full list of music songs and artists , I’ve googled but haven’t really found exactly what i’m looking for. not too handy with my own scripts but i figure there has to be a way Thanks again.

  9. Mat Dodgson says:

    Fantastic work my friend! This is so easy and works so well!

  10. Rob says:

    This works great!

    I use ffmpeg to convert video for my phone, and I use shortcuts in SendTo for Notepad, but never thought about putting a vbs script in there.

    Thanks very much for this tip! Now I can listen to wma files on my phone.

  11. Pingback: Batch WMA Lossless > MP3 transcode ? - discussion forums

  12. Michael Nadar says:

    The script works great. For non scripters.. the character errors are caused by double quotes getting copied as some other wierd character.. Replace those with the normal double quote and the script works great. Thanks a Lot

  13. Joseph Whitaker says:

    Thanks, it worked beautifully. Working with win 7 and had to get “send to” by Start->Run (Type in “shell:sendto” without quotes)

    Apart from that, I smply followed your steps.

    Thanks alot,

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>