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.
if let frameSupportRange = captureDevice.activeFormat.videoSupportedFrameRateRanges.first {
self.session.beginConfiguration()
do {
try captureDevice.lockForConfiguration()
print("Set frame frame")
captureDevice.activeVideoMinFrameDuration = CMTime(seconds: 4, preferredTimescale: 1)
captureDevice.unlockForConfiguration()
} catch {
print("LockForConfiguration failed with error: \(error.localizedDescription)")
}
self.session.commitConfiguration()
}
How can I handle activeVideoMinFrameDuration && activeVideoMaxFrameDuration to set frame rate the record 1 frame in each 5 seconds in AVCaptureDevice. I am not sure which is possible using AVFoundation. I just need the output video file will have frames that took each 5 seconds.
How can I do it? Thanks in advance..