iOS 16.4 and above - lower photo resolution AVCamera

Hi all,

I am experiencing a problem with front camera when app is running on device with iOS with 16.4 or later. My app is using the front camera and it captured photo with maximum resolution which I am setting by using AVCaptureSession.Preset.photo.

When I am capturing photos on device with iOS 16.3 and below, maximum resolution of captured photo is 3384x4512. But when the same code is run on device with iOS 16.4 and above - maximum resolution is way more below the 3384x4512 and it varies depending of the specific device (iPhone 12, iPhone 13 Pro, iPhone 14).

Below is the code used for configuring the session:

guard let device = AVCaptureDevice.default(AVCaptureDevice.DeviceType.builtInWideAngleCamera, for: .video, position: .front) else {
        print("No front facing camera found")
        return
    }

    session.beginConfiguration()

    var frontInput: AVCaptureInput?
    do {
        frontInput = try AVCaptureDeviceInput(device: device)
    } catch let error {
        print("ERROR WITH FRONT CAMERA: \(error)")
    }
    if let inputFr = frontInput, session.canAddInput(inputFr) {
        session.addInput(inputFr)
    }

    let output = AVCaptureVideoDataOutput()
    output.alwaysDiscardsLateVideoFrames = true

    let queue = DispatchQueue(label: "cameraQueue")
    output.setSampleBufferDelegate(self, queue: queue)
    output.videoSettings = [kCVPixelBufferPixelFormatTypeKey as String: Int(kCVPixelFormatType_32BGRA)]
    session.addOutput(output)
    

    session.sessionPreset = AVCaptureSession.Preset.photo
        

    session.commitConfiguration()

Does anybody else experiencing problem with lower resolution on devices with iOS 16.4 and above?

Hello,

Could you log the activeFormat of your AVCaptureDevice pre and post iOS 16.4?

Thank you for the quick reply! Below are the logs from the device I am using

iPhone 12, iOS 16.6: <AVCaptureDeviceFormat: 0x280adf490 'vide'/'420v' 1920x1080, { 1- 30 fps}, photo dims:{1920x1080,4032x2268}, fov:73.292, supports vis (max strength:Low), max zoom:128.88 (upscales @1.91), ISO:23.0-2208.0, SS:0.000021-1.000000, supports HDR, supports multicam, supports high photo quality, supports Portrait Effect>

iPhone 12 mini, iOS 16.6: <AVCaptureDeviceFormat: 0x2825b5090 'vide'/'420v' 1920x1080, { 1- 30 fps}, photo dims:{1920x1080,4032x2268}, fov:73.292, supports vis (max strength:Low), max zoom:128.88 (upscales @1.91), ISO:23.0-2208.0, SS:0.000021-1.000000, supports HDR, supports multicam, supports high photo quality, supports Portrait Effect>

iPhone XS, iOS 16.3.1: <AVCaptureDeviceFormat: 0x28251f980 'vide'/'420v' 1920x1080, { 1- 30 fps}, photo dims:{1920x1080,3392x1908}, fov:61.161, supports vis (max strength:Low), max zoom:16.00 (upscales @1.61), ISO:18.0-1728.0, SS:0.000020-1.000000, supports HDR, supports multicam, supports high photo quality, supports Portrait Effect>

The problem with resolution is not faced on the device with iOS 16.3.1.

Ok, so clearly these are different active formats, though these are different devices so that could be a factor. I recommend that you request code-level support for this issue: https://developer.apple.com/support/technical/

iOS 16.4 and above - lower photo resolution AVCamera
 
 
Q