How to know total number of Frame in a file with cv2 in python
With a newer OpenCV version (I use 3.1.0) it works like this: import cv2 cap = cv2.VideoCapture(“video.mp4”) length = int(cap.get(cv2.CAP_PROP_FRAME_COUNT)) print( length ) And similar for other video properties cv2.CAP_PROP_*