This is sample app for capture with .appleLog
color mode.
- Set
automaticallyConfiguresCaptureDeviceForWideColor
of AVCaptureSession tofalse
(this might be the most important part) - Search for a format in
formats
ofAVCaptureDevice
that contains.appleLog
insupportedColorSpaces
and set it asactiveFormat
- Set
activeColorSpace = .appleLog
onAVCaptureDevice
private func isAppleLogAvailable(for device: AVCaptureDevice) -> Bool {
device.formats.first(where: {
$0.supportedColorSpaces.contains(.appleLog)
}) != nil
}
private func configureAppleLogIfNeeded(for device: AVCaptureDevice) throws {
guard isAppleLogAvailable(for: device) else {
return
}
try device.lockForConfiguration()
defer {
device.unlockForConfiguration()
}
/// set up for .appleLog
if let format = device.formats.first(where: {
$0.supportedColorSpaces.contains(.appleLog)
}) {
device.activeFormat = format
device.activeColorSpace = .appleLog
}
}