Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

sad as it is, what you want is not possible.

you'll have to save it to disk, then:

cap = cv2.VideoCapture("my.mp4")
if (cap.isOpened()):
    count = cap.get(cv2.CAP_PROP_FRAME_COUNT)
    fps = cap.get(cv2.CAP_PROP_FPS)
    duration = count/fps

but seriously, if you're on some linux, you should throw it at ffprobe instead