diff options
author | Sergey M․ <[email protected]> | 2017-10-11 23:45:03 +0700 |
---|---|---|
committer | Sergey M․ <[email protected]> | 2017-10-11 23:48:05 +0700 |
commit | af0f74288dc1b46147bc8f6b5692d2a21c6e178b (patch) | |
tree | 5f91347c32048f1f635608bd6cdc42db40ff075b /youtube_dl/YoutubeDL.py | |
parent | 9e38dbb19ca6874c7350647ea2883d5bbb3b50a1 (diff) | |
download | youtube-dl-af0f74288dc1b46147bc8f6b5692d2a21c6e178b.tar.gz youtube-dl-af0f74288dc1b46147bc8f6b5692d2a21c6e178b.zip |
[YoutubeDL] Improve _default_format_spec (closes #14461)
Diffstat (limited to 'youtube_dl/YoutubeDL.py')
-rwxr-xr-x | youtube_dl/YoutubeDL.py | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/youtube_dl/YoutubeDL.py b/youtube_dl/YoutubeDL.py index 855d6b8e5..342d6b47c 100755 --- a/youtube_dl/YoutubeDL.py +++ b/youtube_dl/YoutubeDL.py @@ -1078,22 +1078,27 @@ class YoutubeDL(object): return _filter def _default_format_spec(self, info_dict, download=True): - req_format_list = [] - def can_have_partial_formats(): + def can_merge(): + merger = FFmpegMergerPP(self) + return merger.available and merger.can_merge() + + def prefer_best(): if self.params.get('simulate', False): - return True + return False if not download: - return True - if self.params.get('outtmpl', DEFAULT_OUTTMPL) == '-': return False + if self.params.get('outtmpl', DEFAULT_OUTTMPL) == '-': + return True if info_dict.get('is_live'): - return False - merger = FFmpegMergerPP(self) - return merger.available and merger.can_merge() - if can_have_partial_formats(): - req_format_list.append('bestvideo+bestaudio') - req_format_list.append('best') + return True + if not can_merge(): + return True + return False + + req_format_list = ['bestvideo+bestaudio', 'best'] + if prefer_best(): + req_format_list.reverse() return '/'.join(req_format_list) def build_format_selector(self, format_spec): |