]> jfr.im git - yt-dlp.git/commitdiff
[extractor/youtube] Ignore wrong fps of some formats
authorpukkandan <redacted>
Tue, 20 Jun 2023 23:41:14 +0000 (05:11 +0530)
committerpukkandan <redacted>
Wed, 21 Jun 2023 00:40:39 +0000 (06:10 +0530)
yt_dlp/extractor/youtube.py

index 4cbf0115c334cffdee30483a1409d31d182b5ff5..4daa4f50e97cbdb730142391037b887a24772c4b 100644 (file)
@@ -3849,6 +3849,7 @@ def build_fragments(f):
 
             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 @@ def build_fragments(f):
                 # 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 @@ def process_manifest_format(f, proto, client_name, itag):
                 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 = {}