From d4881197480599371cdef781b7fc316e31b9160c Mon Sep 17 00:00:00 2001 From: j Date: Fri, 10 Aug 2018 11:12:01 +0100 Subject: [PATCH] chop only works with ffmpeg > 3 --- pandora/app/config.py | 4 ++++ pandora/archive/extract.py | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/pandora/app/config.py b/pandora/app/config.py index 6e940fda0..5d7eadd16 100644 --- a/pandora/app/config.py +++ b/pandora/app/config.py @@ -165,6 +165,10 @@ def load_config(init=False): if set(old_formats) != set(formats): sformats = supported_formats() settings.FFMPEG_SUPPORTS_VP9 = 'vp9' in sformats + try: + settings.CHOP_SUPPORT = int(sformats.get('version', ['0'])[0]) > 2 + except: + settings.CHOP_SUPPORT = False if sformats: for f in formats: if f not in sformats or not sformats[f]: diff --git a/pandora/archive/extract.py b/pandora/archive/extract.py index f48ee9db1..514b29ce2 100644 --- a/pandora/archive/extract.py +++ b/pandora/archive/extract.py @@ -57,7 +57,10 @@ def supported_formats(): stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True) stdout, stderr = p.communicate() stdout = stdout.decode('utf-8') + stderr = stderr.decode('utf-8') + version = stderr.split('\n')[0].split(' ')[2] return { + 'version': version.split('.'), 'ogg': 'libtheora' in stdout and 'libvorbis' in stdout, 'webm': 'libvpx' in stdout and 'libvorbis' in stdout, 'vp8': 'libvpx' in stdout and 'libvorbis' in stdout, @@ -616,7 +619,7 @@ def chop(video, start, end, subtitles=None): fd.write(subtitles) else: subtitles_f = None - if ext == '.mp4': + if ext == '.mp4' and settings.CHOP_SUPPORT: Chop(video, choped_video, start, end, subtitles_f) if subtitles_f: os.unlink(subtitles_f)