[processor.ffmpeg] separate output with '--'

- See feffcb656a (r40158237)
This commit is contained in:
Mort Yao 2020-07-19 15:59:21 +02:00
parent 7db225a581
commit bf507e5e45
No known key found for this signature in database
GPG Key ID: 07DA00CB78203251

View File

@ -60,7 +60,7 @@ def ffmpeg_concat_av(files, output, ext):
for file in files:
if os.path.isfile(file): params.extend(['-i', file])
params.extend(['-c', 'copy'])
params.append(output)
params.extend(['--', output])
if subprocess.call(params, stdin=STDIN):
print('Merging without re-encode failed.\nTry again re-encoding audio... ', end="", flush=True)
try: os.remove(output)
@ -74,7 +74,7 @@ def ffmpeg_concat_av(files, output, ext):
params.extend(['-strict', 'experimental'])
elif ext == 'webm':
params.extend(['-c:a', 'opus'])
params.append(output)
params.extend(['--', output])
return subprocess.call(params, stdin=STDIN)
else:
return 0
@ -83,7 +83,8 @@ def ffmpeg_convert_ts_to_mkv(files, output='output.mkv'):
for file in files:
if os.path.isfile(file):
params = [FFMPEG] + LOGLEVEL
params.extend(['-y', '-i', file, output])
params.extend(['-y', '-i', file])
params.extend(['--', output])
subprocess.call(params, stdin=STDIN)
return
@ -93,7 +94,8 @@ def ffmpeg_concat_mp4_to_mpg(files, output='output.mpg'):
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)
params = [FFMPEG] + LOGLEVEL + ['-y', '-f', 'concat', '-safe', '-1',
'-i', concat_list, '-c', 'copy', output]
'-i', concat_list, '-c', 'copy']
params.extend(['--', output])
if subprocess.call(params, stdin=STDIN) == 0:
os.remove(output + '.txt')
return True
@ -114,7 +116,7 @@ def ffmpeg_concat_mp4_to_mpg(files, output='output.mpg'):
params = [FFMPEG] + LOGLEVEL + ['-y', '-i']
params.append(output + '.mpg')
params += ['-vcodec', 'copy', '-acodec', 'copy']
params.append(output)
params.extend(['--', output])
if subprocess.call(params, stdin=STDIN) == 0:
for file in files:
@ -131,7 +133,8 @@ def ffmpeg_concat_ts_to_mkv(files, output='output.mkv'):
for file in files:
if os.path.isfile(file):
params[-1] += file + '|'
params += ['-f', 'matroska', '-c', 'copy', output]
params += ['-f', 'matroska', '-c', 'copy']
params.extend(['--', output])
try:
if subprocess.call(params, stdin=STDIN) == 0:
@ -148,7 +151,8 @@ def ffmpeg_concat_flv_to_mp4(files, output='output.mp4'):
concat_list = generate_concat_list(files, output)
params = [FFMPEG] + LOGLEVEL + ['-y', '-f', 'concat', '-safe', '-1',
'-i', concat_list, '-c', 'copy',
'-bsf:a', 'aac_adtstoasc', output]
'-bsf:a', 'aac_adtstoasc']
params.extend(['--', output])
subprocess.check_call(params, stdin=STDIN)
os.remove(output + '.txt')
return True
@ -169,9 +173,10 @@ def ffmpeg_concat_flv_to_mp4(files, output='output.mp4'):
if os.path.isfile(f):
params[-1] += f + '|'
if FFMPEG == 'avconv':
params += ['-c', 'copy', output]
params += ['-c', 'copy']
else:
params += ['-c', 'copy', '-absf', 'aac_adtstoasc', output]
params += ['-c', 'copy', '-absf', 'aac_adtstoasc']
params.extend(['--', output])
if subprocess.call(params, stdin=STDIN) == 0:
for file in files:
@ -186,7 +191,8 @@ def ffmpeg_concat_mp3_to_mp3(files, output='output.mp3'):
files = 'concat:' + '|'.join(files)
params = [FFMPEG] + LOGLEVEL + ['-y']
params += ['-i', files, '-acodec', 'copy', output]
params += ['-i', files, '-acodec', 'copy']
params.extend(['--', output])
subprocess.call(params)
@ -199,7 +205,8 @@ def ffmpeg_concat_mp4_to_mp4(files, output='output.mp4'):
concat_list = generate_concat_list(files, output)
params = [FFMPEG] + LOGLEVEL + ['-y', '-f', 'concat', '-safe', '-1',
'-i', concat_list, '-c', 'copy',
'-bsf:a', 'aac_adtstoasc', output]
'-bsf:a', 'aac_adtstoasc']
params.extend(['--', output])
subprocess.check_call(params, stdin=STDIN)
os.remove(output + '.txt')
return True
@ -220,9 +227,10 @@ def ffmpeg_concat_mp4_to_mp4(files, output='output.mp4'):
if os.path.isfile(f):
params[-1] += f + '|'
if FFMPEG == 'avconv':
params += ['-c', 'copy', output]
params += ['-c', 'copy']
else:
params += ['-c', 'copy', '-absf', 'aac_adtstoasc', output]
params += ['-c', 'copy', '-absf', 'aac_adtstoasc']
params.extend(['--', output])
subprocess.check_call(params, stdin=STDIN)
for file in files:
@ -248,7 +256,7 @@ def ffmpeg_download_stream(files, title, ext, params={}, output_dir='.', stream=
ffmpeg_params.append(files) #not the same here!!!!
if FFMPEG == 'avconv': #who cares?
ffmpeg_params += ['-c', 'copy', output]
ffmpeg_params += ['-c', 'copy']
else:
ffmpeg_params += ['-c', 'copy', '-bsf:a', 'aac_adtstoasc']
@ -258,7 +266,7 @@ def ffmpeg_download_stream(files, title, ext, params={}, output_dir='.', stream=
ffmpeg_params.append(k)
ffmpeg_params.append(v)
ffmpeg_params.append(output)
ffmpeg_params.extend(['--', output])
print(' '.join(ffmpeg_params))
@ -286,7 +294,7 @@ def ffmpeg_concat_audio_and_video(files, output, ext):
params.extend(['-c:v', 'copy'])
params.extend(['-c:a', 'aac'])
params.extend(['-strict', 'experimental'])
params.append(output+"."+ext)
params.extend(['--', output + "." + ext])
return subprocess.call(params, stdin=STDIN)
else:
raise EnvironmentError('No ffmpeg found')