1

I'm trying to lock the number of FPS using the front camera

I trier to lock the min FPS to 5 and the max to 10 but nothing change, I'm always around 30.

guard let device = createDevice(position: .front) else {
 return
}    
try device.lockForConfiguration()
device.activeVideoMinFrameDuration = CMTimeMake(value: 1, timescale: 5)
device.activeVideoMaxFrameDuration = CMTimeMake(value: 1, timescale: 10)
device.unlockForConfiguration()

Any suggestions ?

Thanks in advance!

Guillaume
  • 191
  • 10
  • First, your min frame duration (0.2 seconds) is larger than your max frame duration (0.1 seconds). Second, you are likely setting your `activeVideoMinFrameDuration` and `activeVideoMaxFrameDuration` before adding it to your session. – Rob May 31 '22 at 17:45

1 Answers1

0

It is possible! In addition to your code, you need to set the movieFragmentInterval of the device Output

Timmy
  • 4,098
  • 2
  • 14
  • 34
  • Really? I would have thought it would be [`activeVideoMinFrameDuration`](https://developer.apple.com/documentation/avfoundation/avcapturedevice/1389290-activevideominframeduration) and [`activeVideoMaxFrameDuration`](https://developer.apple.com/documentation/avfoundation/avcapturedevice/1387816-activevideomaxframeduration) as shown in the `AVCaptureDevice` [documentation](https://developer.apple.com/documentation/avfoundation/avcapturedevice)… – Rob May 31 '22 at 14:03
  • You need all of them – Timmy May 31 '22 at 14:04
  • Unfortunately I'm using `AVCaptureVideoDataOutput` and `movieFragmentInterval` is only available with `AVCaptureMovieFileOutput` – Guillaume May 31 '22 at 15:09