Post

Replies

Boosts

Views

Activity

Reply to Selecting an appropriate AVCaptureDeviceFormat
Thanks for the reply and this info! I see what you mean about only having to consider properties that are important to my use case. However, I'm having trouble establishing confidence in which properties/values this might be. For example, I know that I'll be needing to use an AVCaptureVideoDataOutput with a pixel format of kCVPixelFormatType_32BGRA, because I need to pass my video frames into a model that expects data in this format. And I'm aware from this technote that an AVCaptureDeviceFormat with a different native format may result in my video being converted to BGRA when I use this output. This technote states that the conversion will work for 420v, however, I don't know how I can determine whether this conversion will be successful with all possible AVCaptureDeviceFormat pixel formats. I see that AVCaptureVideoDataOutput has a property which can be checked after setting the activeFormat, and which returns a list of pixel formats that are supported given the activeFormat. This implies to me that it is not the case that this conversion will always succeed, at least not for all possible combinations of AVCaptureDeviceFormat and AVCaptureVideoDataOutput pixel formats. However, this doesn't give me an appealing way to know which AVCaptureDeviceFormat instances are compatible with a kCVPixelFormatType_32BGRA output. Setting each format to be the active format, and then checking the updated value of availableVideoCVPixelFormatTypes, does not seem like a feasible option. On my device, there are 55 different format options, and setting each one as the active format in turn seems wasteful. I suppose I could test 1 AVCaptureDeviceFormat for each pixel format, but then I'm assuming that availableVideoCVPixelFormatTypes depends only on the pixel format of the activeFormat, as opposed to depending on any other property, and the documentation doesn't support that assumption (as far as I know). Is there a better way to determine which AVCaptureDeviceFormat options will be compatible with my desired AVCaptureVideoDataOutput?
3d