Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

camera.activeFormat not getting applied

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?

like image 794
Entertain Avatar asked May 03 '26 15:05

Entertain


1 Answers

You need to set the AVCaptureSessionPreset property of AVCaptureSession to AVCaptureSessionPresetInputPriority.

like image 100
shtnkgm Avatar answered May 06 '26 08:05

shtnkgm