Performing pip install python-opencv fixed the problem and the FPS is correctly detected.

EDIT: tested with python 3.8 and indeed it is pip install opencv-python. Cannot remember two years ago what python I was using.

EDIT November 2022: please also check Perry's answer below, if you are using a newer opencv-python version

Answer from Tasos on Stack Overflow
๐ŸŒ
LearnOpenCV
learnopencv.com โ€บ home โ€บ find frame rate (frames per second-fps) in opencv (python/c++)
Find frame rate (frames per second-fps) in OpenCV (Python/C++)
July 31, 2026 - # Let's see for ourselves. if int(major_ver) < 3 : fps = video.get(cv2.CAP_PROP_FPS) print("Frames per second using video.get(cv2.CAP_PROP_FPS): {0}".format(fps)) else : fps = video.get(cv2.CAP_PROP_FPS) print("Frames per second using video.get(cv2.CAP_PROP_FPS) : {0}".format(fps)) # Number of frames to capture num_frames = 120; print("Capturing {0} frames".format(num_frames)) # Start time start = time.perf_counter() # Grab a few frames for i in range(0, num_frames) : ret, frame = video.read() # End time end = time.perf_counter() # Time elapsed seconds = end - start print ("Time taken : {0} seconds".format(seconds)) # Calculate frames per second fps = num_frames / seconds print("Estimated frames per second : {0}".format(fps)) # Release video video.release()
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python-displaying-real-time-fps-at-which-webcam-video-file-is-processed-using-opencv
Python - Displaying real time FPS at which webcam/video file is processed using OpenCV - GeeksforGeeks
January 4, 2023 - import numpy as np import cv2 import time # creating the videocapture object # and reading from the input file # Change it to 0 if reading from webcam cap = cv2.VideoCapture('vid.mp4') # used to record the time when we processed last frame prev_frame_time = 0 # used to record the time at which we processed current frame new_frame_time = 0 # Reading the video file until finished while(cap.isOpened()): # Capture frame-by-frame ret, frame = cap.read() # if video finished or no Video Input if not ret: break # Our operations on the frame come here gray = frame # resizing the frame size according to
Discussions

.get(cv2.CAP_PROP_FPS) returns incorrect FPS
System Information OpenCV Python version: 4.8.074 OS: Microsoft Windows 10 Enterprise , version 10.0.19045 Python version: 3.11.4 Detailed description This mp4 video (attached below) has a length o... More on github.com
๐ŸŒ github.com
14
July 17, 2023
[question] Is there a way to read a Video file with pre-specified FPS with opencv-python?
It would be great to know what you are trying to do. See: https://xyproblem.info/ There are no FPS for reading, your code is reading and processing the frames. For your output video, you can use floats to specify the FPS. More on reddit.com
๐ŸŒ r/opencv
8
1
June 27, 2023
๐ŸŒ
GitHub
github.com โ€บ opencv โ€บ opencv โ€บ issues โ€บ 24000
.get(cv2.CAP_PROP_FPS) returns incorrect FPS ยท Issue #24000 ยท opencv/opencv
July 17, 2023 - video_capture = cv2.VideoCapture('C:\\Users\\AShetty12\\Downloads\\raw_videos\\MOV_2564.mp4') print(video_capture.isOpened()) # returns True print(video_capture.get(cv2.CAP_PROP_FPS)) # returns 30 total_frames = int(video_capture.get(cv2.CAP_PROP_FRAME_COUNT)) print(total_frames) # returns 21784 print(video_capture.set(cv2.CAP_PROP_POS_AVI_RATIO, 1)) # returns True _ = video_capture.read() time_msec = video_capture.get(cv2.CAP_PROP_POS_MSEC) print(time_msec/(1000*total_frames)) # returns 0.03335926980046518 video_capture.get(cv2.CAP_PROP_POS_FRAMES) # returns 21785.0
๐ŸŒ
Learning About Electronics
learningaboutelectronics.com โ€บ Articles โ€บ How-to-find-the-frames-per-second-of-a-video-Python-OpenCV.php
How to Find the Frames Per Second in a Video in Python using OpenCV
One of the features we can get is the frames per second (FPS) there are in a video. Frames are the images that make up a video. A video is a series of images shown in sequence. The frames per second tells us how many images there are per second of video. To find the frames per second of a video using OpenCV, we use the following statement, cv2.CAP_PROP_FPS
๐ŸŒ
ProgramCreek
programcreek.com โ€บ python โ€บ example โ€บ 89372 โ€บ cv2.CAP_PROP_FPS
Python Examples of cv2.CAP_PROP_FPS
def clahe(filename): os.chdir(os.path.dirname(filename)) print('Applying CLAHE, this might take awhile...') currentVideo = os.path.basename(filename) fileName, fileEnding = currentVideo.split('.',2) saveName = str('CLAHE_') + str(fileName) + str('.avi') cap = cv2.VideoCapture(currentVideo) imageWidth = int(cap.get(3)) imageHeight = int(cap.get(4)) fps = cap.get(cv2.CAP_PROP_FPS) fourcc = cv2.VideoWriter_fourcc(*'XVID') out = cv2.VideoWriter(saveName, fourcc, fps, (imageWidth, imageHeight), 0) try: while True: ret, image = cap.read() if ret == True: im = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ get-video-duration-using-opencv-python
Get video duration using OpenCV Python
May 31, 2023 - import cv2 # Create a sample video file path (replace with your video) video_path = 'sample_video.mp4' # Create video capture object cap = cv2.VideoCapture(video_path) # Get video properties fps = cap.get(cv2.CAP_PROP_FPS) total_frames = cap.get(cv2.CAP_PROP_FRAME_COUNT) # Calculate duration in seconds duration_seconds = total_frames / fps print(f"Video Duration: {duration_seconds:.2f} seconds") print(f"Total Frames: {total_frames}") print(f"FPS: {fps}") # Release the video capture object cap.release() Video Duration: 65.00 seconds Total Frames: 1625.0 FPS: 25.0 ยท
๐ŸŒ
YouTube
youtube.com โ€บ data magic (by sunny kusawa)
How to check FPS using OpenCV | Frames Per Seconds | Video FPS | Machine Learning | Data Magic - YouTube
Hello Friends, In this vide, I will quickly show, How to check Frames Per Second(FPS) of any Video or Live stream using OpenCV.GitHub: https://github.com/dat
Published: June 3, 2022
Views: 3K
Find elsewhere
๐ŸŒ
YouTube
youtube.com โ€บ zubayer hossain
Calculate FPS from live video. Python OpenCV - YouTube
In this video, I show you a simple script to calculate the frames per second of your video feed. Also, I show you how to connect with your webcam if it is a ...
Published: September 2, 2021
Views: 6K
๐ŸŒ
PyImageSearch
pyimagesearch.com โ€บ home โ€บ blog โ€บ faster video file fps with cv2.videocapture and opencv
Faster video file FPS with cv2.VideoCapture and OpenCV - PyImageSearch
April 17, 2021 - Line 15 opens a pointer to the --video file using the cv2.VideoCapture class while Line 16 starts a timer that we can use to measure FPS, or more specifically, the throughput rate of our video processing pipeline.
๐ŸŒ
YouTube
youtube.com โ€บ watch
Calculate FPS and Average FPS from live video using OpenCV python - YouTube
This is a shorter video of mine on how to calculate the fps of a video using math and opencv and later show it on the frame.
Published: January 4, 2023
๐ŸŒ
OpenCV
forum.opencv.org โ€บ python
Capture speed / framerate of cv2.VideoCapture - Python - OpenCV
October 16, 2021 - Hi all, Iโ€™ve been playing around with python, opencv, a raspberry 4 and a โ€œpi hq camโ€. The thing is, the time it takes to capture is really long. The pi cam could, in theory, do 1920x1080@30fps. Iโ€™m not aiming for that but what Iโ€™m getting is more like 2-3 fps when using videocapture.
๐ŸŒ
Top Tech Boy
toptechboy.com โ€บ calculating-frames-per-second-fps-in-opencv-and-overlay-on-frame
Calculating Frames Per Second (FPS) In OpenCV and Overlay on Frame | Technology Tutorials
January 26, 2023 - In this lesson we show how to instrument our code to calculate the Frames Per Second (FPS) we are achieving with our camera and OpenCV. We show how to display the FPS as an overlay on our video frame ยท Accessibility Statement
๐ŸŒ
Reddit
reddit.com โ€บ r/opencv โ€บ [question] is there a way to read a video file with pre-specified fps with opencv-python?
r/opencv on Reddit: [question] Is there a way to read a Video file with pre-specified FPS with opencv-python?
June 27, 2023 -

Hi,

I'm using OpenCV with Python.

Is there a way to read frames from an existing Video File with an imposed FPS for the input stream?

Does VideoWriter flow behaves well with float point FPS values? I might only need this if I can't get input stream to accept an imposed FPS.

Thanks.

I've had a very limited experience with OpenCV. So, if the Question seems limited by my know-how of OpenCV.. I'd appreciate any knowledge related to this use case

๐ŸŒ
OpenCV Q&A Forum
answers.opencv.org โ€บ question โ€บ 228564 โ€บ how-to-use-fps-module
How to use FPS module - OpenCV Q&A Forum
FPS: {:.2f}".format(fps.fps())) cv2.destroyAllWindows() ... Also the length of original video is 70 seconds. Why I see different results? ... the numbers you see all make sense. the FPS module is unfortunately not part of the opencv codebase, but assuming it "just works" -- if you wait for 25 millis in waitKey() you get 1000 / 25 = 40 FPS, minus some for image drawing, so 38.06 looks quite exact.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ faster-video-file-fps-with-cv2-videocapture-and-opencv
Faster video file FPS with cv2.VideoCapture and OpenCV - GeeksforGeeks
April 28, 2025 - cap = cv2.VideoCapture('path_of_input_video_file') ... The get() function is used to retrieve the current frames per second (FPS) of the video.
๐ŸŒ
YouTube
youtube.com โ€บ watch
How to add FPS to video and live in Opencv Python | Calculate frames per second - YouTube
How to calculate and add FPS to video in opencv python is shown#opencv
Published: October 21, 2022
๐ŸŒ
YouTube
youtube.com โ€บ watch
Mastering Computer Vision with Live FPS Count: Take Your Skills to the Next Level with OpenCV - YouTube
Inside my school and program, I teach you my system to become an AI engineer or freelancer. Life-time access, personal help by me and I will show you exactly...
Published: February 16, 2021
๐ŸŒ
Quora
quora.com โ€บ How-do-I-decrease-the-frames-per-second-in-OpenCV-python
How to decrease the frames per second in OpenCV python - Quora
How do I get the aspect ratio of a pixel using OpenCV? ... Use cv2.waitKey(delayTime) in the loop where you are capturing the frames. This delayTime is in Mili seconds. More the delayTime less will be the fps.