1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-10-04 19:54:30 -04:00

Add HDR information to formats

This commit is contained in:
pukkandan
2021-10-18 18:34:21 +05:30
parent 17bddf3e95
commit 176f1866cb
6 changed files with 47 additions and 6 deletions

View File

@@ -4618,12 +4618,21 @@ def parse_codecs(codecs_str):
return {}
split_codecs = list(filter(None, map(
str.strip, codecs_str.strip().strip(',').split(','))))
vcodec, acodec = None, None
vcodec, acodec, hdr = None, None, None
for full_codec in split_codecs:
codec = full_codec.split('.')[0]
if codec in ('avc1', 'avc2', 'avc3', 'avc4', 'vp9', 'vp8', 'hev1', 'hev2', 'h263', 'h264', 'mp4v', 'hvc1', 'av01', 'theora', 'dvh1', 'dvhe'):
if not vcodec:
vcodec = full_codec
if codec in ('dvh1', 'dvhe'):
hdr = 'DV'
elif codec == 'vp9' and vcodec.startswith('vp9.2'):
hdr = 'HDR10'
elif codec == 'av01':
parts = full_codec.split('.')
if len(parts) > 3 and parts[3] == '10':
hdr = 'HDR10'
vcodec = '.'.join(parts[:4])
elif codec in ('mp4a', 'opus', 'vorbis', 'mp3', 'aac', 'ac-3', 'ec-3', 'eac3', 'dtsc', 'dtse', 'dtsh', 'dtsl'):
if not acodec:
acodec = full_codec
@@ -4639,6 +4648,7 @@ def parse_codecs(codecs_str):
return {
'vcodec': vcodec or 'none',
'acodec': acodec or 'none',
'dynamic_range': hdr,
}
return {}