mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-10-03 23:43:21 -04:00
Better Format Sorting (Squashed)
* Added --format-sort (-S height,filesize) * Made fields reversible (-S +height) * Added --format-sort-force, --no-format-sort-force * Added limit (-S height:720) * Added codec preference (-S vcodec,acodec) * Correct handling of preference<-1000 * Rebased to yt-dlc * Automatically determine missing bitrates * aext, vext, protocol, acodec, vcodec can now takes priority as string, not number (-S vext:webm) * Correct handling of None in codec, audio_codec (None means the codec is unknown while 'none' means it doesn't exist) * Correctly parse filesize (-S filesize:200M) * Generalized preference calculation * Rewrote entire code into the class FormatSort * Correctly handle user input errors * Combined fields (-S +ext:webm:webm) * Closest mode (-S filesize~50M) * Aliases (framerate=fps, br=bitrate etc) * Documentation
This commit is contained in:
@@ -162,7 +162,9 @@ class YoutubeDL(object):
|
||||
dump_single_json: Force printing the info_dict of the whole playlist
|
||||
(or video) as a single JSON line.
|
||||
simulate: Do not download the video files.
|
||||
format: Video format code. See options.py for more information.
|
||||
format: Video format code. see "FORMAT SELECTION" for more details.
|
||||
format_sort: How to sort the video formats. see "Sorting Formats" for more details.
|
||||
format_sort_force: Force the given format_sort. see "Sorting Formats" for more details.
|
||||
outtmpl: Template for output names.
|
||||
restrictfilenames: Do not allow "&" and spaces in file names.
|
||||
trim_file_name: Limit length of filename (extension excluded).
|
||||
@@ -2305,8 +2307,8 @@ class YoutubeDL(object):
|
||||
[f['format_id'], f['ext'], self.format_resolution(f), self._format_note(f)]
|
||||
for f in formats
|
||||
if f.get('preference') is None or f['preference'] >= -1000]
|
||||
if len(formats) > 1:
|
||||
table[-1][-1] += (' ' if table[-1][-1] else '') + '(best)'
|
||||
# if len(formats) > 1:
|
||||
# table[-1][-1] += (' ' if table[-1][-1] else '') + '(best)'
|
||||
|
||||
header_line = ['format code', 'extension', 'resolution', 'note']
|
||||
self.to_screen(
|
||||
|
Reference in New Issue
Block a user