mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-10 01:02:13 +01:00
[hls] Enable --hls-use-mpegts
by default when downloading live-streams
* Also added option `--no-hls-use-mpegts` to disable this Related: #96
This commit is contained in:
parent
ed9b7e3dd3
commit
9bd2020476
3 changed files with 24 additions and 8 deletions
13
README.md
13
README.md
|
@ -317,10 +317,15 @@ ## Download Options:
|
||||||
ffmpeg
|
ffmpeg
|
||||||
--hls-prefer-ffmpeg Use ffmpeg instead of the native HLS
|
--hls-prefer-ffmpeg Use ffmpeg instead of the native HLS
|
||||||
downloader
|
downloader
|
||||||
--hls-use-mpegts Use the mpegts container for HLS videos,
|
--hls-use-mpegts Use the mpegts container for HLS videos;
|
||||||
allowing to play the video while
|
allowing some players to play the video
|
||||||
downloading (some players may not be able
|
while downloading, and reducing the chance
|
||||||
to play it)
|
of file corruption if download is
|
||||||
|
interrupted. This is enabled by default for
|
||||||
|
live streams
|
||||||
|
--no-hls-use-mpegts Do not use the mpegts container for HLS
|
||||||
|
videos. This is default when not
|
||||||
|
downloading live streams
|
||||||
--external-downloader NAME Use the specified external downloader.
|
--external-downloader NAME Use the specified external downloader.
|
||||||
Currently supports aria2c, avconv, axel,
|
Currently supports aria2c, avconv, axel,
|
||||||
curl, ffmpeg, httpie, wget
|
curl, ffmpeg, httpie, wget
|
||||||
|
|
|
@ -398,7 +398,10 @@ def _call_downloader(self, tmpfilename, info_dict):
|
||||||
args += ['-fs', compat_str(self._TEST_FILE_SIZE)]
|
args += ['-fs', compat_str(self._TEST_FILE_SIZE)]
|
||||||
|
|
||||||
if protocol in ('m3u8', 'm3u8_native'):
|
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']
|
args += ['-f', 'mpegts']
|
||||||
else:
|
else:
|
||||||
args += ['-f', 'mp4']
|
args += ['-f', 'mp4']
|
||||||
|
|
|
@ -634,10 +634,18 @@ def _dict_from_multiple_values_options_callback(
|
||||||
help='Use ffmpeg instead of the native HLS downloader')
|
help='Use ffmpeg instead of the native HLS downloader')
|
||||||
downloader.add_option(
|
downloader.add_option(
|
||||||
'--hls-use-mpegts',
|
'--hls-use-mpegts',
|
||||||
dest='hls_use_mpegts', action='store_true',
|
dest='hls_use_mpegts', action='store_true', default=None,
|
||||||
help=(
|
help=(
|
||||||
'Use the mpegts container for HLS videos, allowing to play the '
|
'Use the mpegts container for HLS videos; '
|
||||||
'video while downloading (some players may not be able to play it)'))
|
'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(
|
downloader.add_option(
|
||||||
'--external-downloader',
|
'--external-downloader',
|
||||||
dest='external_downloader', metavar='NAME',
|
dest='external_downloader', metavar='NAME',
|
||||||
|
|
Loading…
Reference in a new issue