Dear AVFoundation Engineers,
Here is a workaround I found (apart from unconfiguring and reconfiguring AVCaptureSession). It works by removing VDO from captureSession and adding it back and resetting pixel format to 32BGRA, any other pixel format fails! Your comments awaited.
captureSession.removeOutput(videoDataOutput) //Workaround to reset deviceformat back to SDR
captureSession.sessionPreset = .high
isHDRVideoEnabled = false
//Only 32BGRA works, setting it to YUV420 8 bit full range fails!
if videoDataOutput.availableVideoPixelFormatTypes.contains(kCVPixelFormatType_32BGRA) {
print("Setting sdr pixel format \(kCVPixelFormatType_32BGRA)")
videoDataOutput.videoSettings = [kCVPixelBufferPixelFormatTypeKey as AnyHashable as! String : kCVPixelFormatType_32BGRA]
}
captureSession.addOutput(videoDataOutput) //End workaround
try currentDevice.lockForConfiguration()
currentDevice.activeColorSpace = .sRGB
currentDevice.unlockForConfiguration()
Topic:
Media Technologies
SubTopic:
Video
Tags: