A few months back, I was attempting to load my music collection on my iPhone for the first time and was encountering issues. My situation:
- I was running iTunes in a Virtual Machine to avoid all the crapware that iTunes installs.
- My music library was a combination (about half and half) of WMA and MP3 files.
- My music library was well organized in a folder hierarchy.
- The iTunes converter was giving me grief upon importing my music library. (I seem to recall that due to the use of virtual machine snapshots, iTunes kept getting confused and re-converting certain WMA files that had already been converted by it; furthermore, due to the virtualization, conversion of my music library was taking forever!)
“No problem,” I thought, “I’ll just find a tool to batch-convert my entire music library to MP3 format, which is compatible with iTunes.” My plan was to run this once on the host and then import the entire (converted) folder into iTunes on the VM.
My requirements were as follows:
- Tool shall recursively process the music library folder.
- Tool must allow specification of an output folder that is different from the source folder.
- Upon executing conversion, tool shall replicate the source folder hierarchy, recreating that folder hierarchy within the destination folder.
- Upon encountering a WMA file, tool shall auto-convert the file and place the resulting MP3 file in the same relative location in the destination folder hierarchy. (My various audio files frequently had the same filenames but were in different folders in the folder hierarchy, so putting everything in one single-level folder wouldn’t work.)
- Upon encountering a non-WMA file, tool shall support automatic duplication of the source file to the same relative location in the destination folder hierarchy. (This way, my MP3 files would simply be duplicated and not converted.)
After understanding what I wanted to do, I spent quite a while searching the Internet for a conversion tool that supported my (rather simplistic) requirements. I downloaded, installed, and tested (in a VM) quite a few tools, and none of them supported what I wanted. In many cases, the tools failed to support folder recursion, and for those tools that did, the tool either converted the files in place or dumped all of the files (from all the subfolders) into a single output folder without replicating the folder hierarchy.
At this point, I was pretty annoyed with the various converters available; whether “free” or “paid,” most were very poorly designed, unstable, and generally “overkill” for my problem. After over an hour of experimenting, I stumbled upon a blog post that discussed the use of vbscript + FFmpeg to do the conversion.
Using FFmpeg to do the conversion had occurred to me, but I lacked an easy way to run FFmpeg recursively and duplicate the source folder hierarchy. At this point; however, I was ready to script those aspects of the conversion myself. I liked the approach taken by the Phurix Labs script (in the above blog post) to make use of the “Send To” menu to allow for easy activation of the script. So, I retained that aspect but wrote the recursive code mostly from scratch…
A few hours later, and I had my script finished. Yes, vbscript is painful, but it has the advantage of working natively on practically any Windows system.
Script Download Link
- Recursive traversal of the selected folders. Selection of more than one source folder/file is allowed.
- Supports two output options:
- In-place conversion. Places resulting MP3 files in the same location as the original WMA files.
- Selection of alternate output directory. Source folder tree is replicated to destination folder and resulting MP3 files are placed in the same relative location. User is also given the option to duplicate or ignore non-WMA files.
- Script complains if a particular FFmpeg conversion process appears to be taking too long.
- Download FFmpeg.
- Add the directory containing FFmpeg to the system path. Google it if you don’t know how to do this.
- Download & install the script.
- Download the .vbs script file.
- Open the “send to” folder in Windows by either typing “shell:sendto” into an Explorer window’s address bar or using Start -> Run.
- Copy the .vbs script file into the “send to” folder.
Run the script by right-clicking on the source folder(s) and/or source files(s) and clicking Send To –> Convert WMA to MP3.