Today I found myself in a situation where I have a few (200+) WMA audio files. Due to personal preference I want MP3, not WMA. So, let’s convert that lot.
What I want to do is convert all those WMA files to constant bitrate 192kbps, stereo mp3 files. (In my case, the WMA files have the required quality to use this settings).
~
The first tool you need is ffmpeg. If you’re on Mac, simple run brew install ffmpeg
. The second tool is irb
or _Interactive Ruby.
With ffmpeg
setup and in your path, create a directory and stuff you WMA’s there. Then open irb
and run the following Ruby command:
ext = ".wma"
Dir.glob("*#{ext}").each {|f| m = f.gsub(ext, '.mp3'); `ffmpeg -i '#{f}' -ab 192k -ac 2 -ar 44100 '#{m}'` }
When done, you’ll find the WMA files converted to MP3 (having the same filename, except for the extention).
Happy transcoding!
Note: If you need to add ID3 tags to your files, I can highly recommend MusicBrainz Picard. It can fingerprint your music and find the proper data online. It’s free!
Update: Added a separte ext
variable, this works great for converting FLAC to MP3 as well! Just use ext = '.flac'
.