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
.get(cv2.CAP_PROP_FPS) returns incorrect FPS
[question] Is there a way to read a Video file with pre-specified FPS with opencv-python?
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
The recent versions of opencv-python will give an error called AttributeError because cv2 doesn't have any attribute named cv.
Instead use the following
import cv2
vidcap = cv2.VideoCapture('some_video.avi')
fps = vidcap.get(cv2.CAP_PROP_FPS)
print(f"{fps} frames per second")
This will give the frames per second value
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