From 84ccbf171eea98ab7a92bec3145e3839df3de737 Mon Sep 17 00:00:00 2001 From: kikuyan Date: Tue, 17 Aug 2021 13:26:57 +0900 Subject: [PATCH] [postprocessor/ffmpeg] Allow embedding subtitles in m4a --- youtube_dl/options.py | 2 +- youtube_dl/postprocessor/ffmpeg.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/youtube_dl/options.py b/youtube_dl/options.py index 0a0641bd4..09df65047 100644 --- a/youtube_dl/options.py +++ b/youtube_dl/options.py @@ -813,7 +813,7 @@ def parseOpts(overrideArguments=None): postproc.add_option( '--embed-subs', action='store_true', dest='embedsubtitles', default=False, - help='Embed subtitles in the video (only for mp4, webm and mkv videos)') + help='Embed subtitles in the video or audio (only for mp4, m4a, webm and mkv files)') postproc.add_option( '--embed-thumbnail', action='store_true', dest='embedthumbnail', default=False, diff --git a/youtube_dl/postprocessor/ffmpeg.py b/youtube_dl/postprocessor/ffmpeg.py index 9f76c9d4e..52603b7d8 100644 --- a/youtube_dl/postprocessor/ffmpeg.py +++ b/youtube_dl/postprocessor/ffmpeg.py @@ -377,8 +377,8 @@ class FFmpegVideoConvertorPP(FFmpegPostProcessor): class FFmpegEmbedSubtitlePP(FFmpegPostProcessor): def run(self, information): - if information['ext'] not in ('mp4', 'webm', 'mkv'): - self._downloader.to_screen('[ffmpeg] Subtitles can only be embedded in mp4, webm or mkv files') + if information['ext'] not in ('mp4', 'm4a', 'webm', 'mkv'): + self._downloader.to_screen('[ffmpeg] Subtitles can only be embedded in mp4, m4a, webm or mkv files') return [], information subtitles = information.get('requested_subtitles') if not subtitles: @@ -417,7 +417,7 @@ class FFmpegEmbedSubtitlePP(FFmpegPostProcessor): # https://trac.ffmpeg.org/ticket/6016) '-map', '-0:d', ] - if information['ext'] == 'mp4': + if information['ext'] in ('mp4', 'm4a'): opts += ['-c:s', 'mov_text'] for (i, lang) in enumerate(sub_langs): opts.extend(['-map', '%d:0' % (i + 1)])