path might be a list of videos
This commit is contained in:
parent
a0b3693a2f
commit
f9c935bc19
1 changed files with 14 additions and 0 deletions
|
|
@ -16,6 +16,20 @@ def _get_distance(data0, data1):
|
|||
return total_distance / max_distance
|
||||
|
||||
def detect_cuts(path, seconds=True):
|
||||
if isinstance(path, list):
|
||||
cuts = []
|
||||
position = 0
|
||||
for segment in path:
|
||||
info = ox.avinfo(segment)
|
||||
segment_cuts = detect_cuts(segment, seconds)
|
||||
if seconds:
|
||||
cuts.append([c + position for c in segment_cuts])
|
||||
else:
|
||||
fps = AspectRatio(info['video'][0]['framerate'])
|
||||
cuts.append([c + int(position*fps) for c in segment_cuts])
|
||||
position += info['duration']
|
||||
return cuts
|
||||
|
||||
depth = 3
|
||||
info = ox.avinfo(path)
|
||||
if not info.get('video'):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue