Skip to content
Permalink
Browse files
Create Transcoder.py
  • Loading branch information
hollan84 committed Feb 23, 2019
1 parent 77e1deb commit 75ac81e31e0fc42a70afd91ffabb691eff849ac9
Showing 1 changed file with 52 additions and 0 deletions.
@@ -0,0 +1,52 @@
import os, time

def editable():
for file in os.listdir("/To Transcode/"):
if file not in os.listdir("/Editable Footage/"):
print("Converting editing file " + file + "...")
toTranscode = "ffmpeg -i /To\ Transcode/" + file + " -vf scale=1280:-1 -c:v libx264 -preset veryslow -crf 25 /Editable\ Footage/" + file
os.system(toTranscode)
print("Finished converting editing file" + file + "\n")
Transcode()

def renderFile():
for file in os.listdir("/To Transcode/"):
if file not in os.listdir("/Transcoded Footage/"):
print("Converting video file " + file + "...")
toTranscode = "ffmpeg -i /To\ Transcode/" + file + " /Transcoded\ Footage/" + file
os.system(toTranscode)
print("Finished converting video file" + file + "\n")
Transcode()

def wait():
empty = True
while empty == True:
os.system("clear")
print("Waiting for files...")
if os.listdir("/To Transcode/"):
for file in os.listdir("/To Transcode/"):
if file not in os.listdir("/Transcoded Footage/"):
empty = False
time.sleep(10)

def Transcode():
editable()
renderFile()
wait()
Transcode()

if not os.path.isdir("/To Transcode/"):
os.mkdir("/To Transcode/")
if not os.path.isdir("/Editable Footage/"):
os.mkdir("/Editable Footage/")
if not os.path.isdir("/Transcoded Footage/"):
os.mkdir("/Transcoded Footage/")

try:
os.system("ffmpeg -version")
except:
print("ffmpeg not installed")
exit()

Transcode()

0 comments on commit 75ac81e

Please sign in to comment.