I am trying to use AVCaptureDepthDataOutput but am running into some errors.
I first choose a device that supports depth (7p).
AVCaptureDevice.default(.builtInDualCamera, for: AVMediaType.depthData, position: .back)Then I set compatible formats:
Set format <AVCaptureDeviceFormat: 0x1c4008fc0 'vide'/'420v' 640x 480, { 3- 30 fps}, HRSI:4032x3024, fov:58.975, max zoom:189.00 (upscales @6.30), AF System:2, ISO:22.0-1408.0, SS:0.000005-0.333333, supports depth>
Set depth format <AVCaptureDeviceFormat: 0x1c0006e00 'dpth'/'fdis' 320x 240, { 3- 24 fps}, HRSI: 768x 576, fov:58.975>Finally, I try adding the AVCaptureDepthDataOutput:
depthOutput.setDelegate(self, callbackQueue: self.sessionQueue)
if session.canAddOutput(depthOutput) {
print("Adding depth output: \(depthOutput)")
session.addOutput(depthOutput)
}Unfortunately, I immediately get these errors in the console:
FigDerivedFormatDescriptionGetDerivedStorage signalled err=-12710 (kFigFormatDescriptionError_InvalidParameter) (!desc)
CMVideoFormatDescriptionGetDimensions signalled err=-12710 (kFigFormatDescriptionError_InvalidParameter) (NULL desc)
FigDerivedFormatDescriptionGetDerivedStorage signalled err=-12710 (kFigFormatDescriptionError_InvalidParameter) (!desc)
CMVideoFormatDescriptionGetDimensions signalled err=-12710 (kFigFormatDescriptionError_InvalidParameter) (NULL desc)The session then proceeds to fail:
Capture session runtime error: AVError(_nsError: Error Domain=AVFoundationErrorDomain Code=-11819 "Cannot Complete Action" UserInfo={NSLocalizedDescription=Cannot Complete Action, NSLocalizedRecoverySuggestion=Try again later.})Has anyone gotten AVCaptureDepthDataOutput to work?