diff --git a/README.md b/README.md index 6b2e6c0033..e167995eb8 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/yt_dlp/options.py b/yt_dlp/options.py index 14b582fc42..4e81761f56 100644 --- a/yt_dlp/options.py +++ b/yt_dlp/options.py @@ -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,