the many ways of tagging video rotation
This commit is contained in:
parent
4414998759
commit
31a491570c
1 changed files with 8 additions and 0 deletions
|
@ -216,12 +216,16 @@ def ffprobe(filename):
|
||||||
]
|
]
|
||||||
for s in ffinfo['streams']:
|
for s in ffinfo['streams']:
|
||||||
tags = s.pop('tags', {})
|
tags = s.pop('tags', {})
|
||||||
|
side_data_list = s.pop('side_data_list', [])
|
||||||
language = None
|
language = None
|
||||||
for t in tags:
|
for t in tags:
|
||||||
if t == 'language':
|
if t == 'language':
|
||||||
language = tags[t]
|
language = tags[t]
|
||||||
else:
|
else:
|
||||||
info['metadata'][t] = tags[t]
|
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'):
|
if s.get('codec_type') in ('audio', 'video'):
|
||||||
stream = {}
|
stream = {}
|
||||||
if language and language != 'und':
|
if language and language != 'und':
|
||||||
|
@ -280,6 +284,10 @@ def ffprobe(filename):
|
||||||
v['width'], v['height'] = v['height'], v['width']
|
v['width'], v['height'] = v['height'], v['width']
|
||||||
if k in v:
|
if k in v:
|
||||||
v[k] = ':'.join(reversed(v[k].split(':')))
|
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 \
|
if k not in v and 'width' in v \
|
||||||
or (k in v and v[k] == '0:1'):
|
or (k in v and v[k] == '0:1'):
|
||||||
v[k] = '%d:%d' % (v['width'], v['height'])
|
v[k] = '%d:%d' % (v['width'], v['height'])
|
||||||
|
|
Loading…
Reference in a new issue