diff --git a/pandora/archive/extract.py b/pandora/archive/extract.py index 8515192f..7b6bf906 100644 --- a/pandora/archive/extract.py +++ b/pandora/archive/extract.py @@ -23,6 +23,7 @@ import pillow_avif from pillow_heif import register_heif_opener from .chop import Chop, make_keyframe_index +from .cutdetection import detect_cuts from .utils import AspectRatio @@ -469,17 +470,26 @@ def timeline(video, prefix, modes=None, size=None): size = [64, 16] if isinstance(video, str): 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')), '-s', ','.join(map(str, reversed(sorted(size)))), '-m', ','.join(modes), '-o', prefix, - '-c', os.path.join(prefix, 'cuts.json'), - ] + video + ] + cuts + video # print(cmd) p = subprocess.Popen(cmd, stdin=subprocess.PIPE, close_fds=True) 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'): height = 64 diff --git a/pandora/settings.py b/pandora/settings.py index 44ae9b0d..886719bd 100644 --- a/pandora/settings.py +++ b/pandora/settings.py @@ -222,6 +222,8 @@ USE_VP9 = True FFMPEG_SUPPORTS_VP9 = True FFMPEG_DEBUG = False +CUT_DETECTION = "oxtimelines" + #========================================================================= #Pan.do/ra related settings settings #to customize, create local_settings.py and overwrite keys