fix for x265 concatenation

This commit is contained in:
Zen 2020-07-18 22:12:26 +03:00
parent c3b100c22e
commit 2a8870bf85

View file

@ -27,15 +27,11 @@ def concatenate_video(temp, output, encoder):
audio = '' audio = ''
if encoder == 'x265': if encoder == 'x265':
# Idk method to make concatenation work with x265 right away
tmp = temp / 'tmp.mp4'
cmd = f' ffmpeg -y -hide_banner -loglevel error -f concat -safe 0 -i {temp / "concat"} ' \ cmd = f' ffmpeg -y -fflags +genpts -hide_banner -loglevel error -f concat -safe 0 -i {temp / "concat"} ' \
f'{audio} -c copy -map 0 -y "{tmp}"' f'{audio} -c copy -movflags frag_keyframe+empty_moov -map 0 -f mp4 - | ffmpeg -y -hide_banner -loglevel error -i - -c copy {output} '
concat = subprocess.run(cmd, shell=True, stdout=PIPE, stderr=STDOUT).stdout concat = subprocess.run(cmd, shell=True, stdout=PIPE, stderr=STDOUT).stdout
cmd = f'ffmpeg -y -hide_banner -loglevel error -i {tmp} -c copy {output}'
subprocess.run(cmd, shell=True, stdout=PIPE, stderr=STDOUT).stdout
else: else:
cmd = f' ffmpeg -y -hide_banner -loglevel error -f concat -safe 0 -i {temp / "concat"} ' \ cmd = f' ffmpeg -y -hide_banner -loglevel error -f concat -safe 0 -i {temp / "concat"} ' \