D.Camus
D.Camus

Reputation: 41

How to set the frame rate of iOS camera

I'm new to iOS coding, and now I want to set the frame of iOS front camera, like 18 fps or 25 fps. Here is my codes, I'm confused that no matter how I change the value of activeVideoMinFrameDuration and activeVideoMaxFrameDuration, the final video is always 30fps.

 do {
            try videoDevice!.lockForConfiguration()
            videoDevice!.activeVideoMinFrameDuration = CMTimeMake(1, 20)
            videoDevice!.activeVideoMaxFrameDuration = CMTimeMake(1, 20)
            videoDevice!.unlockForConfiguration()
        } catch let error as NSError {
                NSLog("Could not lock device for configuration: %@", error)
      }

Upvotes: 4

Views: 1368

Answers (1)

Numan Karaaslan
Numan Karaaslan

Reputation: 1645

You may also need to set

videoFileOutput.movieFragmentInterval = CMTime(seconds: 1, preferredTimescale: 25)

Upvotes: 1

Related Questions