Skip to content

Instantly share code, notes, and snippets.

@mavhc
Created February 12, 2016 15:01
Show Gist options
  • Save mavhc/78b325cc76a1ecfe3952 to your computer and use it in GitHub Desktop.
Save mavhc/78b325cc76a1ecfe3952 to your computer and use it in GitHub Desktop.
# put this file, and ffmpeg.exe in a folder, drop videos onto this file
# a version called filename-rotatedcounterclockwise.ext will be saved
# in the same folder as the original
import sys
import subprocess
import os
from pathlib import Path
i = sys.argv[1]
#print(i)
__location__ = os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(__file__)))
ip = Path(i)
name = str(ip.stem)
name = name + "-rotatedcounterclockwise" + str(ip.suffix)
op = ip.with_name(name)
print(ip,op)
# change =2 to =1 for clockwise
print([__location__+'\\ffmpeg', '-i', str(ip),' -vf transpose=2 ',str(op)])
subprocess.call([__location__+'\\ffmpeg', '-i', str(ip),'-vf', 'transpose=1',str(op)], shell=True)
a = input("Done, press Enter")
@mavhc
Copy link
Author

mavhc commented Mar 7, 2016

This file is public domain

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment