Python OpenCV returns wrong FPS

asked 2018-12-03 23:05:04 -0500

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 =

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

edit retag flag offensive close merge delete


I tested it. Returned 30 fps. Are you using linux using raspberry pi?

supra56 gravatar imagesupra56 ( 2018-12-04 08:15:39 -0500 )edit

Here is the webm file that I'm using: For this file it returns 1000 fps.

Muhammad Hassan gravatar imageMuhammad Hassan ( 2018-12-04 23:56:39 -0500 )edit