I have a bunch of videos from an iPhone and am trying to get their width and height programmatically using opencv. Here is my code:
import os, glob
import cv2
ff = glob.glob("*.m??") + glob.glob("*.M??")
for f in ff:
cap = cv2.VideoCapture(f)
w, h = (int(cap.get(i)) for i in (3, 4))
cap.release()
print("%s: %dx%d" % (f, w, h))
The problem is, the result is always the same: 1920x1080, -- regardless of whether the movies is horizontal (1920*1080) or vertical (I would expect 1080*1920).
Any ideas how to fix this? Maybe there is a flag somewhere that tells if it's Horiz or Vert? I didn't find anything here at opencv docs... Thank you!