aboutsummaryrefslogtreecommitdiffstats
path: root/yt_dlp
diff options
context:
space:
mode:
Diffstat (limited to 'yt_dlp')
-rw-r--r--yt_dlp/downloader/external.py5
-rw-r--r--yt_dlp/options.py14
2 files changed, 15 insertions, 4 deletions
diff --git a/yt_dlp/downloader/external.py b/yt_dlp/downloader/external.py
index 4bef3bf52..5d9639076 100644
--- a/yt_dlp/downloader/external.py
+++ b/yt_dlp/downloader/external.py
@@ -398,7 +398,10 @@ 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 == '-':
+ use_mpegts = (tmpfilename == '-') or self.params.get('hls_use_mpegts')
+ if use_mpegts is None:
+ use_mpegts = info_dict.get('is_live')
+ if use_mpegts:
args += ['-f', 'mpegts']
else:
args += ['-f', 'mp4']
diff --git a/yt_dlp/options.py b/yt_dlp/options.py
index c47f6ea50..88f74ff36 100644
--- a/yt_dlp/options.py
+++ b/yt_dlp/options.py
@@ -634,10 +634,18 @@ def parseOpts(overrideArguments=None):
help='Use ffmpeg instead of the native HLS downloader')
downloader.add_option(
'--hls-use-mpegts',
- dest='hls_use_mpegts', action='store_true',
+ dest='hls_use_mpegts', action='store_true', default=None,
help=(
- 'Use the mpegts container for HLS videos, allowing to play the '
- 'video while downloading (some players may not be able to play it)'))
+ 'Use the mpegts container for HLS videos; '
+ 'allowing some players to play the video while downloading, '
+ 'and reducing the chance of file corruption if download is interrupted. '
+ 'This is enabled by default for live streams'))
+ downloader.add_option(
+ '--no-hls-use-mpegts',
+ dest='hls_use_mpegts', action='store_false',
+ help=(
+ 'Do not use the mpegts container for HLS videos. '
+ 'This is default when not downloading live streams'))
downloader.add_option(
'--external-downloader',
dest='external_downloader', metavar='NAME',