Hi,
I've set up a captureSession and am now trying to set the framerate to 60. I am using an iPhone 12 Pro Max.
I am trying to set the frame rate with: videoDevice?.activeVideoMinFrameDuration = CMTimeMake(value: 1, timescale: 60), but printing my .activeFormat tells me my iPhone only supports 30 fps.
What am I doing wrong?
Thanks
I've set up a captureSession and am now trying to set the framerate to 60. I am using an iPhone 12 Pro Max.
I am trying to set the frame rate with: videoDevice?.activeVideoMinFrameDuration = CMTimeMake(value: 1, timescale: 60), but printing my .activeFormat tells me my iPhone only supports 30 fps.
What am I doing wrong?
Thanks
Update and Answer: The activeFormat is just the currently active format. Printing .formats can provide you all possible formats. If you want to set your frames per second to 60, do so by:
Thanks to Rhythmic Fistman for helping me on this question. https://stackoverflow.com/users/22147/rhythmic-fistman
Code Block swift // Instantiate the video device: wide angle camera, back position let videoDevice = AVCaptureDevice.default(.builtInWideAngleCamera, for: .video, position: .back) // Set the frame rate to 60, as expected by the machine learning model try! videoDevice?.lockForConfiguration() videoDevice?.activeFormat = (videoDevice?.formats[30])! videoDevice?.activeVideoMinFrameDuration = CMTimeMake(value: 1, timescale: 60) videoDevice?.activeVideoMaxFrameDuration = CMTimeMake(value: 1, timescale: 60) videoDevice?.unlockForConfiguration() // print(videoDevice?.activeFormat)
Thanks to Rhythmic Fistman for helping me on this question. https://stackoverflow.com/users/22147/rhythmic-fistman