From f0cbbcf089f0f1119c44240f440c023f5bc4fee1 Mon Sep 17 00:00:00 2001 From: Anand Tamariya Date: Mon, 24 Dec 2018 16:37:38 +0530 Subject: [PATCH] For MP4 format and stdout, use -movflags option. --- youtube_dl/downloader/external.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/youtube_dl/downloader/external.py b/youtube_dl/downloader/external.py index 1ba839716..b6601d7ba 100644 --- a/youtube_dl/downloader/external.py +++ b/youtube_dl/downloader/external.py @@ -300,10 +300,12 @@ class FFmpegFD(ExternalFD): args += ['-fs', compat_str(self._TEST_FILE_SIZE)] if protocol in ('m3u8', 'm3u8_native'): - if self.params.get('hls_use_mpegts', False) or tmpfilename == '-': + if self.params.get('hls_use_mpegts', False): args += ['-f', 'mpegts'] else: args += ['-f', 'mp4'] + if tmpfilename == '-': + args += ["-movflags", "frag_keyframe+empty_moov"] if (ffpp.basename == 'ffmpeg' and is_outdated_version(ffpp._versions['ffmpeg'], '3.2', False)) and (not info_dict.get('acodec') or info_dict['acodec'].split('.')[0] in ('aac', 'mp4a')): args += ['-bsf:a', 'aac_adtstoasc'] elif protocol == 'rtmp':