I\'m trying to capture multiple photos on highest resolution(AVCaptureSessionPresetPhoto) on iPhone 5s. I tried using the following code:
dispatch_semaphore_
captureStillImageAsynchronouslyFromConnection:completionHandler:
isn't, I believe, what Apple is using for its burst mode.
Instead, Apple is* grabbing video frames at full resolution (which is supported by the 5s). Here's how:
The AVCaptureDevice has its activeFormat
set to full sensor resolution, then you grab and process 10 frames per second from AVCaptureVideoDataOutputSampleBufferDelegate
's captureOutput:didOutputSampleBuffer:fromConnection:
, firing off a shutter sound for each frame grab.
You'll need to have a fall-back (either lower-resolution images or a slower burst mode) for devices that don't support video at the full sensor-size resolution—and/or if you want to support anything older than iOS 7.x.
Note that you can't have multiple concurrent usage of captureStillImageAsynchronouslyFromConnection:completionHandler:
without some extremely unexpected results. This is why you should call each iteration from the previous one's completionHandler
(which, in essence, is what your semaphore is doing). Also, you may wish to switch from PNG as your file format for burst shots—it saves very slowly and requires a lot of system resource—stacking up 15 or 20 PNGs could cause you some serious grief!
*It's probably doing this, because it may, of course, be using a private API to achieve the same end result.