Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Menneisyys2

macrumors 603
Original poster
Jun 7, 2011
5,997
1,101
This article targets
- people suffering from the narrow field-of-view of all iPhones starting with the iPhone 4
- programmers offering any kind of video recording in their apps.


You may know recent iDevices do have image stabilization (IS for short) during video recording. Unfortunately, unlike with the, in this regard (too) vastly superior Nokia Lumia 92x models, not even the latest-and-greatest iPhone 5 has optical stabilization, only electronic one. This, unfortunately, means part of the sensor is used for the stabilization itself, further narrowing the already-not-very-wide field-of-view (FoV for short), while the results still aren't very stellar. I recommend for example the iPhone 5 vs. Nokia Lumia 920 videos HERE so that you can see how immensely better optical stabilization is.

If you use the built-in, stock Camera app, IS will always be used and can't be disabled, even if you absolutely don't need it because, for example, you shoot video from a tripod. This meaning you will unnecessarily reserve the outer 10% of the pixels of the sensor for IS in both dimensions. Let me show you two direct video framegrabs showing the difference:


(IS enabled. As with most images in this article, click for the original version.)



(IS disabled. Note the, in both dimensions, 10% larger area it's showing.)

Both framegrabs are taken from video footage recorded by my own open-source video recorder client (see below) from exactly the same camera position. Consequently, they show the difference between the two modes (which, generally, differ in one parameter only) reliably.

1.1 What could be done to widen the FoV?

1.1.1 Full sensor oversampling on JB'n devices


If you're an old reader of mine, you may remember I've written full sensor oversamplers (the latest one is HERE) for all the three iPhone models (4 / 4S / 5) suffering from the narrow-FoV problem. However, they all require jailbreaking, which has become quite complicated (and, in many cases, downright impossible) with the 4S and the 5. In addition, sensor oversampling just can't deliver as high a framerate as non-oversampling method. Unfortunately, even the latest iPhone5 has a quite slow-to-oversample sensor (this isn't a Nokia PureView 808 with its almost an order of magnitude faster sensor & associated circuitry, not in the least), which means the maximal framerate you can have by oversampling is around 20 frame-per-second (fps).

This approach is usable on even iOS4 devices. After all, my first FoV-enlargening JB tweak targeted the iPhone 4 back in late 2010, that is, still in the iOS4 times.

1.1.2 Using low-resolution 4:3 video modes

If you can't jailbreak or can't put up with the relatively low framerate, using a lower resolution mode in a third-party app can give you significantly wider FoV's. For example, on the iPhone 5, the 192x144, 480x 360 and the 640x 480 modes all use the entire sensor surface, delivering as wide FoV as possible. Nevertheless, no other, even low-resolution, modes deliver such wide FoV - 352x 288 is, for example, one of the narrowest: only the 720p60 mode in iOS7 is as narrow as it. In addition, all 16:9 modes (960x 540, 1280x 720, 1920x1080) use, compared to the width of the sensor, a narrower FoV, even without using IS.

Let me show you the FoV achievable when recording into 480x 360 footage on the iPhone 5 (where this resolution is used by the pre-defined AVCaptureSession preset “AVCaptureSessionPresetMedium”):



As you can see, not only vertically (which is evident, given that it has an aspect ratio of 4:3, while Full HD videos have the relatively shorter 16:9 ratio), but also horizontally, it has a more pixels on the sides than even the non-IS Full HD framegrab, let alone the IS one. That is, don't expect the non-IS Full HD / 720p to use all the available horizontal pixels. Nevertheless, the non-IS mode is still a great step forward, towards a significantly wider FoV.

By the way, 480x 360 uses the entire sensor surface, as can also be easily proven by simply comparing it to a still shot, like the following:

stockCamStill.jpg


As you can see, the two shots (a framegrab from the 480x 360 video footage and a true still shot) are fully identical, FoV-wise.

This approach is, as with my full sensor oversampler tweak, usable on iOS4 devices and up.

1.1.3 iOS6+: disable IS

Another solution that only became available in iOS6 is using a third-party video recorder not using IS. Then, you won't suffer from the low framerate (my full sensor oversampler tweak) or the low (maximum 640x480) resolution. Unfortunately, as has already mentioned, you cannot disable IS in the stock Camera app, not even in iOS7; hence the need for a third-party app.

As the first two solutions (1.1.1, 1.1.2) have already been very widely discussed in my previous, dedicated articles, I only explain the last one: disabling IS. I scrutinize doing this with both third-party AppStore apps and, by presenting you a fully-functional camera video recorder, your own program. Let's start with the former.

2. Third-party camcorder apps

There is, currently (as of Jun/23/2013), one app, FiLMiC Pro (AppStore link; $4.99) that allows you to dynamically switch between the two modes (IS en/disabled). Should you want to do this frequently while staying in the same app, you really want to look into this app. If you, on the other hand, don't need IS at all, you should check out Section 2.2 below, which lists several (cheaper) alternatives. Note that I've also listed some other, popular AppStore camera apps so that you know whether you should check them out or not.

2.1 IS can be switched between ON and OFF

FiLMiC Pro (note: it records in 1080p24 and IS is disabled by default)

Dis/enabling IS is done in Settings (annotated by me):



2.2 IS is disabled (it's OFF all the time)

Camera Awesome by SmugMug 1.1.4

King Camera

BetterCam

2.3 IS can't be disabled (it's ON all the time)

Camcorder Pro 3 by Game Lingo (Note: it also has SD (VGA) and LP (480*360) modes)

Camera Plus (Note: by default, it uses its filtered, low-res recording mode. Full HD recording is only available after switching to the “Default” camera in Settings > Videos)

2.4 No video recording at all

Camera+

2.5 Records at 720p only (no Full HD recording available)

SloPro

Now, let's turn our attention to actually writing apps that don't use IS and, consequently, provide users a significantly wider FoV. (But, again, not as wide as my JB-only tools!)
3. Disabling Image Stabilization In your Own Code

If you're a developer, you can (comparatively) easily implement a camcorder with IS disabled. Actually, when creating any kind of an AVFoundation-based camera recorder, IS is, by default, disabled.

Also, if you already have a camcorder app in the AppStore, consider adding this switch to it to cater for customers requiring any of the both modes. It's programmatically very easy to do and remember: iOS does the actual image stabilization, you don't need to do anything to stabilize the video. Unfortunately, so far, very few developers have done this – as can clearly be seen in the above list, only FiLMiC Pro supports switching.

All 16:9 recording modes (but not a single 4:3 one!) support electronic image stabilization.

En/disabling IS is very simple:

videoConnection.enablesVideoStabilizationWhenAvailable= <BOOL>;

where

- <BOOL> is YES when enabling and NO when disabling.
- AVCaptureConnection *videoConnection is initialized by [fo connectionWithMediaType:AVMediaTypeVideo];, where
- fo is a capture output; for example, [[AVCaptureMovieFileOutput alloc] init], where
- the target filepath is set and the recording started with [self.fo startRecordingToOutputFileURL:fileURL recordingDelegate:self];.

Note:

1, should you want to know beforehand whether a given video mode supports IS or not, currently, [AVCaptureConnection isVideoStabilizationEnabled] always returns YES for non-IS-capable modes (4:3 ones). Enabling IS on non-IS-enabled AVCaptureDeviceFormat (iOS7+) / AVCaptureConnection (all iOS versions)doesn't cause any problems, though. Better use AVCaptureDevice.activeFormat.isVideoStabilizationSupported instead if you want to dynamically and easily inquire whether a given video mode supports IS.

2, changing the IS mode via AVCaptureConnection.enablesVideoStabilizationWhenAvailable= <BOOL>; results in the current video recording being stopped.

3, enabling IS can be done any time; that is, even before setting AVCaptureDevice.activeFormat (in iOS7+) or AVCaptureSession.sessionPreset (in all iOS versions).

3.1 An Example App with Full Source Code

I've created an Xcode project that demonstrates all this. It's available for download HERE and runs on all iOS6/7 iDevices. (But no earlier ones as it was with iOS6 that iOS received switchable IS.)

It has no GUI (I wanted the source code to be as terse as possible), which means I use pre-defined starting (right at program starting) and stopping (set by DisableISVideoRecViewController.REC_TIME) times. You'll, of course, want to wire record starting and stopping to GUI components. I've already separated the code in charge of doing starting / stopping in two separate methods, DisableISVideoRecViewController.startVideoRecording and stopRec, respectively. You'll want to wire these methods to your GUI callbacks.

Otherwise, the code is very startightforward. In DisableISVideoRecViewController.viewDidLoad, I create an AVCaptureSession and immediately populate it with a video camera input (if it exists), AVCaptureDevice *videoDevice. Then, I create a display preview (AVCaptureVideoPreviewLayer) and add it to the current view as a subview. In Step 4, I create a AVCaptureMovieFileOutput target. Here, I don't start recording yet as I dinamically check for the existence of previous filenames and continue with the filename postfix index not used before.

The latter is done in the already-mentioned “startVideoRecording” method. Before finding the first non-existing, indexed filename, I also invoke the “enableIS” custom method, which enables IS. (Again, when using AVFoundation for video recording from third-party apps, IS isn't enabled by default.) Currently, it's commented out. You'll want to comment it back so that you can see the difference in FoV between the two (IS-enabled and disabled) modes.

At the end of startVideoRecording, I set up a timer to stop recording after REC_TIME seconds. Again, you'll want to connect the “stopRec” method to a GUI component.
 

shaunotter

macrumors newbie
Mar 8, 2008
1
0
As a news videographer, I want MORE IS, not off or less!

Video image stabilization on the iPhone 5 really stinks compared to good point and shoots and HDSLRs with good IS.

What I really want is an iPhone Camera with optical IS and 3x to 5x+ zoom, but I don't see that happening for years, if ever.

In the meantime, better digital video and still stabilization would be great -- and I can live with the decreased FOV and extra processor/battery use ... What I CAN'T live with is shaky handheld video that looks annoyingly amateurish distracts from the content.
I'm shooting video for web/FB and Tout pro content for a newspaper and we can't take the time to use tripods or monopods in many breaking news scenes (just like your average iPhone shooter doesn't use those cumbersome items when filming their kids or their cats).

Is iOS 7 supposed to have superior image stabiliaiton? Does any app give MORE or better stabilization?

We're going to be using Phocus cases (good grip and extra weight) with screw-on wide, tele, and macro lens converters (and even Canon EOS 35mm lenses!) but we need the iPhone to help us out at least more than it does now.
 

lordofthereef

macrumors G5
Nov 29, 2011
13,161
3,720
Boston, MA
Image stabilization is for moving shots. While you may get less on screen, you get higher quality. Give and take, right? I'd rather see less on the screen than a giant mess of blurred nonsense during an action shot. Even simply walking can make the camera ridiculously jarring. Opinions will differ, of course.
 

FSMBP

macrumors 68030
Jan 22, 2009
2,715
2,729
Image stabilization is for moving shots. While you may get less on screen, you get higher quality. Give and take, right? I'd rather see less on the screen than a giant mess of blurred nonsense during an action shot. Even simply walking can make the camera ridiculously jarring. Opinions will differ, of course.

That may be true in theory but Image stabilization can make your shots look worse. It can distort the video:

http://vimeo.com/31142215

I've experienced this first hand too. Its algorithm isn't the best. It may work for 70% of shots but it's nice to have it off just to avoid distortion.
 

charlituna

macrumors G3
Jun 11, 2008
9,636
816
Los Angeles, CA
Video image stabilization on the iPhone 5 really stinks compared to good point and shoots and HDSLRs with good IS.

It's a cell phone not a pro camera so I'm not shocked that it sucks. But I agree that better can't hurt. Regardless of the tools.

As a viewer of video the whole shaky cam thing to me sucks. It's a nice trick when used a little but it is way way over done. It is worse than 3d to me. Same with the sped up action, snap cuts etc.

Smooth it out, slow it down. Stop making folks want to barf.

What I would rather see in cameras is either over framing so the cameras are taking in more than what you see to compensate for the bits that will be cut out by IS or letting you see in your viewfinder what is the actual frame so you can line it up better. I also wouldn't mind something that reminds folks if they are shooting in portrait mode there will be big ass black bars on a widescreen tv.
 

asthamapheo

macrumors 6502
Jun 26, 2013
285
0
:eek: had been thinking it was good for quality, i hope they improve it in the next iphone, the android manufacturers are putting great cameras in their phones, i hope apple also focuses on the iphone's camera.
 

lordofthereef

macrumors G5
Nov 29, 2011
13,161
3,720
Boston, MA
That may be true in theory but Image stabilization can make your shots look worse. It can distort the video:

http://vimeo.com/31142215

I've experienced this first hand too. Its algorithm isn't the best. It may work for 70% of shots but it's nice to have it off just to avoid distortion.

For sure. The image stabilization I used on the Lumia 920 was properly executed though. If we get something like that I will be happy. Great camera on that phone.
 

LostTitan

macrumors newbie
Jun 30, 2007
26
0
Video Pause app

Just want to add that I have a very simple app that can switch stabilization ON and OFF. It's called Video Pause (iTunes link)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.