mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-24 07:40:30 +01:00
Change defaults
* Enabled --ignore by default * Disabled --video-multistreams and --audio-multistreams by default * Changed default format selection to 'bv*+ba/b' when --audio-multistreams is disabled * Changed default format sort order to 'res,fps,codec,size,br,asr,proto,ext,has_audio,source,format_id' * Changed default output template to '%(title)s [%(id)s].%(ext)s' * Enabled `--list-formats-as-table` by default
This commit is contained in:
parent
50865ca803
commit
91ebc64068
21
README.md
21
README.md
@ -169,7 +169,7 @@ # OPTIONS
|
||||
|
||||
-i, --ignore-errors Continue on download errors, for example to
|
||||
skip unavailable videos in a playlist
|
||||
(Same as --no-abort-on-error)
|
||||
(default) (Same as --no-abort-on-error)
|
||||
--abort-on-error Abort downloading of further videos if an
|
||||
error occurs (Same as --no-ignore-errors)
|
||||
--dump-user-agent Display the current browser identification
|
||||
@ -498,20 +498,21 @@ ## Video Format Options:
|
||||
specified sort order, see "Sorting Formats"
|
||||
for more details (default)
|
||||
--video-multistreams Allow multiple video streams to be merged into
|
||||
a single file (default)
|
||||
a single file
|
||||
--no-video-multistreams Only one video stream is downloaded for each
|
||||
output file
|
||||
output file (default)
|
||||
--audio-multistreams Allow multiple audio streams to be merged into
|
||||
a single file (default)
|
||||
a single file
|
||||
--no-audio-multistreams Only one audio stream is downloaded for each
|
||||
output file
|
||||
output file (default)
|
||||
--all-formats Download all available video formats
|
||||
--prefer-free-formats Prefer free video formats unless a specific
|
||||
one is requested
|
||||
-F, --list-formats List all available formats of requested
|
||||
videos
|
||||
--list-formats-as-table Present the output of -F in a more tabular form
|
||||
--list-formats-old Present the output of -F in older form (default)
|
||||
--list-formats-as-table Present the output of -F in a more tabular
|
||||
form (default)
|
||||
--list-formats-old Present the output of -F in older form
|
||||
(Same as --no-list-formats-as-table)
|
||||
--youtube-skip-dash-manifest Do not download the DASH manifests and
|
||||
related data on YouTube videos
|
||||
@ -807,7 +808,7 @@ # OUTPUT TEMPLATE
|
||||
|
||||
To use percent literals in an output template use `%%`. To output to stdout use `-o -`.
|
||||
|
||||
The current default template is `%(title)s-%(id)s.%(ext)s`.
|
||||
The current default template is `%(title)s [%(id)s].%(ext)s`.
|
||||
|
||||
In some cases, you don't want special characters such as 中, spaces, or &, such as when transferring the downloaded filename to a Windows system or the filename through an 8bit-unsafe channel. In these cases, add the `--restrict-filenames` flag to get a shorter title:
|
||||
|
||||
@ -845,7 +846,7 @@ # Stream the video being downloaded to stdout
|
||||
# FORMAT SELECTION
|
||||
|
||||
By default, youtube-dlc tries to download the best available quality if you **don't** pass any options.
|
||||
This is generally equivalent to using `-f bestvideo+bestaudio/best`. However, if ffmpeg and avconv are unavailable, or if you use youtube-dlc to stream to `stdout` (`-o -`), the default becomes `-f best/bestvideo+bestaudio`.
|
||||
This is generally equivalent to using `-f bestvideo*+bestaudio/best`. However, if multiple audiostreams is enabled (`--audio-multistreams`), the default format changes to `-f bestvideo+bestaudio/best`. Similarly, if ffmpeg and avconv are unavailable, or if you use youtube-dlc to stream to `stdout` (`-o -`), the default becomes `-f best/bestvideo+bestaudio`.
|
||||
|
||||
The general syntax for format selection is `--f FORMAT` (or `--format FORMAT`) where `FORMAT` is a *selector expression*, i.e. an expression that describes format or formats you would like to download.
|
||||
|
||||
@ -948,7 +949,7 @@ ## Sorting Formats
|
||||
|
||||
Note that any other **numerical** field made available by the extractor can also be used. All fields, unless specified otherwise, are sorted in decending order. To reverse this, prefix the field with a `+`. Eg: `+res` prefers format with the smallest resolution. Additionally, you can suffix a prefered value for the fields, seperated by a `:`. Eg: `res:720` prefers larger videos, but no larger than 720p and the smallest video if there are no videos less than 720p. For `codec` and `ext`, you can provide two prefered values, the first for video and the second for audio. Eg: `+codec:avc:m4a` (equivalent to `+vcodec:avc,+acodec:m4a`) sets the video codec preference to `h264` > `h265` > `vp9` > `av01` > `vp8` > `h263` > `theora` and audio codec preference to `mp4a` > `aac` > `vorbis` > `opus` > `mp3` > `ac3` > `dts`. You can also make the sorting prefer the nearest values to the provided by using `~` as the delimiter. Eg: `filesize~1G` prefers the format with filesize closest to 1 GiB.
|
||||
|
||||
The fields `has_video`, `extractor`, `lang`, `quality` are always given highest priority in sorting, irrespective of the user-defined order. This behaviour can be changed by using `--force-format-sort`. Apart from these, the default order used by youtube-dlc is: `tbr,filesize,vbr,height,width,protocol,vext,abr,aext,fps,filesize_approx,source_preference,format_id`. Note that the extractors may override this default order, but not the user-provided order.
|
||||
The fields `has_video`, `extractor`, `lang`, `quality` are always given highest priority in sorting, irrespective of the user-defined order. This behaviour can be changed by using `--force-format-sort`. Apart from these, the default order used by youtube-dlc is: `res,fps,codec,size,br,asr,proto,ext,has_audio,source,format_id`. Note that the extractors may override this default order, but not the user-provided order.
|
||||
|
||||
If your format selector is `worst`, the last item is selected after sorting. This means it will select the format that is worst in all repects. Most of the time, what you actually want is the video with the smallest filesize instead. So it is generally better to use `-f best -S +size,+br,+res,+fps`.
|
||||
|
||||
|
@ -178,7 +178,7 @@ class YoutubeDL(object):
|
||||
outtmpl: Template for output names.
|
||||
restrictfilenames: Do not allow "&" and spaces in file names.
|
||||
trim_file_name: Limit length of filename (extension excluded).
|
||||
ignoreerrors: Do not stop on download errors.
|
||||
ignoreerrors: Do not stop on download errors. (Default False when running youtube-dlc, but True when directly accessing YoutubeDL class)
|
||||
force_generic_extractor: Force downloader to use the generic extractor
|
||||
nooverwrites: Prevent overwriting files.
|
||||
playliststart: Playlist item to start at.
|
||||
@ -1185,23 +1185,20 @@ def can_merge():
|
||||
merger = FFmpegMergerPP(self)
|
||||
return merger.available and merger.can_merge()
|
||||
|
||||
def prefer_best():
|
||||
if self.params.get('simulate', False):
|
||||
return False
|
||||
if not download:
|
||||
return False
|
||||
if self.params.get('outtmpl', DEFAULT_OUTTMPL) == '-':
|
||||
return True
|
||||
if info_dict.get('is_live'):
|
||||
return True
|
||||
if not can_merge():
|
||||
return True
|
||||
return False
|
||||
prefer_best = (
|
||||
not self.params.get('simulate', False)
|
||||
and download
|
||||
and (
|
||||
not can_merge()
|
||||
or info_dict.get('is_live')
|
||||
or self.params.get('outtmpl', DEFAULT_OUTTMPL) == '-'))
|
||||
|
||||
req_format_list = ['bestvideo+bestaudio', 'best']
|
||||
if prefer_best():
|
||||
req_format_list.reverse()
|
||||
return '/'.join(req_format_list)
|
||||
return (
|
||||
'best/bestvideo+bestaudio'
|
||||
if prefer_best
|
||||
else 'bestvideo*+bestaudio/best'
|
||||
if self.params.get('allow_multiple_audio_streams', False)
|
||||
else 'bestvideo+bestaudio/best')
|
||||
|
||||
def build_format_selector(self, format_spec):
|
||||
def syntax_error(note, start):
|
||||
@ -1216,8 +1213,8 @@ def syntax_error(note, start):
|
||||
GROUP = 'GROUP'
|
||||
FormatSelector = collections.namedtuple('FormatSelector', ['type', 'selector', 'filters'])
|
||||
|
||||
allow_multiple_streams = {'audio': self.params.get('allow_multiple_audio_streams', True),
|
||||
'video': self.params.get('allow_multiple_video_streams', True)}
|
||||
allow_multiple_streams = {'audio': self.params.get('allow_multiple_audio_streams', False),
|
||||
'video': self.params.get('allow_multiple_video_streams', False)}
|
||||
|
||||
def _parse_filter(tokens):
|
||||
filter_parts = []
|
||||
|
@ -1367,8 +1367,8 @@ class FormatSort:
|
||||
regex = r' *((?P<reverse>\+)?(?P<field>[a-zA-Z0-9_]+)((?P<seperator>[~:])(?P<limit>.*?))?)? *$'
|
||||
|
||||
default = ('hidden', 'has_video', 'extractor', 'lang', 'quality',
|
||||
'tbr', 'filesize', 'vbr', 'height', 'width', 'protocol', 'vext',
|
||||
'abr', 'aext', 'fps', 'filesize_approx', 'source_preference', 'format_id')
|
||||
'res', 'fps', 'codec', 'size', 'br', 'asr',
|
||||
'proto', 'ext', 'has_audio', 'source', 'format_id')
|
||||
|
||||
settings = {
|
||||
'vcodec': {'type': 'ordered', 'regex': True,
|
||||
@ -1378,7 +1378,7 @@ class FormatSort:
|
||||
'protocol': {'type': 'ordered', 'regex': True,
|
||||
'order': ['(ht|f)tps', '(ht|f)tp$', 'm3u8.+', 'm3u8', '.*dash', '', 'mms|rtsp', 'none', 'f4']},
|
||||
'vext': {'type': 'ordered', 'field': 'video_ext',
|
||||
'order': ('mp4', 'flv', 'webm', '', 'none'), # Why is flv prefered over webm???
|
||||
'order': ('mp4', 'webm', 'flv', '', 'none'),
|
||||
'order_free': ('webm', 'mp4', 'flv', '', 'none')},
|
||||
'aext': {'type': 'ordered', 'field': 'audio_ext',
|
||||
'order': ('m4a', 'aac', 'mp3', 'ogg', 'opus', 'webm', '', 'none'),
|
||||
@ -1386,7 +1386,7 @@ class FormatSort:
|
||||
'hidden': {'visible': False, 'forced': True, 'type': 'extractor', 'max': -1000},
|
||||
'extractor_preference': {'priority': True, 'type': 'extractor'},
|
||||
'has_video': {'priority': True, 'field': 'vcodec', 'type': 'boolean', 'not_in_list': ('none',)},
|
||||
'has_audio': {'priority': False, 'field': 'acodec', 'type': 'boolean', 'not_in_list': ('none',)},
|
||||
'has_audio': {'field': 'acodec', 'type': 'boolean', 'not_in_list': ('none',)},
|
||||
'language_preference': {'priority': True, 'convert': 'ignore'},
|
||||
'quality': {'priority': True, 'convert': 'float_none'},
|
||||
'filesize': {'convert': 'bytes'},
|
||||
|
@ -143,12 +143,12 @@ def _comma_separated_values_options_callback(option, opt_str, value, parser):
|
||||
help='Update this program to latest version. Make sure that you have sufficient permissions (run with sudo if needed)')
|
||||
general.add_option(
|
||||
'-i', '--ignore-errors', '--no-abort-on-error',
|
||||
action='store_true', dest='ignoreerrors', default=False,
|
||||
help='Continue on download errors, for example to skip unavailable videos in a playlist')
|
||||
action='store_true', dest='ignoreerrors', default=True,
|
||||
help='Continue on download errors, for example to skip unavailable videos in a playlist (default)')
|
||||
general.add_option(
|
||||
'--abort-on-error', '--no-ignore-errors',
|
||||
action='store_false', dest='ignoreerrors',
|
||||
help='Abort downloading of further videos if an error occurs (default)')
|
||||
help='Abort downloading of further videos if an error occurs')
|
||||
general.add_option(
|
||||
'--dump-user-agent',
|
||||
action='store_true', dest='dump_user_agent', default=False,
|
||||
@ -438,20 +438,20 @@ def _comma_separated_values_options_callback(option, opt_str, value, parser):
|
||||
'see "Sorting Formats" for more details'))
|
||||
video_format.add_option(
|
||||
'--video-multistreams',
|
||||
action='store_true', dest='allow_multiple_video_streams', default=True,
|
||||
help='Allow multiple video streams to be merged into a single file (default)')
|
||||
action='store_true', dest='allow_multiple_video_streams', default=False,
|
||||
help='Allow multiple video streams to be merged into a single file')
|
||||
video_format.add_option(
|
||||
'--no-video-multistreams',
|
||||
action='store_false', dest='allow_multiple_video_streams',
|
||||
help='Only one video stream is downloaded for each output file')
|
||||
help='Only one video stream is downloaded for each output file (default)')
|
||||
video_format.add_option(
|
||||
'--audio-multistreams',
|
||||
action='store_true', dest='allow_multiple_audio_streams', default=True,
|
||||
help='Allow multiple audio streams to be merged into a single file (default)')
|
||||
action='store_true', dest='allow_multiple_audio_streams', default=False,
|
||||
help='Allow multiple audio streams to be merged into a single file')
|
||||
video_format.add_option(
|
||||
'--no-audio-multistreams',
|
||||
action='store_false', dest='allow_multiple_audio_streams',
|
||||
help='Only one audio stream is downloaded for each output file')
|
||||
help='Only one audio stream is downloaded for each output file (default)')
|
||||
video_format.add_option(
|
||||
'--all-formats',
|
||||
action='store_const', dest='format', const='all',
|
||||
@ -466,8 +466,8 @@ def _comma_separated_values_options_callback(option, opt_str, value, parser):
|
||||
help='List all available formats of requested videos')
|
||||
video_format.add_option(
|
||||
'--list-formats-as-table',
|
||||
action='store_true', dest='listformats_table', default=False,
|
||||
help='Present the output of -F in a more tabular form')
|
||||
action='store_true', dest='listformats_table', default=True,
|
||||
help='Present the output of -F in a more tabular form (default)')
|
||||
video_format.add_option(
|
||||
'--list-formats-old', '--no-list-formats-as-table',
|
||||
action='store_false', dest='listformats_table',
|
||||
|
@ -4128,7 +4128,7 @@ def q(qid):
|
||||
return q
|
||||
|
||||
|
||||
DEFAULT_OUTTMPL = '%(title)s-%(id)s.%(ext)s'
|
||||
DEFAULT_OUTTMPL = '%(title)s [%(id)s].%(ext)s'
|
||||
|
||||
|
||||
def limit_length(s, length):
|
||||
|
Loading…
Reference in New Issue
Block a user