Browse Source

Support videos with rotation

pull/210/head
Alexey Bazhin 10 years ago
parent
commit
a004ad85c5
  1. 4
      sigal/video.py

4
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

Loading…
Cancel
Save