diff --git a/onlineTraining/yt-clipper.py b/onlineTraining/yt-clipper.py index cbf550f..a80b202 100755 --- a/onlineTraining/yt-clipper.py +++ b/onlineTraining/yt-clipper.py @@ -6,6 +6,10 @@ import ffmpeg import subprocess import glob import sys +import argparse + +argParser = argparse.ArgumentParser() + jsonFileName = sys.argv[1] #jsonFileName = "***REMOVED***Kniebeuge.json" @@ -37,7 +41,14 @@ for clip in clipDict: w=clip['crop']['w'], h=clip['crop']['h'] ) - stream = ffmpeg.filter(stream, "scale", height="480", width="-2" ) + + h = 480 + w = -2 + if 'scale' in clip: + h = clip['scale']['h'] if 'h' in clip['scale'] else 480 + w = clip['scale']['w'] if 'w' in clip['scale'] else -2 + stream = ffmpeg.filter(stream, "scale", height=h, width=w ) + stream = ffmpeg.output(stream, clip['target'], vcodec="vp9", @@ -66,7 +77,14 @@ for clip in clipDict: w=clip['crop']['w'], h=clip['crop']['h'] ) - stream = ffmpeg.filter(stream, "scale", height="480", width="-2" ) + + h = 480 + w = -2 + if 'scale' in clip: + h = clip['scale']['h'] if 'h' in clip['scale'] else 480 + w = clip['scale']['w'] if 'w' in clip['scale'] else -2 + stream = ffmpeg.filter(stream, "scale", height=h, width=w ) + stream = ffmpeg.output(stream, clip['target'], vcodec="vp9",