简体   繁体   中英

App Terminating Due to Unavailable PixelFormat Type on an AVCaptureConnection

I am trying to set the Pixel format type on an AVCaptureConnection but it terminates for all the RGB settings but works for the kCVPixelFormatType_32BGRA.

Terminating app due to uncaught exception 'NSInvalidArgumentException', 
reason: '*** -[AVCaptureVideoDataOutput setVideoSettings:] Unsupported 
pixel format type - use -availableVideoCVPixelFormatTypes'

The code that produces this error is this:

let settings: [AnyHashable: Any] = [kCVPixelBufferPixelFormatTypeKey as AnyHashable: kCVPixelFormatType_30RGB]
output.videoSettings = settings as! [String : Any]

Figured it out!

I looked at the available PixelFormats on that camera and found that it only supports three different types of pixel formats..

420f, BGRA, and 420v

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM