Last active
January 17, 2021 08:02
-
-
Save Frechdachs/fab34383a29c988d8d0c9e22892d35e3 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env python3 | |
# Gebbi's makecuts_prores.py | |
# VapourSynth support added | |
from sys import argv | |
from subprocess import check_call | |
from optparse import OptionParser | |
from os import path | |
# modify paths from here | |
ffmpeg = 'ffmpeg' | |
vspipe = 'vspipe' | |
# until here | |
def runjob(vpy, cutname, start, end): | |
name = path.splitext(vpy)[0] | |
output = path.join('Typecuts', '{}{}.mov'.format(cutname, start)) | |
check_call('{0} --y4m -s {1} -e {2} "{3}" - | {4} -i - -vcodec prores_ks -pix_fmt yuv444p10le -an "{5}"' | |
.format(vspipe, start, end, vpy, ffmpeg, output), shell=True) | |
def main(args): | |
opt = OptionParser(description='', version='', usage='') | |
opt.add_option('--cutname', '-c', action='store', help='Specify cutname', dest='cutname') | |
opt.add_option('--jobs', '-j', action='store', help='Specify jobs file to rotate through', dest='jobs') | |
(option, arg) = opt.parse_args(args) | |
if len(arg) == 0: | |
opt.error('No Vapoursynth script or jobs file specified. \nUse --help for more information.') | |
if not option.jobs: | |
print('jobfile missing, aborting...') | |
else: | |
# rotate through jobs | |
with open(option.jobs, 'r+') as jobfile: | |
jobcont = jobfile.readlines() | |
while len(jobcont) > 0: | |
if jobcont[0].strip(): | |
start, end = [x.strip() for x in jobcont[0].split('-')] | |
print('\nStart: {}\nEnd: {}'.format(start, end)) | |
runjob(arg[0], option.cutname, start, end) | |
del jobcont[0] | |
jobfile.seek(0) | |
jobfile.writelines(jobcont) | |
jobfile.truncate() | |
jobfile.seek(0) | |
jobcont = jobfile.readlines() | |
print('\nDone.') | |
if __name__ == '__main__': | |
main(argv[1:]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment