From 97afb093d4cbe5df889145afa5f9ede4535e93e4 Mon Sep 17 00:00:00 2001 From: pukkandan Date: Wed, 21 Jun 2023 05:11:14 +0530 Subject: [PATCH] [extractor/youtube] Ignore wrong fps of some formats --- yt_dlp/extractor/youtube.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/yt_dlp/extractor/youtube.py b/yt_dlp/extractor/youtube.py index 4cbf0115c..4daa4f50e 100644 --- a/yt_dlp/extractor/youtube.py +++ b/yt_dlp/extractor/youtube.py @@ -3849,6 +3849,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor): client_name = fmt.get(STREAMING_DATA_CLIENT_NAME) name = fmt.get('qualityLabel') or quality.replace('audio_quality_', '') or '' + fps = int_or_none(fmt.get('fps')) or 0 dct = { 'asr': int_or_none(fmt.get('audioSampleRate')), 'filesize': int_or_none(fmt.get('contentLength')), @@ -3865,7 +3866,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor): # Format 22 is likely to be damaged. See https://github.com/yt-dlp/yt-dlp/issues/3372 'source_preference': ((-10 if throttled else -5 if itag == '22' else -1) + (100 if 'Premium' in name else 0)), - 'fps': int_or_none(fmt.get('fps')) or None, + 'fps': fps if fps > 1 else None, # For some formats, fps is wrongly returned as 1 'audio_channels': fmt.get('audioChannels'), 'height': height, 'quality': q(quality) - bool(fmt.get('isDrc')) / 2, @@ -3936,6 +3937,8 @@ class YoutubeIE(YoutubeBaseInfoExtractor): f['quality'] = q(res_qualities[min(res_qualities, key=lambda x: abs(x - f['height']))]) if self.get_param('verbose'): f['format_note'] = join_nonempty(f.get('format_note'), client_name, delim=', ') + if f.get('fps') and f['fps'] <= 1: + del f['fps'] return True subtitles = {}