mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-11-28 21:22:13 +00:00
[postprocessor/ffmpeg] Allow embedding subtitles in m4a
This commit is contained in:
parent
a803582717
commit
84ccbf171e
2 changed files with 4 additions and 4 deletions
|
@ -813,7 +813,7 @@ def parseOpts(overrideArguments=None):
|
||||||
postproc.add_option(
|
postproc.add_option(
|
||||||
'--embed-subs',
|
'--embed-subs',
|
||||||
action='store_true', dest='embedsubtitles', default=False,
|
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(
|
postproc.add_option(
|
||||||
'--embed-thumbnail',
|
'--embed-thumbnail',
|
||||||
action='store_true', dest='embedthumbnail', default=False,
|
action='store_true', dest='embedthumbnail', default=False,
|
||||||
|
|
|
@ -377,8 +377,8 @@ class FFmpegVideoConvertorPP(FFmpegPostProcessor):
|
||||||
|
|
||||||
class FFmpegEmbedSubtitlePP(FFmpegPostProcessor):
|
class FFmpegEmbedSubtitlePP(FFmpegPostProcessor):
|
||||||
def run(self, information):
|
def run(self, information):
|
||||||
if information['ext'] not in ('mp4', 'webm', 'mkv'):
|
if information['ext'] not in ('mp4', 'm4a', 'webm', 'mkv'):
|
||||||
self._downloader.to_screen('[ffmpeg] Subtitles can only be embedded in mp4, webm or mkv files')
|
self._downloader.to_screen('[ffmpeg] Subtitles can only be embedded in mp4, m4a, webm or mkv files')
|
||||||
return [], information
|
return [], information
|
||||||
subtitles = information.get('requested_subtitles')
|
subtitles = information.get('requested_subtitles')
|
||||||
if not subtitles:
|
if not subtitles:
|
||||||
|
@ -417,7 +417,7 @@ class FFmpegEmbedSubtitlePP(FFmpegPostProcessor):
|
||||||
# https://trac.ffmpeg.org/ticket/6016)
|
# https://trac.ffmpeg.org/ticket/6016)
|
||||||
'-map', '-0:d',
|
'-map', '-0:d',
|
||||||
]
|
]
|
||||||
if information['ext'] == 'mp4':
|
if information['ext'] in ('mp4', 'm4a'):
|
||||||
opts += ['-c:s', 'mov_text']
|
opts += ['-c:s', 'mov_text']
|
||||||
for (i, lang) in enumerate(sub_langs):
|
for (i, lang) in enumerate(sub_langs):
|
||||||
opts.extend(['-map', '%d:0' % (i + 1)])
|
opts.extend(['-map', '%d:0' % (i + 1)])
|
||||||
|
|
Loading…
Reference in a new issue