1
0
Fork 0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-03-09 12:50:23 -05:00

[core] support MPD fraction frame rate

This commit is contained in:
aarubui 2025-02-27 08:34:01 +11:00
parent 9c3e8b1696
commit 60b80878a6
2 changed files with 5 additions and 2 deletions

View file

@ -3918,7 +3918,7 @@ def simplified_codec(f, field):
self._format_out(format_field(f, 'format_id'), self.Styles.ID),
format_field(f, 'ext'),
format_field(f, func=self.format_resolution, ignore=('audio only', 'images')),
format_field(f, 'fps', '\t%d', func=round),
format_field(f, 'fps', '\t%s'),
format_field(f, 'dynamic_range', '%s', ignore=(None, 'SDR')).replace('HDR', ''),
format_field(f, 'audio_channels', '\t%s'),
delim, (

View file

@ -2840,12 +2840,15 @@ def extract_Initialization(source):
url_el = representation.find(_add_ns('BaseURL'))
filesize = int_or_none(url_el.attrib.get('{http://youtube.com/yt/2012/10/10}contentLength') if url_el is not None else None)
bandwidth = int_or_none(representation_attrib.get('bandwidth'))
fps = representation_attrib.get('frameRate')
if representation_id is not None:
format_id = representation_id
else:
format_id = content_type
if mpd_id:
format_id = mpd_id + '-' + format_id
if fps and (m := re.match(r'^(\d+)/(\d+)$', fps)):
fps = int(m.group(1)) / int(m.group(2))
if content_type in ('video', 'audio'):
f = {
'format_id': format_id,
@ -2855,7 +2858,7 @@ def extract_Initialization(source):
'height': int_or_none(representation_attrib.get('height')),
'tbr': float_or_none(bandwidth, 1000),
'asr': int_or_none(representation_attrib.get('audioSamplingRate')),
'fps': int_or_none(representation_attrib.get('frameRate')),
'fps': float_or_none(fps),
'language': lang if lang not in ('mul', 'und', 'zxx', 'mis') else None,
'format_note': f'DASH {content_type}',
'filesize': filesize,