Merge pull request #8328 from remitamine/hls-master-detect
[youtube-dl] / youtube_dl / extractor / common.py
index 11191c173a9b216989b851d44d8dbdfaa92b08fa..33290fd7474e85ca559f5f3caa7a9aacf414e2a9 100644 (file)
@@ -825,6 +825,12 @@ class InfoExtractor(object):
         if not formats:
             raise ExtractorError('No video formats found')
 
+        for f in formats:
+            # Automatically determine tbr when missing based on abr and vbr (improves
+            # formats sorting in some cases)
+            if 'tbr' not in f and 'abr' in f and 'vbr' in f:
+                f['tbr'] = f['abr'] + f['vbr']
+
         def _formats_key(f):
             # TODO remove the following workaround
             from ..utils import determine_ext