Capture 60fps in iPhone app
I am working on a project where we will be using iPhones as cameras for capturing a scene. When recording we need to record @60fps and not 30fps (as natively supported). So I am working on an app to do this as the iPhone 4S hardware supports 720p@60fps (if you jailbreak your phone you can achieve this).
Does anybody know how to do this in Objective-C on iOS? Today I saw an app out there (slopro) that can record 60fps on non jailbroken phones. Any advice or tips is much appreciated.
- AVcapture session slow launch after session restart
- AVCaptureSession - Stop Running - take a long long time
- AVCaptureSession stopRunning method creates terrible hang
- Preventing AVCaptureVideoPreviewLayer from rotating, but allow UI layer to rotate with orientation
- Cropping AVCaptureVideoPreviewLayer output to a square
- Swift AVCaptureSession Close Open Button Error : Multiple audio/video AVCaptureInputs are not currently supported
2 Solutions Collect From Internet About “Capture 60fps in iPhone app”
After some tinkering, this answer has split into two parts:
How to capture frames at 60fps
The AVCaptureSessionPreset1280x720 on the iPhone4s/5.1, with frame durations set to:
connection.videoMinFrameDuration = CMTimeMake(1, 60);* connection.videoMaxFrameDuration = CMTimeMake(1, 60);
gives you a stable, super smooth capture.
How to capture frames into a file @60fps
Capturing frames is all very well, but presumably you want to keep them.
As Brad noted in the comments, writing those frames to a file is another story.
Sadly, no matter what configurations I tried, encoding the frames via an
AVAssetWriter caused the capture rate to drop to the observed ~37fps and no amount of fiddling with
alwaysDiscardsLateVideoFrames could change it. However, in this approach every single frame is copied from AVFoundation to your app, and then back again, which is quite pointless and very wearing for the bus. Luckily,
AVFoundation has a class that removes this round trip:
If you let
AVFoundation do the writing for you then the iPhone4S can capture and encode frames + audio to a .mov file at 60fps* without breaking a sweat (~25% CPU).
While 60fps video capture is great feature, I can’t help but feel a little disappointed as
AVCaptureMovieFileOutput rules out a lot of fun things (e.g. realtime effects with GL shaders, recording start/stop without frame loss).
*59 if you’re still running iOS 5.0.1
I haven’t try this before, maybe these are related:
- Set maximum frame rate with AVFoundation in iOS 5
videoMaxFrameDurationin AVCaptureConnection Class Reference
- CMTime Reference (needed for setting
- Correct crop of CIGaussianBlur
- Using custom font for entire iOS app swift
- In-app Restore works fine on Debug but crashes on AdHoc in iPhone sdk
- “initialize” class method for classes in Swift?
- Select an appropriate iOS version from simulators list in XCode 6.0.1
- Clipping borders to subviews
- How to pass a class type as a function parameter
- Custom Font in IOS Not Reflected On Device
- Custom view which looks like UIAlertView
- Nested information in Firebase
- IOS: set a default language in xcode for my app
- AES256 Encryption/Decryption Error+ IOS SDK 7
- How to create and send the json data to server using swift language
- OSX: changing path of .framework
- How to jump to system setting's location service on iOS10?