shaw
shaw

Reputation: 33

iOS 11 API To Use For 4k @ 60 FPS Video Recording

I have an iPhone X running 11.3. I've been using AVFoundation, AVCaptureSession, AVAssetWriter, etc. and have gotten h.265 HEVC 4K @ 30 FPS... but, after many many hours of Googling, I've not found any documentation or examples of 4k @ 60 FPS capture. I've tried to force it via such properties as minFrameDuration, but I always get an error.

I'm not asking you to do all of my work for me (although if you feel like writing me a 4k@60 view controller, yes please!) but if you could point me in the right direction, specifically, which API supports this on the iPhone X. If I know that only the AVAssetWriter will do it, well, I can bash my head against that for a few hours :)

Upvotes: 3

Views: 1794

Answers (1)

rocketman
rocketman

Reputation: 106

It took me awhile to look for answer to recording video at 4k and 60fps. My setup is iphone X, Swift 4 and iOS 12.3

  • Make sure the capture device is set to AVCaptureDevice.default(for: .video)! Don't use the AVCaptureDevice.DiscoverySession because it won't return the 4k and 60fps settings in AVCaptureDevice.Format.
  • Loop thru the format array to find and set the desired format. The desired format for 4k and 60fps should be like this: AVCaptureDeviceFormat: 0x2820d8700 'vide'/'420v'. 3840x2160, { 3-60 fps}...

Last thing is to use the AVOutputSettingsAssistant class to configure output settings dictionaries in AVAssetWriter. The output setting should be AVOutputSettingsPresetHEVC3840x2160. The video output will be jerky if the video setting is to AVOutputSettingsPreset3840x2160.

Upvotes: 4

Related Questions