Ryan Romanchuk
Ryan Romanchuk

Reputation: 10869

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.

Upvotes: 5

Views: 1799

Answers (1)

Rob
Rob

Reputation: 437872

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

Upvotes: 2

Related Questions