title: CMTime: Set custom frame rate of AVCaptureDevice
body: <p>I am using AVFoundation to capture camera record. I need to record 1 frame in each 5 seconds. I don't know how to set it using CMTime.</p>
  <pre><code> if let frameSupportRange = captureDevice.activeFormat.videoSupportedFrameRateRanges.first {
              self.session.beginConfiguration()
    
              do {
                  
                  try captureDevice.lockForConfiguration()
                  
                  print(&quot;Set frame frame&quot;)
                  captureDevice.activeVideoMinFrameDuration = CMTime(seconds: 4, preferredTimescale: 1)
                  captureDevice.unlockForConfiguration()
              } catch {
                  print(&quot;LockForConfiguration failed with error: \(error.localizedDescription)&quot;)
              }
              
              self.session.commitConfiguration()
    }
  </code></pre>
  <p>How can I handle <code>activeVideoMinFrameDuration</code> &amp;&amp; <code>activeVideoMaxFrameDuration</code> to set frame rate the record 1 frame in each 5 seconds in <code>AVCaptureDevice</code>. I am not sure which is possible using AVFoundation. I just need the output video file will have frames that took each 5 seconds.</p>
  <p>How can I do it? Thanks in advance..</p>