Closed olegkhomenko closed 3 years ago
Hi! Thank you for the amazing product 🙌 . I have my own implementation of CameraManager and CameraController. I tried to use processFrameAndReturn method of DeepAR class instance. However, the following error always occurs:
CameraManager
CameraController
processFrameAndReturn
DeepAR
2020-12-22 20:45:24.167526+0300 APPNAME [18884:12654410] Invalid image format!
extension CameraController: CameraManagerDelegate { func cameraManager(_ cameraManager: CameraManager, didOutputSamplePixelBuffer samplePixelBuffer: CVPixelBuffer?, withPresentationTime presentationTime: CMTime) { guard let samplePixelBuffer = samplePixelBuffer else { return } guard let deepAR = deepAR else { return } if !deepAR.renderingInitialized { print("Rendering is not initialized") return } // ERROR: self.deepAR.processFrame(samplePixelBuffer, mirror: false) } }
samplePixelBuffer has the following PixelFormatType (which is a kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange) :
samplePixelBuffer
kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange
var type: OSType = CVPixelBufferGetPixelFormatType(samplePixelBuffer) print(type) >>> 875704438
and resolution
var width = 720 var height = 1280
The same error is also for:
self.deepAR.processFrameAndReturn(samplePixelBuffer, outputBuffer: deepARPixelbuffer, mirror: false)
Solution: Use kCVPixelFormatType_32BGRA for CVPixelBufferRef
kCVPixelFormatType_32BGRA
CVPixelBufferRef
Question: Is there any way how to use CVPixelBuffer with alternative PixelFormatType ?
PixelFormatType
It looks like there is no answer. I'm closing this one.
Hi! Thank you for the amazing product 🙌 . I have my own implementation of
CameraManager
andCameraController
. I tried to useprocessFrameAndReturn
method ofDeepAR
class instance. However, the following error always occurs:samplePixelBuffer
has the following PixelFormatType (which is akCVPixelFormatType_420YpCbCr8BiPlanarVideoRange
) :and resolution
The same error is also for: