From 50eff38c1c071e2d389799843530c294d31887ed Mon Sep 17 00:00:00 2001 From: pukkandan Date: Thu, 23 Sep 2021 11:48:49 +0530 Subject: [PATCH] bugfix for a21e0ab1a1a03f82517cd8cec4b9a2b4d6b81ac3 Closes #1061 --- yt_dlp/postprocessor/ffmpeg.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/yt_dlp/postprocessor/ffmpeg.py b/yt_dlp/postprocessor/ffmpeg.py index 6f274b196..7ea01620e 100644 --- a/yt_dlp/postprocessor/ffmpeg.py +++ b/yt_dlp/postprocessor/ffmpeg.py @@ -730,11 +730,13 @@ def run(self, info): filename = info['filepath'] temp_filename = prepend_extension(filename, 'temp') args = ['-c', 'copy'] + audio_streams = 0 for (i, fmt) in enumerate(info['requested_formats']): if fmt.get('acodec') != 'none': args.extend(['-map', f'{i}:a:0']) if self.get_audio_codec(fmt['filepath']) == 'aac': - args.extend([f'-bsf:{i}:a:0', 'aac_adtstoasc']) + args.extend([f'-bsf:a:{audio_streams}', 'aac_adtstoasc']) + audio_streams += 1 if fmt.get('vcodec') != 'none': args.extend(['-map', '%u:v:0' % (i)]) self.to_screen('Merging formats into "%s"' % filename)