Change FPS on video capture from file
I'm reading a video file, and it's slower than the actual FPS of the file (59 FPS @1080p) even if i'm not doing any processing to the image:
using namespace cv;
using namespace std;
// Global variables
UMat frame; //current frame
int main(int argc, char** argv)
{
VideoCapture capture("myFile.MP4");
namedWindow("Frame");
capture.set(CAP_PROP_FPS, 120); //not changing anything
cout>>capture.get(CAP_PROP_FPS);
while (charCheckForEscKey != 27) {
capture >>frame;
if (frame.empty())
break;
imshow("Frame", frame);
}
}
Even if I tried to set CAP_PROP_FPS to 120 it doesn't change the fps of the file and when I get(CAP_PROP_FPS) I still get 59.9...
When I read the video the actual outcome is more or less 54 FPS (even using UMat).
Is there a way to read the file at a higher FPS rate ?
Thanks in advance
I'm running into this problem too. I want to be able to update the fps as a new fps is generated per frame This is because the camera input fps is not constant, and depending on the processing power available at the time, the writing speed must match the input rate as best as possible live time.
I don't see why
VideoWriter.set(cv2.CAP_PROP_FPS, newRate)
is not workingI read somewhere that if opencv is not compiled with ffmepg, then it uses some default video capture device (like gstreamer) which doesn't allow changing a framerate.