we are trying to set a specific camera frame resolution in our iOS application (written in Objective-C) which is not defined in the AVCaptureSessionPreset. With the following code we would like to set the frame dimensions to a specific width:
for ( AVCaptureDeviceFormat *format in [self.camera formats] ) {
NSLog(@"%@", format);
CMVideoDimensions dim = CMVideoFormatDescriptionGetDimensions(format.formatDescription);
if(dim.width == 3264){
if ([ self.camera lockForConfiguration:NULL] == YES) {
self.camera.activeFormat = format;
[ self.camera unlockForConfiguration];
}
}
}
However the resolution is set to 1920x1080 - which is a default value, i guess? Is there a specific order which defines when to call camera configurations?
You need to set the AVCaptureSessionPreset property of AVCaptureSession to AVCaptureSessionPresetInputPriority.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With