X-Git-Url: http://git.cielonegro.org/gitweb.cgi?a=blobdiff_plain;ds=inline;f=youtube_dl%2Fpostprocessor%2Fffmpeg.py;h=5b0ff32b14747d91b1c5c7223fa4efaae7aac574;hb=b4a64c592b5f0f547c11c72e6c840612b336de5d;hp=26b99e43c33bd4bcebea171a9df71969273a1cc8;hpb=52afb2ac1b6551350cf4d28ad0d758a136186297;p=youtube-dl.git diff --git a/youtube_dl/postprocessor/ffmpeg.py b/youtube_dl/postprocessor/ffmpeg.py index 26b99e43c..5b0ff32b1 100644 --- a/youtube_dl/postprocessor/ffmpeg.py +++ b/youtube_dl/postprocessor/ffmpeg.py @@ -475,15 +475,21 @@ class FFmpegEmbedSubtitlePP(FFmpegPostProcessor): filename = information['filepath'] input_files = [filename] + [subtitles_filename(filename, lang, self._subformat) for lang in sub_langs] - opts = ['-map', '0:0', '-map', '0:1', '-c:v', 'copy', '-c:a', 'copy'] + opts = [ + '-map', '0', + '-c', 'copy', + # Don't copy the existing subtitles, we may be running the + # postprocessor a second time + '-map', '-0:s', + '-c:s', 'mov_text', + ] for (i, lang) in enumerate(sub_langs): - opts.extend(['-map', '%d:0' % (i + 1), '-c:s:%d' % i, 'mov_text']) + opts.extend(['-map', '%d:0' % (i + 1)]) lang_code = self._conver_lang_code(lang) if lang_code is not None: opts.extend(['-metadata:s:s:%d' % i, 'language=%s' % lang_code]) - opts.extend(['-f', 'mp4']) - temp_filename = filename + '.temp' + temp_filename = prepend_extension(filename, 'temp') self._downloader.to_screen('[ffmpeg] Embedding subtitles in \'%s\'' % filename) self.run_ffmpeg_multiple_files(input_files, temp_filename, opts) os.remove(encodeFilename(filename))