I'm trying to get the frame rate of a captured video but it's always returning 90000
but surely this can't be correct, is there any problem with my code that may be causing this value to be returned?
VideoCapture cap("/home/colin/downloads/20140203_133838.mp4"); // open the video file for reading
if ( !cap.isOpened() ) {
cout << "Cannot open the video file" << endl;
return 1;
}
double fps = cap.get(CV_CAP_PROP_FPS); //get the frames per seconds of the video
cout << "Frame per seconds : " << fps << endl;
namedWindow("MyVideo",CV_WINDOW_AUTOSIZE); //create a window called "MyVideo"
while(1) {
Mat frame;
bool bSuccess = cap.read(frame); // read a new frame from video
if (!bSuccess) {
cout << "Cannot read the frame from video file" << endl;
break;
}
imshow("MyVideo", frame); //show the frame in "MyVideo" window
if(waitKey(30) == 27) { //if escape key is pressed exit program
cout << "esc key is pressed by user" << endl;
break;
}
}