Perry Wang
Perry Wang

Reputation: 209

AVCaptureDevice activeColorspace set to apple log not working

  do {
            try currentDevice.lockForConfiguration()
            if let f = s.getFormat(from: currentDevice.formats){
                currentDevice.activeFormat = f
                currentDevice.activeColorSpace = .appleLog //doesn't work
                print(currentDevice.activeFormat)
                print("active color space \(currentDevice.activeColorSpace)")//hlg
                print("format supported apple log \(currentDevice.activeFormat.supportedColorSpaces.contains(.appleLog))")//true
                currentDevice.activeVideoMinFrameDuration = s.frameRate.getFrameDuration()
                currentDevice.activeVideoMaxFrameDuration = s.frameRate.getFrameDuration()
                currentDevice.unlockForConfiguration()
            } else {
                return false
            }
        } catch{
            print(error)
        }

Basically I firstly find the format that support applelog, then set the format and colorspace, But why the active colorspace doesn't work? Here are the print results. The activeColorSpace will always be hlg, set it to srgb and apple log does not work.

<AVCaptureDeviceFormat: 0x300453010 'vide'/'x422' 1920x1080, { 1- 60 fps}, photo dims:{1920x1080,4224x2376}, fov:74.597, 
supports vis (max strength:Ultra), max zoom:123.75 (upscales @2.00), secondary:2.00, system zoom range:1.0-6.0, AF System:2, ISO:55.0-5280.0, SS:0.000023-1.000000, system exposure bias range:-2.0-2.0, supports HDR, supports wide color, supports multicam>
true
active color space bt2020
format supported color space true

Upvotes: 0

Views: 18

Answers (0)

Related Questions