From a004ad85c56ef24b9abdb7ced3ece5b3b58e04fc Mon Sep 17 00:00:00 2001 From: Alexey Bazhin Date: Tue, 12 Jul 2016 15:13:47 +0300 Subject: [PATCH] Support videos with rotation --- sigal/video.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sigal/video.py b/sigal/video.py index d3c823e..c8333c6 100644 --- a/sigal/video.py +++ b/sigal/video.py @@ -67,11 +67,15 @@ def video_size(source): ret, stdout, stderr = call_subprocess(['ffmpeg', '-i', source]) pattern = re.compile(r'Stream.*Video.* ([0-9]+)x([0-9]+)') match = pattern.search(stderr) + rot_pattern = re.compile(r'rotate\s*:\s*-?(90|270)') + rot_match = rot_pattern.search(stderr) if match: x, y = int(match.groups()[0]), int(match.groups()[1]) else: x = y = 0 + if rot_match: + x, y = y, x return x, y