I can only get the number of frames CAP_PROP_FRAME_COUNT using CV2.
CAP_PROP_FRAME_COUNT
However, I cannot find the parameter to get the duration of the video using cv2.
Capture the video and output the duration is seconds
vidcapture = cv2.VideoCapture('myvideo.mp4') fps = vidcapture.get(cv2.CAP_PROP_FPS) totalNoFrames = vidcapture.get(cv2.CAP_PROP_FRAME_COUNT); durationInSeconds = float(totalNoFrames) / float(fps) print("durationInSeconds: ",durationInSeconds,"s")