Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Transcoder/Transcoder.py
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
53 lines (45 sloc)
1.45 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") | |
os.system("sudo apt-get install ffmpeg") | |
exit() | |
Transcode() | |