Last active
December 16, 2015 07:48
-
-
Save QQism/5400978 to your computer and use it in GitHub Desktop.
Convert all wav files in a path to mp3, using lame. Usage: ./convert_wav_to_mp3 my/wav/folder
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/env python | |
# require lame http://lame.sourceforge.net | |
import sys | |
import os | |
import re | |
import subprocess | |
path = sys.argv[1:][0] | |
wav_files = [] | |
for dirname, dirnames, filenames in os.walk(path): | |
wav_files += [os.path.join(dirname, filename) for filename in filenames if re.match(r'.*\.wav', filename)] | |
for filename in wav_files: | |
command = 'lame --preset insane "' + filename + '"' | |
subprocess.call(command, shell=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment