settings flag to use new cut detection
This commit is contained in:
parent
6deaca8161
commit
11915abcf5
2 changed files with 15 additions and 3 deletions
|
|
@ -23,6 +23,7 @@ import pillow_avif
|
||||||
from pillow_heif import register_heif_opener
|
from pillow_heif import register_heif_opener
|
||||||
|
|
||||||
from .chop import Chop, make_keyframe_index
|
from .chop import Chop, make_keyframe_index
|
||||||
|
from .cutdetection import detect_cuts
|
||||||
from .utils import AspectRatio
|
from .utils import AspectRatio
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -469,17 +470,26 @@ def timeline(video, prefix, modes=None, size=None):
|
||||||
size = [64, 16]
|
size = [64, 16]
|
||||||
if isinstance(video, str):
|
if isinstance(video, str):
|
||||||
video = [video]
|
video = [video]
|
||||||
|
if settings.CUT_DETECTION == 'oxtimelines':
|
||||||
|
cuts = [
|
||||||
|
'-c', os.path.join(prefix, 'cuts.json'),
|
||||||
|
]
|
||||||
|
else:
|
||||||
|
cuts = []
|
||||||
|
|
||||||
cmd = [os.path.normpath(os.path.join(settings.BASE_DIR, '../bin/oxtimelines')),
|
cmd = [os.path.normpath(os.path.join(settings.BASE_DIR, '../bin/oxtimelines')),
|
||||||
'-s', ','.join(map(str, reversed(sorted(size)))),
|
'-s', ','.join(map(str, reversed(sorted(size)))),
|
||||||
'-m', ','.join(modes),
|
'-m', ','.join(modes),
|
||||||
'-o', prefix,
|
'-o', prefix,
|
||||||
'-c', os.path.join(prefix, 'cuts.json'),
|
] + cuts + video
|
||||||
] + video
|
|
||||||
# print(cmd)
|
# print(cmd)
|
||||||
p = subprocess.Popen(cmd, stdin=subprocess.PIPE,
|
p = subprocess.Popen(cmd, stdin=subprocess.PIPE,
|
||||||
close_fds=True)
|
close_fds=True)
|
||||||
p.wait()
|
p.wait()
|
||||||
|
if settings.CUT_DETECTION != 'oxtimelines':
|
||||||
|
cuts = detect_cuts(video)
|
||||||
|
with open(os.path.join(prefix, 'cuts.json'), "w") as fd:
|
||||||
|
json.dump(cuts, fd)
|
||||||
|
|
||||||
def average_color(prefix, start=0, end=0, mode='antialias'):
|
def average_color(prefix, start=0, end=0, mode='antialias'):
|
||||||
height = 64
|
height = 64
|
||||||
|
|
|
||||||
|
|
@ -222,6 +222,8 @@ USE_VP9 = True
|
||||||
FFMPEG_SUPPORTS_VP9 = True
|
FFMPEG_SUPPORTS_VP9 = True
|
||||||
FFMPEG_DEBUG = False
|
FFMPEG_DEBUG = False
|
||||||
|
|
||||||
|
CUT_DETECTION = "oxtimelines"
|
||||||
|
|
||||||
#=========================================================================
|
#=========================================================================
|
||||||
#Pan.do/ra related settings settings
|
#Pan.do/ra related settings settings
|
||||||
#to customize, create local_settings.py and overwrite keys
|
#to customize, create local_settings.py and overwrite keys
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue