From fd0c35fa14e21ff0273fc46a4a0c55775ac21211 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Fri, 19 Dec 2014 11:57:38 +0000 Subject: [PATCH] fix ox.ffprobe output to match ox.avinfo --- ox/file.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ox/file.py b/ox/file.py index 081cda3..2b0bd2d 100644 --- a/ox/file.py +++ b/ox/file.py @@ -264,17 +264,20 @@ def ffprobe(filename): 'r_frame_rate': 'framerate', 'sample_rate': 'samplerate', 'pix_fmt': 'pixel_format', + 'sample_aspect_ratio': 'pixel_aspect_ratio', }.get(key, key)] = fix_value(key, s[key]) info[s['codec_type']].append(stream) else: pass #print s for v in info['video']: - if not 'display_aspect_ratio' in v and 'width' in v: - v['display_aspect_ratio'] = '%d:%d' % (v['width'], v['height']) + k = 'display_aspect_ratio' + if not k in v and 'width' in v \ + or (k in v and v[k] == '0:1'): + v[k] = '%d:%d' % (v['width'], v['height']) v['pixel_aspect_ratio'] = '1:1' info['oshash'] = oshash(filename) - info['path'] = os.path.basename(filename) + info['path'] = filename return info def makedirs(path):