chop only works with ffmpeg > 3
This commit is contained in:
parent
e2ef6de3c0
commit
d488119748
2 changed files with 8 additions and 1 deletions
|
@ -165,6 +165,10 @@ def load_config(init=False):
|
||||||
if set(old_formats) != set(formats):
|
if set(old_formats) != set(formats):
|
||||||
sformats = supported_formats()
|
sformats = supported_formats()
|
||||||
settings.FFMPEG_SUPPORTS_VP9 = 'vp9' in sformats
|
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:
|
if sformats:
|
||||||
for f in formats:
|
for f in formats:
|
||||||
if f not in sformats or not sformats[f]:
|
if f not in sformats or not sformats[f]:
|
||||||
|
|
|
@ -57,7 +57,10 @@ def supported_formats():
|
||||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True)
|
stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True)
|
||||||
stdout, stderr = p.communicate()
|
stdout, stderr = p.communicate()
|
||||||
stdout = stdout.decode('utf-8')
|
stdout = stdout.decode('utf-8')
|
||||||
|
stderr = stderr.decode('utf-8')
|
||||||
|
version = stderr.split('\n')[0].split(' ')[2]
|
||||||
return {
|
return {
|
||||||
|
'version': version.split('.'),
|
||||||
'ogg': 'libtheora' in stdout and 'libvorbis' in stdout,
|
'ogg': 'libtheora' in stdout and 'libvorbis' in stdout,
|
||||||
'webm': 'libvpx' in stdout and 'libvorbis' in stdout,
|
'webm': 'libvpx' in stdout and 'libvorbis' in stdout,
|
||||||
'vp8': '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)
|
fd.write(subtitles)
|
||||||
else:
|
else:
|
||||||
subtitles_f = None
|
subtitles_f = None
|
||||||
if ext == '.mp4':
|
if ext == '.mp4' and settings.CHOP_SUPPORT:
|
||||||
Chop(video, choped_video, start, end, subtitles_f)
|
Chop(video, choped_video, start, end, subtitles_f)
|
||||||
if subtitles_f:
|
if subtitles_f:
|
||||||
os.unlink(subtitles_f)
|
os.unlink(subtitles_f)
|
||||||
|
|
Loading…
Reference in a new issue