From ca5db158aecc36a3db41faa85a26e7d931b5d72b Mon Sep 17 00:00:00 2001 From: pukkandan Date: Mon, 20 Dec 2021 08:26:03 +0530 Subject: [PATCH] [postprocessor/ffmpeg] Always add `faststart` Closes #1491 --- yt_dlp/postprocessor/ffmpeg.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/yt_dlp/postprocessor/ffmpeg.py b/yt_dlp/postprocessor/ffmpeg.py index 73bbf7fb0..26af55a9b 100644 --- a/yt_dlp/postprocessor/ffmpeg.py +++ b/yt_dlp/postprocessor/ffmpeg.py @@ -294,7 +294,9 @@ def real_run_ffmpeg(self, input_path_opts, output_path_opts, *, expected_retcode def make_args(file, args, name, number): keys = ['_%s%d' % (name, number), '_%s' % name] - if name == 'o' and number == 1: + if name == 'o': + args += ['-movflags', '+faststart'] + elif number == 1: keys.append('') args += self._configuration_args(self.basename, keys) if name == 'i': @@ -368,7 +370,7 @@ def concat_files(self, in_files, out_file, concat_opts=None): out_flags = ['-c', 'copy'] if out_file.rpartition('.')[-1] in ('mp4', 'mov'): # For some reason, '-c copy' is not enough to copy subtitles - out_flags.extend(['-c:s', 'mov_text', '-movflags', '+faststart']) + out_flags.extend(['-c:s', 'mov_text']) try: self.real_run_ffmpeg( @@ -571,10 +573,7 @@ class FFmpegVideoRemuxerPP(FFmpegVideoConvertorPP): @staticmethod def _options(target_ext): - options = ['-c', 'copy', '-map', '0', '-dn'] - if target_ext in ['mp4', 'm4a', 'mov']: - options.extend(['-movflags', '+faststart']) - return options + return ['-c', 'copy', '-map', '0', '-dn'] class FFmpegEmbedSubtitlePP(FFmpegPostProcessor):