Skip to content

Instantly share code, notes, and snippets.

@hlin117
Last active August 29, 2015 14:03
Show Gist options
  • Save hlin117/7fb04b47a08d48eeaeb6 to your computer and use it in GitHub Desktop.
Save hlin117/7fb04b47a08d48eeaeb6 to your computer and use it in GitHub Desktop.
A quick gist to convert wma files in a folder to mp3 files. Uses the command line tool ffmpeg.
#!/usr/bin/python
import os
for file in os.listdir("."):
if file.endswith("wma"):
name = file[:-4]
command = "ffmpeg -i '{0}.wma' '{0}.mp3' -y".format(name)
os.system(command)
#!/bin/bash
while IFS= read -u 4 -r LINE; do
ffmpeg -i "$LINE" "${LINE%.*}.mp3" -y
done 4< <(exec find "." -type f -name '*.wma')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment