mirror of
https://github.com/soimort/you-get.git
synced 2025-02-09 03:37:52 +03:00
fix ffmpeg.py: take out the general parts of the functions and simplify them
This commit is contained in:
parent
af3468fa05
commit
5ec38efddc
@ -144,9 +144,7 @@ def ffmpeg_concat_ts_to_mkv(files, output='output.mkv'):
|
|||||||
except:
|
except:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def ffmpeg_concat_flv_to_mp4(files, output='output.mp4'):
|
def ffmpeg_concat_demuxer(files, output='output.mp4'):
|
||||||
print('Merging video parts... ', end="", flush=True)
|
|
||||||
# Use concat demuxer on FFmpeg >= 1.1
|
|
||||||
if FFMPEG == 'ffmpeg' and (FFMPEG_VERSION[0] >= 2 or (FFMPEG_VERSION[0] == 1 and FFMPEG_VERSION[1] >= 1)):
|
if FFMPEG == 'ffmpeg' and (FFMPEG_VERSION[0] >= 2 or (FFMPEG_VERSION[0] == 1 and FFMPEG_VERSION[1] >= 1)):
|
||||||
concat_list = generate_concat_list(files, output)
|
concat_list = generate_concat_list(files, output)
|
||||||
params = [FFMPEG] + LOGLEVEL + ['-y', '-f', 'concat', '-safe', '0',
|
params = [FFMPEG] + LOGLEVEL + ['-y', '-f', 'concat', '-safe', '0',
|
||||||
@ -157,6 +155,12 @@ def ffmpeg_concat_flv_to_mp4(files, output='output.mp4'):
|
|||||||
os.remove(output + '.txt')
|
os.remove(output + '.txt')
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def ffmpeg_concat_flv_to_mp4(files, output='output.mp4'):
|
||||||
|
print('Merging video parts... ', end="", flush=True)
|
||||||
|
# Use concat demuxer on FFmpeg >= 1.1
|
||||||
|
if ffmpeg_concat_demuxer(files, output):
|
||||||
|
return True
|
||||||
|
|
||||||
for file in files:
|
for file in files:
|
||||||
if os.path.isfile(file):
|
if os.path.isfile(file):
|
||||||
params = [FFMPEG] + LOGLEVEL + ['-y', '-i']
|
params = [FFMPEG] + LOGLEVEL + ['-y', '-i']
|
||||||
@ -201,14 +205,7 @@ def ffmpeg_concat_mp3_to_mp3(files, output='output.mp3'):
|
|||||||
def ffmpeg_concat_mp4_to_mp4(files, output='output.mp4'):
|
def ffmpeg_concat_mp4_to_mp4(files, output='output.mp4'):
|
||||||
print('Merging video parts... ', end="", flush=True)
|
print('Merging video parts... ', end="", flush=True)
|
||||||
# Use concat demuxer on FFmpeg >= 1.1
|
# Use concat demuxer on FFmpeg >= 1.1
|
||||||
if FFMPEG == 'ffmpeg' and (FFMPEG_VERSION[0] >= 2 or (FFMPEG_VERSION[0] == 1 and FFMPEG_VERSION[1] >= 1)):
|
if ffmpeg_concat_demuxer(files, output):
|
||||||
concat_list = generate_concat_list(files, output)
|
|
||||||
params = [FFMPEG] + LOGLEVEL + ['-y', '-f', 'concat', '-safe', '0',
|
|
||||||
'-i', concat_list, '-c', 'copy',
|
|
||||||
'-bsf:a', 'aac_adtstoasc']
|
|
||||||
params.extend(['--', output])
|
|
||||||
subprocess.check_call(params, stdin=STDIN)
|
|
||||||
os.remove(output + '.txt')
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
for file in files:
|
for file in files:
|
||||||
|
Loading…
Reference in New Issue
Block a user