Skip to content

Instantly share code, notes, and snippets.

@filipgorczynski
Created September 27, 2018 13:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save filipgorczynski/831685e9f980f0a0eb22cfb22d108d69 to your computer and use it in GitHub Desktop.
Save filipgorczynski/831685e9f980f0a0eb22cfb22d108d69 to your computer and use it in GitHub Desktop.
A friend from work is saying that it's useful for previously downloaded PornHub movies.
# Just a simple tool to convert mp4 files to avi.
import os
import subprocess
import glob
path = '.'
files = glob.glob('*.mp4')
files_count = len(files)
for index, name in enumerate(files, start=1):
raw_filename = name[:-4]
print("Converting file {} of {}: {}".format(index, files_count, raw_filename))
input_file = raw_filename + '.mp4'
out_file = raw_filename + '.avi'
subprocess.call(["ffmpeg", "-i", input_file, "-vcodec", "copy", "-acodec", "copy", out_file])
os.remove(input_file)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment