mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-09-03 00:25:08 +00:00
[core] Fix filesize_approx
calculation (#9560)
Reverts 22e4dfacb6
Despite being documented as `Kbit/s`, the extractors/manifests were returning bitrates in SI units of kilobits/sec.
Authored by: seproDev, pukkandan
This commit is contained in:
@ -5415,6 +5415,17 @@ class FormatSorter:
|
||||
return tuple(self._calculate_field_preference(format, field) for field in self._order)
|
||||
|
||||
|
||||
def filesize_from_tbr(tbr, duration):
|
||||
"""
|
||||
@param tbr: Total bitrate in kbps (1000 bits/sec)
|
||||
@param duration: Duration in seconds
|
||||
@returns Filesize in bytes
|
||||
"""
|
||||
if tbr is None or duration is None:
|
||||
return None
|
||||
return int(duration * tbr * (1000 / 8))
|
||||
|
||||
|
||||
# XXX: Temporary
|
||||
class _YDLLogger:
|
||||
def __init__(self, ydl=None):
|
||||
|
Reference in New Issue
Block a user