fix aspect ratio

This commit is contained in:
j 2022-10-22 11:50:46 +02:00
parent 8e6bea8972
commit 5919345d3d

View file

@ -275,11 +275,11 @@ def ffprobe(filename):
pass pass
# print s # print s
for v in info['video']: for v in info['video']:
k = 'display_aspect_ratio'
if 'rotate' in info.get('metadata', {}) and int(info['metadata']['rotate']) in (-180, -90, 90, 180): if 'rotate' in info.get('metadata', {}) and int(info['metadata']['rotate']) in (-180, -90, 90, 180):
v['width'], v['height'] = v['height'], v['width'] v['width'], v['height'] = v['height'], v['width']
k = 'display_aspect_ratio' if k in v:
if k in v: v[k] = ':'.join(reversed(v[k].split(':')))
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'])