Added croping to yt-clipper
This commit is contained in:
@@ -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'],
|
||||
|
||||
Reference in New Issue
Block a user