fps = cap.get(cv2.CV_CAP_PROP_FPS) frame_count = 0 while True: frame_count++ time = float(frame_count)/fps