Do not pass -map -0:s multiple times

This commit is contained in:
Riteo 2024-11-08 03:48:54 +01:00
parent 0cc0f3f086
commit 4aa3c401d4

View File

@ -662,13 +662,17 @@ def run(self, info):
opts = [*self.stream_copy_opts(ext=info['ext'])] opts = [*self.stream_copy_opts(ext=info['ext'])]
if sub_langs and sub_names:
# We have regular subtitles available to embed. Don't copy the
# existing subtitles, we may be running the postprocessor a second
# time.
opts.extend([
'-map', '-0:s',
])
for i, (lang, name) in enumerate(zip(sub_langs, sub_names)): for i, (lang, name) in enumerate(zip(sub_langs, sub_names)):
lang_code = ISO639Utils.short2long(lang) or lang lang_code = ISO639Utils.short2long(lang) or lang
opts.extend([ opts.extend([
# Don't copy the existing subtitles, we may be running the
# postprocessor a second time
'-map', '-0:s',
'-map', f'{i + 1}:0', '-map', f'{i + 1}:0',
f'-metadata:s:s:{i}', f'language={lang_code}', f'-metadata:s:s:{i}', f'language={lang_code}',
]) ])