PDA

View Full Version : Edit: Let me present you my working 60 fps video recorder for the iPhone 5!


Menneisyys2
Jun 21, 2013, 01:10 PM
EDIT: In the meantime, I've published a FULL article on all these questions. Please check out http://forums.macrumors.com/showthread.php?t=1602171 . I only keep my now-outdated posts here for historical reasons. That is, you do NOT want to read this thread - it's outdated.





Old post:
----



Guys, as far as my original post is concerned (see below), I was wrong, fortunately. I've just blindly assumed selecting the 720p60 fps mode (the 13/14th element in the AVCaptureDeviceFormat array returned by AVCaptureDevice.formats) will also shoot at the maximal 60 fps. Nope, it needs to be manually enforced too:

videoDevice.activeVideoMaxFrameDuration = CMTimeMake(1,60);

where videoDevice is:

AVCaptureDevice *videoDevice = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];

(the activeVideoMaxFrameDuration property, along with AVCaptureDevice.formats, is iOS7+ only. activeVideoMaxFrameDuration should be preferred to the now-deprecated AVCaptureConnection.setVideoMaxFrameDuration / setVideoMinFrameDuration)

I've uploaded a program freely compilable & deployable app shooting in any configurable mode (it also displays them) to https://dl.dropboxusercontent.com/u/81986513/062013/ios7b1-60fps.zip

I didn't bother implementing a GUI to start / stop recording or touch-to-focus. Currently, it starts recording as soon as you start the app and stops it after 7 seconds. (Settable in [NSTimer scheduledTimerWithTimeInterval:7.0 target:self selector:@selector(onTimerExpired) userInfo:nil repeats:NO]; ) Feel free to use it. Also feel free to tell me if you don't know how a controller GUI should be implemented and, if and only if I have some free time, release a more complete version actually usable in everyday shooting.

Original post (outdated, only kept for historical purposes):

Guys, a quick heads-up as a lot of you have asked me (the developer of several video enhancer JB tweaks) for info on this:

- on the iPhone 5, the low-resolution 720p60 mode is available theoretically. (Low resolution, as has been explained in my past articles and forum posts - for example, the second half of http://forums.macrumors.com/showpost.php?p=16749279&postcount=7 - here, means halved vertical resolution. That is, it's 360 rows only.) It is listed as a working one and no exception is thrown when set it as the video mode to use from a third-party app. (From the stock Camera app, you can only record at 1080p30. There are no 60p modes listed for 1080p.)

- it doesn't actually record at 60 fps either. The recorded footage is 30p. However, it surely is binned as the vertical resolution, compared to the stock 30p 720p mode, is halved.

That is, don't expect miracles, at least not on current hardware. The 5S, on the other hand, may be able to record even 1080p60. Hopefully it will.

In 1-2 days, I'll come up with a complete elaboration on both this (along with an actual demo app you can deploy on your iPhone to recordin in the two 60p modes yourself) and the multitasking enhancements.

Sirious
Jun 21, 2013, 02:08 PM
That was like a hint or sneak peak at the iPhone 5S's features.

TitsLegendary
Jun 21, 2013, 02:37 PM
I use my iPhone with as a sports action camera with an Optrix case and I REALLY hope that they enable 60fps in the higher 720p resolution as it would be awesome for videoing mountain biking and motocross. Let's hope for the best.

Menneisyys2
Jun 21, 2013, 03:18 PM
I use my iPhone with as a sports action camera with an Optrix case and I REALLY hope that they enable 60fps in the higher 720p resolution as it would be awesome for videoing mountain biking and motocross. Let's hope for the best.

I'm pretty sure 720p60 for the 4S / 5 will be enabled in later betas / the final iOS7 version.

It, however, will be the same crippled, half-resolution version with 360 lines' vertical resolution only. That is, as crippled as was under the iOS5 times (on the 4S only, obviously, as the 5 initially came with iOS6). Noone should expect 1080p60, not even proper 720p60 (without further resolution halving.) That is, it's impossible to sample an inherently slow sensor faster using software optimization only.

EDIT: see the edited starting post. I was wrong: it's possible to make 720p60 work even in beta1.

Menneisyys2
Jun 21, 2013, 04:33 PM
EDIT: moved the post to the original thread starter post.

Menneisyys2
Jun 21, 2013, 07:36 PM
EDIT: In the meantime, I've published a FULL article on all these questions. Please check out http://forums.macrumors.com/showthread.php?t=1602171 . I only keep my now-outdated posts here for historical reasons.


Old post:
----
More info on the camera support in iOS7:

1, I've released another version of the camera recorder – it's at https://dl.dropboxusercontent.com/u/81986513/062013/ios7b1-60fps2.zip . Now, you aren't supposed to give it the particular AVCaptureDeviceFormat instance you want to shoot in. Instead, it just iterates over all available (and usable – this is why the last two (four), full sensor oversampler modes aren't used) modes and creates a 10-second clip in each mode. More info on this later, in Bullet 4.

2, the stock Camera client uses a somewhat narrower FoV than the camera accessed by my above app. This is why the 1080p shot is considerably wider on the framegrab from my app's output than on that of the stock Camera app.

3, the just-added dynamic zoom, in 1080p mode, does result in some severe quality degradation when fully zoomed in. This is certainly understandable as the zoom factor of the stock client can be around 3, while the theoretical maximum of lossless zoom on a 8 Mpixel 4:3 sensor in Full HD mode is 3264 / 1920 = 1.7. No matter what algorithm Apple uses, it'd be simply impossible to shoot anything over the 1.7 zoom factor with an 1:1 sensor pixel / output image picture mapping. And this ain't a Nokia Pureview 808, which, thanks to its 41 Mpixel sensor, allows for lossless zoom up to 7728/1920=4x. The 8-Mpixel sensor of the iPhone 5 is a long cry away.

Let me show you an example of this:

This is the setup:

https://dl.dropboxusercontent.com/u/81986513/062013/reschartshootingsetupT.jpg

(Original, full-size image: http://www.flickr.com/photos/33448355@N07/9104678612/sizes/o/in/photostream/ )

This is the non-zoomed-in pic:

https://dl.dropboxusercontent.com/u/81986513/062013/stock%20camera%20no%20zoom%20CROP.jpeg

(Original, full-size image: http://www.flickr.com/photos/33448355@N07/9104682856/sizes/o/in/photostream/ )

This is the fully zoomed in one:

https://dl.dropboxusercontent.com/u/81986513/062013/stock%20camera%20full%20zoom%20CROP.jpeg

(Original, full-size image: http://www.flickr.com/photos/33448355@N07/9104686464/sizes/o/in/photostream/ )

As you can see, the resolution has severely decreased.

4, OK, now, let's see how the two 720p60 modes (mode 12 and 13) behave. (The only difference between them is the color mode.)

Unfortunately, while they're 60 fps, they exhibit not only vertically, but also horizontally halved resolution. This means anything you record in this mode will have the effective resolution of 1280//2 * 720/2 pixels only.

In this regard, the currently only way of recording with more than 30 fps is certainly inferior to that of the iOS5 times, where you weren't forced to use binding. Then, “only” the vertical resolution was halved.

https://dl.dropboxusercontent.com/u/81986513/062013/ios7-mode12.jpeg

(Full-sized image: http://www.flickr.com/photos/33448355@N07/9104692444/sizes/o/in/photostream/ )

This is how it looks in non-binned 30 fps 720p mode (here, mode 10):

https://dl.dropboxusercontent.com/u/81986513/062013/ios7-mode10.jpeg

(Full-sized image: http://www.flickr.com/photos/33448355@N07/9104690690/sizes/o/in/photostream/ )

Note that in the same Flickr set you can find all the framegrabs of the other modes too.

TitsLegendary
Jun 24, 2013, 10:42 AM
As I'm not technically advanced and most of your text is jargon to me, did you say that the beta1 software will let you do true 720p60fps video? If so, I'm excited.

Menneisyys2
Jun 24, 2013, 11:13 AM
As I'm not technically advanced and most of your text is jargon to me, did you say that the beta1 software will let you do true 720p60fps video? If so, I'm excited.

It is. Will publish a full, cleaned-up, more approachable article today on this.

BTW, can you deploy apps on your iPhone? If you can, and want a recorder that has a start/stop icon, I'll code it too. (After all, my already-ready sample app needs little modification to incorporate a GUI component with the necessary callbacks.)

TitsLegendary
Jun 24, 2013, 11:58 AM
It is. Will publish a full, cleaned-up, more approachable article today on this.

BTW, can you deploy apps on your iPhone? If you can, and want a recorder that has a start/stop icon, I'll code it too. (After all, my already-ready sample app needs little modification to incorporate a GUI component with the necessary callbacks.)

I have Xcode installed on my Mac but have little experience with installing apps. I'm sure that I could do some searching on how to do it. I'd definitely be interested in giving it a shot.

Menneisyys2
Jun 24, 2013, 12:01 PM
I have Xcode installed on my Mac but have little experience with installing apps. I'm sure that I could do some searching on how to do it. I'd definitely be interested in giving it a shot.

OK, it'll be VERY soon ready. Hopefully this evening. (One with automatic starting / ending is already available for compilation and deployment - see above. Of course, it's not interactive.)

TitsLegendary
Jun 24, 2013, 12:16 PM
OK, it'll be VERY soon ready. Hopefully this evening. (One with automatic starting / ending is already available for compilation and deployment - see above. Of course, it's not interactive.)

Beta 2 was just released today. Is there any chance that this update could kill your work?

Menneisyys2
Jun 24, 2013, 12:43 PM
Beta 2 was just released today. Is there any chance that this update could kill your work?

Just testing it... my first stock Camera-related remarks are already posted: http://forums.macrumors.com/showpost.php?p=17480772&postcount=156

Just testing my own code.

Menneisyys2
Jun 24, 2013, 12:57 PM
Just testing my own code.

Works just fine.

Two additional, Camera API-related reports:

http://forums.macrumors.com/showpost.php?p=17480905&postcount=185

http://forums.macrumors.com/showpost.php?p=17480965&postcount=207

Menneisyys2
Jun 25, 2013, 06:36 PM
I have Xcode installed on my Mac but have little experience with installing apps. I'm sure that I could do some searching on how to do it. I'd definitely be interested in giving it a shot.

Done: compile and deploy this: https://dl.dropboxusercontent.com/u/81986513/062013/ios7-60fps/iOS760fpsRecorder2.zip


Full article (Section 4 discusses the app): http://forums.macrumors.com/showthread.php?t=1602171

TitsLegendary
Jun 25, 2013, 06:49 PM
Looks like a good read. I'll crack into it soon. Thank you for your time in putting it together.

Menneisyys2
Jun 25, 2013, 07:43 PM
Looks like a good read. I'll crack into it soon. Thank you for your time in putting it together.

You're welcome. Don't hesitate to post if you have problems.

Also, I'll release more advanced versions of the app in the near future.

TitsLegendary
Jun 25, 2013, 08:14 PM
Newbie question:
I have XCode but have never actually used it before. How do I compile the app?

Menneisyys2
Jun 26, 2013, 02:49 AM
Newbie question:
I have XCode but have never actually used it before. How do I compile the app?

Do you have a $99 dev license?

TitsLegendary
Jun 26, 2013, 10:26 AM
Sadly, no.

Menneisyys2
Jun 26, 2013, 10:34 AM
Sadly, no.

Any friends with one that could reg your device to the dev portal?

TitsLegendary
Jun 26, 2013, 10:35 AM
My phone is registered and I'm running 7.0b2. I've got a buddy who is a dev and I do some testing for him.

Menneisyys2
Jun 26, 2013, 10:38 AM
My phone is registered and I'm running 7.0b2. I've got a buddy who is a dev and I do some testing for him.

Great! He'll be able to compile and deploy the app. Report back if you have problems.

TitsLegendary
Jun 26, 2013, 10:44 AM
Unfortunately not. He used to use the "appmakr" system so he doesn't actually know how to make/compile apps. No worries.

Menneisyys2
Jun 26, 2013, 10:48 AM
Unfortunately not. He used to use the "appmakr" system so he doesn't actually know how to make/compile apps. No worries.

I can post a quick intro to getting the necessary certs for compiling...

TitsLegendary
Jun 26, 2013, 10:49 AM
That would be great! Any help is much appreciated.

Menneisyys2
Jun 26, 2013, 04:40 PM
That would be great! Any help is much appreciated.

1. do what's explained starting with “If you still have your iOS Dev Center page in front of you, just click the link on the upper right, or go” (search for this string to find it) and ending with “You’ll also need a distribution certificate.” at http://www.raywenderlich.com/8003/how-to-submit-your-app-to-apple-from-no-account-to-app-store-part-1 . You do NOT need to do anything else before / after these.

2. Then, do what's explained in the “Getting Started” at http://www.raywenderlich.com/8045/how-to-submit-your-app-to-apple-from-no-account-to-app-store-part-2 . This adds your device to the Devportal and installs the provisioning profile.

Let me know if you run into problems.