VideoCapture skipping frames

asked 2016-07-04 05:05:53 -0500

aldev gravatar image


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");


        while (true) {
            boolean frameSuccess =;
            framecount ++;
            System.out.printf("frame: %d", framecount);
            if (frameSuccess != true)

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?

edit retag flag offensive close merge delete


Have you tried with different file formats?Like mp4,mkv or avi?

can gravatar imagecan ( 2016-07-04 05:55:08 -0500 )edit