1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2026-01-20 13:51:20 +00:00

Add --format-sort-reset option (#13809)

Authored by: nihil-admirari
This commit is contained in:
Nil Admirari
2026-01-19 20:40:08 +03:00
committed by GitHub
parent 0b08b833bf
commit b16b06378a
2 changed files with 6 additions and 0 deletions

View File

@@ -1645,6 +1645,8 @@ Note that the default for hdr is `hdr:12`; i.e. Dolby Vision is not preferred. T
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 respects. 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`.
If you use the `-S`/`--format-sort` option multiple times, each subsequent sorting argument will be prepended to the previous one, and only the highest priority entry of any duplicated field will be preserved. E.g. `-S proto -S res` is equivalent to `-S res,proto`, and `-S res:720,fps -S vcodec,res:1080` is equivalent to `-S vcodec,res:1080,fps`. You can use `--format-sort-reset` to disregard any previously passed `-S`/`--format-sort` arguments and reset to the default order.
**Tip**: You can use the `-v -F` to see how the formats have been sorted (worst to best).
## Format Selection examples

View File

@@ -882,6 +882,10 @@ def create_parser():
dest='format_sort', default=[], type='str', action='callback',
callback=_list_from_options_callback, callback_kwargs={'append': -1},
help='Sort the formats by the fields given, see "Sorting Formats" for more details')
video_format.add_option(
'--format-sort-reset',
dest='format_sort', action='store_const', const=[],
help='Disregard previous user specified sort order and reset to the default')
video_format.add_option(
'--format-sort-force', '--S-force',
action='store_true', dest='format_sort_force', metavar='FORMAT', default=False,