Ask Your Question

Revision history [back]

Python OpenCV returns wrong FPS

0 down vote favorite

I recorded 1 minute video using my webcam and then I used that video in a python program and checked the frame rate per second using opencv, but it returned false fps. It returned 1000 fps and 60883 total frames. I used following code to find above two.

import cv2
cap = cv2.VideoCapture(filename)
frames_per_sec = cap.get(cv2.CAP_PROP_FPS)  
total_frames = int(cap.get(cv2.CAP_PROP_FRAME_COUNT))

While total number of frames correctly read by the following statement were around 1800.

 ret, frame = cap.read()

Now how do I correctly find fps of a video file recorded through webcam in python?