title: Understanding the function CAP_PROP_FPS in cv2
body: <p>I am trying to understand the output frames I received using the code below. I am learning to use OpenCV and how it functions. My idea is to get one frame per second in a video. Here are some of the stats. The video is 25 fps and it is 18 seconds long. When I run the code, I am getting 19 frames outputted.</p>
  <pre><code>def capture(dataset,folder_name):
      for i in np.arange(len(dataset)):
          video_name=dataset.video_name[i]
          video_read_path=os.path.join(video_directory,video_name)
          cap=cv2.VideoCapture(video_read_path)
          
          write_file=os.path.join(os.path.join(Events_path,folder_name),
                                    video_name.split(&quot;.&quot;)[0])
          cap.set(cv2.CAP_PROP_FPS, 20)
          frameRate=cap.get(5)
          x=1
          count=0
          while(cap.isOpened()):
              frameId = cap.get(1) #current frame number
              ret, frame = cap.read()
              if (ret != True):
                  break
              if (frameId % math.floor(frameRate) == 0):
                  filename =&quot;frame%d.jpg&quot; % count;count+=1
  
                  cv2.imwrite(os.path.join(write_file,filename), frame)
              cap.release()
          return print(&quot;All frames written in the: &quot;+folder_name+&quot; Folder&quot;)
  
  capture(set,'Video_set')
  </code></pre>
  <p>I have used cap.get 1 frame per second and what is the use of CAP_PROP_FPS here. To my understanding, it will resize the fps from the original video fps to what I set here? If that is the case what is so different with not setting this up? Can someone please help me understand it and the use of this? Thanks.</p>