mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-25 20:55:52 +01:00
[ie/bilibili] Extract Dolby audio formats (#8142)
Closes #4050 Authored by: ClosedPort22
This commit is contained in:
parent
5fccabac27
commit
b84fda7388
@ -49,14 +49,14 @@ def extract_formats(self, play_info):
|
|||||||
for r in traverse_obj(play_info, ('support_formats', lambda _, v: v['quality']))
|
for r in traverse_obj(play_info, ('support_formats', lambda _, v: v['quality']))
|
||||||
}
|
}
|
||||||
|
|
||||||
audios = traverse_obj(play_info, ('dash', 'audio', ...))
|
audios = traverse_obj(play_info, ('dash', (None, 'dolby'), 'audio', ..., {dict}))
|
||||||
flac_audio = traverse_obj(play_info, ('dash', 'flac', 'audio'))
|
flac_audio = traverse_obj(play_info, ('dash', 'flac', 'audio'))
|
||||||
if flac_audio:
|
if flac_audio:
|
||||||
audios.append(flac_audio)
|
audios.append(flac_audio)
|
||||||
formats = [{
|
formats = [{
|
||||||
'url': traverse_obj(audio, 'baseUrl', 'base_url', 'url'),
|
'url': traverse_obj(audio, 'baseUrl', 'base_url', 'url'),
|
||||||
'ext': mimetype2ext(traverse_obj(audio, 'mimeType', 'mime_type')),
|
'ext': mimetype2ext(traverse_obj(audio, 'mimeType', 'mime_type')),
|
||||||
'acodec': audio.get('codecs'),
|
'acodec': traverse_obj(audio, ('codecs', {str.lower})),
|
||||||
'vcodec': 'none',
|
'vcodec': 'none',
|
||||||
'tbr': float_or_none(audio.get('bandwidth'), scale=1000),
|
'tbr': float_or_none(audio.get('bandwidth'), scale=1000),
|
||||||
'filesize': int_or_none(audio.get('size')),
|
'filesize': int_or_none(audio.get('size')),
|
||||||
@ -71,6 +71,7 @@ def extract_formats(self, play_info):
|
|||||||
'height': int_or_none(video.get('height')),
|
'height': int_or_none(video.get('height')),
|
||||||
'vcodec': video.get('codecs'),
|
'vcodec': video.get('codecs'),
|
||||||
'acodec': 'none' if audios else None,
|
'acodec': 'none' if audios else None,
|
||||||
|
'dynamic_range': {126: 'DV', 125: 'HDR10'}.get(int_or_none(video.get('id'))),
|
||||||
'tbr': float_or_none(video.get('bandwidth'), scale=1000),
|
'tbr': float_or_none(video.get('bandwidth'), scale=1000),
|
||||||
'filesize': int_or_none(video.get('size')),
|
'filesize': int_or_none(video.get('size')),
|
||||||
'quality': int_or_none(video.get('id')),
|
'quality': int_or_none(video.get('id')),
|
||||||
|
Loading…
Reference in New Issue
Block a user