Approximate filesize from bitrate

Closes #1400
This commit is contained in:
pukkandan 2021-10-24 18:02:00 +05:30
parent fccf502118
commit f2fe69c7b0
No known key found for this signature in database
GPG Key ID: 0F00D95A001F4698

View File

@ -2330,6 +2330,10 @@ class YoutubeDL(object):
format['resolution'] = self.format_resolution(format, default=None) format['resolution'] = self.format_resolution(format, default=None)
if format.get('dynamic_range') is None and format.get('vcodec') != 'none': if format.get('dynamic_range') is None and format.get('vcodec') != 'none':
format['dynamic_range'] = 'SDR' format['dynamic_range'] = 'SDR'
if (info_dict.get('duration') and format.get('tbr')
and not format.get('filesize') and not format.get('filesize_approx')):
format['filesize_approx'] = info_dict['duration'] * format['tbr'] * (1024 / 8)
# Add HTTP headers, so that external programs can use them from the # Add HTTP headers, so that external programs can use them from the
# json output # json output
full_format_info = info_dict.copy() full_format_info = info_dict.copy()