diff --git a/onlineTraining/clips.json b/onlineTraining/clips.json index 3b48cb1..91ee5ed 100644 --- a/onlineTraining/clips.json +++ b/onlineTraining/clips.json @@ -3,31 +3,36 @@ "source": "https://www.youtube.com/embed/6wcWZZw6RGk", "target": "videos.d/hopserlauf.webm", "from": "01:09.000", - "to": "01:24.833" + "to": "01:24.833", + "crop": {"x": 581, "y": 32, "w": 1309, "h": 1018} }, { "source": "https://www.youtube.com/embed/6wcWZZw6RGk", "target": "videos.d/kniehebelauf.webm", "from": "01:24.917", - "to": "01:39.542" + "to": "01:39.542", + "crop": {"x": 581, "y": 32, "w": 1309, "h": 1018} }, { "source": "https://www.youtube.com/embed/6wcWZZw6RGk", "target": "videos.d/anfersen.webm", "from": "01:40.208", - "to": "01:54.625" + "to": "01:54.625", + "crop": {"x": 581, "y": 32, "w": 1309, "h": 1018} }, { "source": "https://www.youtube.com/embed/6wcWZZw6RGk", "target": "videos.d/***REMOVED***Eingang-kniebeuge.webm", "from": "03:45.250", - "to": "04:05.875" + "to": "04:05.167", + "crop": {"x": 581, "y": 32, "w": 1309, "h": 1018} }, { "source": "https://www.youtube.com/embed/6wcWZZw6RGk", "target": "videos.d/indianer.webm", "from": "04:36.917", - "to": "05:05.458" + "to": "05:05.458", + "crop": {"x": 581, "y": 32, "w": 1309, "h": 1018} }, { "source": "https://www.youtube.com/embed/zDj1Yf4d07I", diff --git a/onlineTraining/kodokanKniebeuge.json b/onlineTraining/kodokanKniebeuge.json new file mode 100644 index 0000000..ace566a --- /dev/null +++ b/onlineTraining/kodokanKniebeuge.json @@ -0,0 +1,9 @@ +[ +{ + "source": "https://www.youtube.com/embed/6wcWZZw6RGk", + "target": "videos.d/***REMOVED***Eingang-kniebeuge.webm", + "from": "03:45.250", + "to": "04:05.167", + "crop": {"x": 581, "y": 32, "w": 1309, "h": 1018} +} +] diff --git a/onlineTraining/yt-clipper.py b/onlineTraining/yt-clipper.py index 31749d2..de556ab 100755 --- a/onlineTraining/yt-clipper.py +++ b/onlineTraining/yt-clipper.py @@ -6,7 +6,8 @@ import ffmpeg import subprocess import glob -jsonFileName = "clips.json" +#jsonFileName = "clips.json" +jsonFileName = "***REMOVED***Kniebeuge.json" clipDict = {} with open(jsonFileName) as jf: @@ -22,11 +23,19 @@ for clip in clipDict: if infoDict is not None: stream = ffmpeg.input( - # @todo This is a very bad hack because the outtmpl options doesn't seem to be working if the file gets reencoded + # @todo This is a very bad hack because the outtmpl options doesn't seem to be working if the file gets reencoded glob.glob(infoDict['id']+"*")[0], ss=clip['from'], to=clip['to'], ) + if 'crop' in clip: + stream = ffmpeg.filter(stream, + "crop", + x=clip['crop']['x'], + y=clip['crop']['y'], + w=clip['crop']['w'], + h=clip['crop']['h'] + ) stream = ffmpeg.filter(stream, "scale", height="480", width="-2" ) stream = ffmpeg.output(stream, clip['target'], @@ -48,6 +57,14 @@ for clip in clipDict: ss=clip['from'], to=clip['to'], ) + if 'crop' in clip: + stream = ffmpeg.filter(stream, + "crop", + x=clip['crop']['x'], + y=clip['crop']['y'], + w=clip['crop']['w'], + h=clip['crop']['h'] + ) stream = ffmpeg.filter(stream, "scale", height="480", width="-2" ) stream = ffmpeg.output(stream, clip['target'],