diff --git a/README.md b/README.md index cc454aac40..520a85d7e3 100644 --- a/README.md +++ b/README.md @@ -520,8 +520,12 @@ ## Video Format Options: --no-audio-multistreams Only one audio stream is downloaded for each output file (default) --all-formats Download all available video formats - --prefer-free-formats Prefer free video formats over non-free - formats of same quality + --prefer-free-formats Prefer video formats with free containers + over non-free ones of same quality. Use + with "-S ext" to strictly prefer free + containers irrespective of quality + --no-prefer-free-formats Don't give any special preference to free + containers (default) -F, --list-formats List all available formats of requested videos --list-formats-as-table Present the output of -F in tabular form diff --git a/youtube_dlc/extractor/common.py b/youtube_dlc/extractor/common.py index 072ae5b812..49df880d0b 100644 --- a/youtube_dlc/extractor/common.py +++ b/youtube_dlc/extractor/common.py @@ -1469,13 +1469,12 @@ def _resolve_field_value(self, field, value, convertNone=False): elif conversion == 'bytes': return FileDownloader.parse_bytes(value) elif conversion == 'order': - order_free = self._get_field_setting(field, 'order_free') - order_list = order_free if order_free and self._use_free_order else self._get_field_setting(field, 'order') + order_list = (self._use_free_order and self._get_field_setting(field, 'order_free')) or self._get_field_setting(field, 'order') use_regex = self._get_field_setting(field, 'regex') list_length = len(order_list) empty_pos = order_list.index('') if '' in order_list else list_length + 1 if use_regex and value is not None: - for (i, regex) in enumerate(order_list): + for i, regex in enumerate(order_list): if regex and re.match(regex, value): return list_length - i return list_length - empty_pos # not in list diff --git a/youtube_dlc/options.py b/youtube_dlc/options.py index bb37554ec1..93f972133c 100644 --- a/youtube_dlc/options.py +++ b/youtube_dlc/options.py @@ -483,7 +483,13 @@ def _dict_from_multiple_values_options_callback( video_format.add_option( '--prefer-free-formats', action='store_true', dest='prefer_free_formats', default=False, - help='Prefer free video formats over non-free formats of same quality') + help=( + 'Prefer video formats with free containers over non-free ones of same quality. ' + 'Use with "-S ext" to strictly prefer free containers irrespective of quality')) + video_format.add_option( + '--no-prefer-free-formats', + action='store_true', dest='prefer_free_formats', default=False, + help="Don't give any special preference to free containers (default)") video_format.add_option( '-F', '--list-formats', action='store_true', dest='listformats',