Created
August 9, 2012 17:04
-
-
Save eribeiro/3305931 to your computer and use it in GitHub Desktop.
Convert a WMA file into MP3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# This script converts a WMA file into a MP3 file. | |
# Requisites: mplayer e lame | |
# Disclaimer: it worked last time I checked, but it was a long time ago, | |
# so I put it here just to reference. Use it at your own risk. | |
import os | |
list = os.listdir(".") | |
for f in list: | |
file = f.strip(); | |
if file.endswith(".wma"): | |
print "converting",file | |
new_file = file[:-3] + "mp3" | |
command = "mplayer -ao pcm \"" + file + "\"" | |
os.system(command) | |
command = "lame -b 128 audiodump.wav \"" + new_file + "\""; | |
os.system(command) | |
command = "rm audiodump.wav" | |
os.system(command) | |
print "Finished. Bye, Bye" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Python 3 version, working as expected:
You can install mplayer like that (MacOS only):