Search code examples
c++opencvvideoframe-rate

Why the speed of the video depends on the number of FPS in OpenCV


I have a code which capture screen and make a video from the screenshots using OpenCV. So if I change fps to 60 in my videoWriter object(video lasts 10 seconds or more) will play for 1 second. As I understood, higher FPS makes video faster and lower FPS makes it's slower. Could you explain for me why it works that way?


Solution

  • Imagine you record a video for 4 seconds with 2 FPS. You'll record 8 frames in total:

    enter image description here

    Now suppose you double the frame rate to 4 FPS. This tells your video player to show 4 frames every second, so those 8 frames are now shown to the viewer in 2 seconds - a speed up of the video.

    enter image description here