Ios 由于AVCaptureConnection上的PixelFormat类型不可用,应用程序终止
我试图在AVCaptureConnection上设置像素格式类型,但它终止于所有RGB设置,但适用于kCVPixelFormatType_32BGRAIos 由于AVCaptureConnection上的PixelFormat类型不可用,应用程序终止,ios,swift,avcapturesession,ios-camera,Ios,Swift,Avcapturesession,Ios Camera,我试图在AVCaptureConnection上设置像素格式类型,但它终止于所有RGB设置,但适用于kCVPixelFormatType_32BGRA Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[AVCaptureVideoDataOutput setVideoSettings:] Unsupported pixel format type - use -avai
Terminating app due to uncaught exception 'NSInvalidArgumentException',
reason: '*** -[AVCaptureVideoDataOutput setVideoSettings:] Unsupported
pixel format type - use -availableVideoCVPixelFormatTypes'
产生此错误的代码如下:
let settings: [AnyHashable: Any] = [kCVPixelBufferPixelFormatTypeKey as AnyHashable: kCVPixelFormatType_30RGB]
output.videoSettings = settings as! [String : Any]
明白了
我查看了该相机上可用的像素格式,发现它只支持三种不同类型的像素格式
420f、BGRA和420v