Andrea
Andrea

Reputation: 26385

Is possible to set in a AVCaptureVideoDataOutput an AVCaptureSessionPresetPhoto?

I'd like to save images from the video stream, I've set the session preset to be AVCaptureSessionPresetPhoto, but I'm getting really lower resolution on the device. I'm testing on a 3GS and this preset returns me 512x384 buffers. I've seen in the doc that the photo preset could not apply to video output.

This is not supported for video output

Is that valid also for raw data from camera buffer?
Thanks, Andrea

Upvotes: 0

Views: 1146

Answers (2)

ZijunLost
ZijunLost

Reputation: 1614

For iPhone 7 plus, which is my current case, if you set the preset to be AVCaptureSessionPresetPhoto, and use video stream as output, the resolution automatically downgraded to 1440 * 1080. But this doesn't affect the image output, which is 4032* 3024 for the frontal camera and 3088*2320 for back camera.

Note this is not bad sometimes, because this is the highest video resolution under the 3/4 aspect ratio

Upvotes: 1

Brad Larson
Brad Larson

Reputation: 170319

If you want to have a video preview of the camera input, but still capture still photos from that, you can add both an AVCaptureStillImageOutput and an AVCaptureVideoDataOutput to your capture session. The video preview will give you oddly sized smaller frames, like you describe above, but you can still retrieve full photos by triggering -captureStillImageAsynchronouslyFromConnection:completionHandler: on your AVCaptureStillImageOutput.

Be aware that this support for video previews while still being able to take photos was quietly added in iOS 4.3, so devices running older OS versions won't be able to do this.

Upvotes: 3

Related Questions