Added croping to yt-clipper
This commit is contained in:
@@ -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",
|
||||
|
||||
9
onlineTraining/kodokanKniebeuge.json
Normal file
9
onlineTraining/kodokanKniebeuge.json
Normal file
@@ -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}
|
||||
}
|
||||
]
|
||||
@@ -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