Skip to content

Commit

Permalink
[ffmpeg/progress] show speed rate instead
Browse files Browse the repository at this point in the history
  • Loading branch information
Lesmiscore committed Dec 15, 2021
1 parent 63bc029 commit 6e5c0cf
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion yt_dlp/postprocessor/_attachments.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ def read_ffmpeg_status(self, info_dict, proc, is_pp=False):
'processed_bytes': dl_bytes_int,
'downloaded_bytes': dl_bytes_int,
'speed': average_speed,
'speed_rate': speed,
'bitrate': bitrate_int / 8,
'eta': eta_seconds,
'total_bytes_estimate': guessed_size,
Expand Down Expand Up @@ -237,6 +238,12 @@ def format_speed(speed):
return '%10s' % '---b/s'
return '%10s' % ('%s/s' % format_bytes(speed))

@staticmethod
def format_speed_rate(rate):
if rate is None:
return '---x'
return '%.2dx' % rate

@staticmethod
def format_retries(retries):
return 'inf' if retries == float('inf') else '%.0f' % retries
Expand Down Expand Up @@ -354,7 +361,9 @@ def report_progress(self, s):
else:
s['_percent_str'] = 'Unknown %'

if s.get('speed') is not None:
if s.get('speed_rate') is not None:
s['_speed_str'] = self.format_speed_rate(s['speed_rate'])
elif s.get('speed') is not None:
s['_speed_str'] = self.format_speed(s['speed'])
else:
s['_speed_str'] = 'Unknown speed'
Expand Down

0 comments on commit 6e5c0cf

Please sign in to comment.