the many ways of tagging video rotation

This commit is contained in:
j 2023-08-25 12:13:01 +02:00
parent 4414998759
commit 31a491570c

View file

@ -216,12 +216,16 @@ def ffprobe(filename):
]
for s in ffinfo['streams']:
tags = s.pop('tags', {})
side_data_list = s.pop('side_data_list', [])
language = None
for t in tags:
if t == 'language':
language = tags[t]
else:
info['metadata'][t] = tags[t]
for kv in side_data_list:
for k, v in kv.items():
info['metadata'][k] = v
if s.get('codec_type') in ('audio', 'video'):
stream = {}
if language and language != 'und':
@ -280,6 +284,10 @@ def ffprobe(filename):
v['width'], v['height'] = v['height'], v['width']
if k in v:
v[k] = ':'.join(reversed(v[k].split(':')))
elif 'rotation' in info.get('metadata', {}) and int(info['metadata']['rotation']) in (-90, 90):
v['width'], v['height'] = v['height'], v['width']
if k in v:
v[k] = ':'.join(reversed(v[k].split(':')))
if k not in v and 'width' in v \
or (k in v and v[k] == '0:1'):
v[k] = '%d:%d' % (v['width'], v['height'])