2

I am creating BOOMERANG effect in my app, So i am capturing images by setting 1 sec timer. Currently in 1 sec i am getting around 24 to 30 frames most of the time.

But i want to capture only 28 frames in 1 sec all the time.

Can anyone help me to achieve this please?

Thanks in advance.

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Akash
  • 89
  • 4

1 Answers1

1

On your AVCaptureDeviceInput you will have a video input.

    let frameRate = 28
    let frameDuration = CMTimeMake(1, frameRate)

    do {
        try videoDevice.unlockForConfiguration()
        videoDevice.activeVideoMaxFrameDuration = frameDuration
        videoDevice.activeVideoMinFrameDuration = frameDuration
        videoDevice.lockForConfiguration()
    } catch {
        NSLog("videoDevice lockForConfiguration returned error \(error)")
    }

You can try to set the min/max FPS through frame duration.

Sean Lintern
  • 3,103
  • 22
  • 28
  • i have done this but it will not capture exactly 28 every-time, It is capturing from 24 to 30 frames always. – Akash Sep 09 '19 at 10:09
  • 1
    hmm, I dont think you can get it exactly, could you do it at the writing level? This post may help, https://stackoverflow.com/questions/43365266/how-do-i-control-avassetwriter-to-write-at-the-correct-fps – Sean Lintern Sep 09 '19 at 11:06