Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are all the resolutions of AVCaptureSessionPresetHigh for both back and front cameras?

As a preset, AVCaptureSessionPresetHigh makes a lot of sense to me. Hardware is always changing and it makes sense to have an option to tell AVCapture that "I want the highest quality you can give me given current hardware" What is driving me nuts though, is just because I want to set the session to an abstract value, doesn't mean I don't need to know the resolution it's displaying.

The only way to figure out the current resolution is to actually capture a frame and check the size of said frame. Or even worse, manually find all these resolutions, create a lookup dictionary, ask the device for it's model and then fetch the hardcoded resolution. This is a complete hack, but still better than forcing a frame capture and then asking a UIImage for its frame size.

I desperately need this information, in order to dynamically make decisions based on the aspect ratio the camera is providing. Why does apple not have an interface for such a simple query?

Does anyone know of a resource that lists all of the possible resolutions for both cameras across the entire apple hardware market? I can google my way through some, but I cannot track down a complete list.

like image 512
Ryan Romanchuk Avatar asked Nov 01 '22 11:11

Ryan Romanchuk


1 Answers

Given the AVCaptureDevice, you should be able to enumerate at formats or examine activeFormat, and then look at highResolutionStillImageDimensions of the resulting AVCaptureDeviceFormat.

like image 150
Rob Avatar answered Nov 15 '22 07:11

Rob