VideoCapture skipping frames
Hi,
I'm working on a video processing algorithm in the Java version of OpenCV. I'm using the following functions to read the video file:
VideoCapture camera = new VideoCapture(video_path);
if (!camera.isOpened())
System.out.println("Cannot open file");
else
{
while (true) {
boolean frameSuccess = camera.read(currentFrame);
framecount ++;
System.out.printf("frame: %d", framecount);
if (frameSuccess != true)
{
break;
}
and then I process the frames one by one.
The problem is that apparently, the program "skips" frames. The variable framecount doesn't correspond to the real number of frames of the video. The videos are in webm format.
Why might be this failing?
Have you tried with different file formats?Like mp4,mkv or avi?