Merge pull request #210 from bazuchan/master

Support videos with rotation
This commit is contained in:
Simon Conseil
2016-07-13 00:03:30 +02:00
committed by GitHub

View File

@@ -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