Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

If the playback rate is faster than you want, you need to put a sleep in between displaying frames.

Are you using cv::VideoCapture class? I think when you call grab() to get frames from a video file, it gives you the next frame immediately. It does not care what the framerate in the video file is. (From memory, maybe I am wrong.)

The easiest way is to call cv::VideoCapture::get(CAP_PROP_FPS) to get the frames-per-second of the file. Then just add a call to sleep for (1000 / fps) milliseconds after displaying each frame. If you need really exact playback rate for synchronisation, there are better ways, but this simple way is probably enough.