I am trying to make a custom video recorder iPhone app, and I need to support 240 fps. However, when I set my AVCaptureDevice
to use the format and the activeVideoMaxFrameDuration
, the whole video view just get frozen. If I do with 60fps, 120fps, everything works fine and there is no problem at all.
For the output part, I am using AVCaptureMovieFileOutput, and I also set up exposure auto focus mode, if that matters.
[self.videoConnection setPreferredVideoStabilizationMode:AVCaptureVideoStabilizationModeOff];
if ([self.videoDevice isExposureModeSupported:AVCaptureExposureModeAutoExpose] &&
[self.videoDevice lockForConfiguration:&error]) {
[self.videoDevice setExposureMode:AVCaptureExposureModeContinuousAutoExposure];
[self.videoDevice unlockForConfiguration];
}
if ([self.videoDevice isFocusModeSupported:AVCaptureFocusModeAutoFocus] &&
[self.videoDevice lockForConfiguration:&error]) {
[self.videoDevice setFocusMode:AVCaptureFocusModeContinuousAutoFocus];
[self.videoDevice unlockForConfiguration];
}
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self tapInView:nil];
});
The solution is related to the autofocus and exposure. When the device's camera is in the 120/240fps mode, we need to disable the manual focus and exposure, but still leave the auto focus and auto exposure on. This would prevent any freeze of the camera