Take the 2-minute tour ×

So I need to get web camera fps rate in OpenCV. Which function can do such thing for?

share|improve this question

3 Answers 3

up vote 6 down vote accepted
int cvGetCaptureProperty( CvCapture* capture, int property_id);

with property_id = CV_CAP_PROP_FPS

share|improve this answer
this does not work for me. in opencv/python given that cap = cv2.VideoCapture(0), print "frame rate = ", cap.get(5) gives me a fps of zero. note that fps is constant 5 for cv_cap_prop. –  user391339 Feb 19 at 21:46

It seems that for live webcam capture, you can set an arbitrary fps and read back that same fps, which has nothing to do with the real fps from webcam. Is it a bug?

For example:


and later

double rates = cvGetCaptureProperty(capture,CV_CAP_PROP_FPS);

will give you 500.

But if I timed it using web cam fps link, it's around the normal 30fps.

share|improve this answer

*OpenCV 2 solution:

C++: double VideoCapture::get(int propId)


VideoCapture myvid("video.mpg");
int fps=myvid.get(CV_CAP_PROP_FPS);
share|improve this answer

Your Answer


