Skip to content

Instantly share code, notes, and snippets.

@un33k
Created January 5, 2014 14:30
Show Gist options
  • Save un33k/8268843 to your computer and use it in GitHub Desktop.
Save un33k/8268843 to your computer and use it in GitHub Desktop.
Quickly convert all Windows Media Videos to MP4 in a directory using ffmpeg.
import os
import sys
# Install ffmpeg
# Put all your wmv in a directory
# Copy this file inside the directory
# run `python video_converter.py
############################################
WMV_DIR = "."
wmv_files = [ f for f in os.listdir(WMV_DIR) if os.path.isfile(os.path.join(WMV_DIR,f)) and 'wmv' in f ]
for f in wmv_files:
input = f
output = f.replace('wmv', 'mp4')
print 'processing {} - > {}'.format(input, output)
os.system('ffmpeg -i {} -strict -2 {}'.format(input, output))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment