My iPhone 4 Video Enhancer for iOS5+ is here at last! [UPDATED: Binning implemented]

I've been constantly asked (see for example the more recent posts HERE) for the iOS5 version of my iPhone 4 Video Camera Enhancer (latest, dedicated article), which, as with the 3G S-specific enhancer released earlier today still has some neat features the, otherwise, highly recommended CameraTweak doesn't let for setting; for example, the video bitrate.

(As with all these kinds of tools, the tweak requires jailbreaking. Don't blame me for the non-jailbroken iOS' being so closed and restricted...)

Currently, the tweak is available as freely compilable and deployable sources. You will be able to deploy it on your own iPhone 4 if you or some of your friends (ask them to deploy the app on your iPhone) have a paid ($99) dev account. This also means that, as with the iPhone 3G S tweak, you'll manually need to enable global writing support for /System/Library/PrivateFrameworks/MediaToolbox.framework/N90/AVCaptureSession.plist and its enclosing directory, /System/Library/PrivateFrameworks/MediaToolbox.framework/N90.

I'll definitely create a Cydia version later so that folks without any developer friends can also use it on their iPhones.

Basically, it's the same as the old, pre-iOS5 one with the following difference: I've added a new switch on the “Easy view” (default) tab. It allows for switching the state of TemporalNoiseReductionMode between 0 and 1. If (and only if) you encounter dropped frames in the “Wide, Full sensor” mode, you will want to switch it off to avoid constant framedrops. (Something I've elaborated on a lot in the iOS4-specific articles. Interestingly, under iOS5, I haven't encounter frame dropping using the same settings. I may have been wrong though; this is why I've decided to provide the switch so that you can experiment yourself.) In all other modes, you can safely leave it switched on.

As it has changed a lot since my last tutorial, let me present a new one.

First and foremost, the main aim of my tweak is as follows:

- to considerably widen the by default, pretty narrow (about 42-43mm equiv.) field-of-view (FoV)

- to add bitrate selection support and

- resolution selection support right in the stock, built-in Camera app, without having to turn to a third-party (and always) commercial camera app. All these are available with third-party apps if and only if you shoot at VGA resolution (it's the only way to achieve wide FoV) – but, again, that means the need for purchasing and using them instead of the stock Videos app. As far as current Cydia tweaks are concerned, as has been pointed out in the introduction,  CameraTweak doesn't let for setting video bitrate – and the only way of wide-FoV recording is using the VGA resolution with it too.

After starting the app for the first time, you'll see this interface:

(as with all the shots in this article, click the thumbnail for the original-sized image!)

The topmost switch, “TemporalNoiseRed.Mo.”, allows for disabling TemporalNoiseReductionMode. You'll only want to disable it in the “Wide, Full sensor” mode, if at all. (Note that, as has already been stated, I haven't really encountered dropped frames when using the “Wide, Full sensor” mode – unlike back in the iOS4 times. Should you encounter them, make sure you give recording a try with disabled TemporalNoiseReductionMode to see whether it helps.)

The picker in the middle has two components. The first has the following items:

Narrow: this is the default 720p mode you only have access to without any tweaks or third-party apps. It has by far the best true resolution but has dismal low-light performance and, as has been pointed out, uses a narrow FoV not suited for a lot of shooting situations (e.g, landscape or architecture shooting), unlike genuinely wide camera phones like the, in video mode, 26mm(!) equiv, excellent Nokia 808 Pureview.

Wide, 1080p VGA: this is one of the most recommended modes if you want to have the widest possible FoV or the lowest possible bitrate for (comparatively) artefacting-less recording. (All non-narrow modes use the entire surface of the sensor; there is no FoV difference between them.) It, however, has slightly (but not much – see the tests below) lower true resolution than the other two, non-narrow modes.

Wide, 1080p XGA: this one records XGA-resolution (1024*768) footage. It delivers slightly, about 10% (but in no way 1024/640=1.6 times!) better resolution. Requires a higher nominal bitrate for recording.

Wide, Full Sensor: this is the, along with the VGA mode, another preferable mode. Generally, it has a little bit (but in no way considerably!) better resolution than the “Wide, 1080p XGA” mode.

An example of setting the latter mode (and also disabling TemporalNoiseReductionMode) and reducing the bitrate to half of the original; that is, around 6.5 Mbps:

After setting your preferred mode, tap the “Go” button at the bottom. You'll be shown a dialog with the fields modified:

Here, “AverageDataRate” is the value you set in the right part of the picker (“Half” corresponds to 6.5 Mbps), Sensor and Capture width / height depend on the left side of the picker and, finally, NR (shorthand for Noise Reduction) shows the switch value stored.

Always remember to kill the Camera app before (or after) changing these settings; otherwise, the new configuration won't be used by the app and it'll shoot with the old ones.

The Advanced View tab

Should you want to directly set the values in the previous confirmation dialog (and some other non-listed ones), you'll want to use the interface in the Advanced View tab:

 This lists a handful of default settings by default; these all can be modified or, should you want to add your own ones without changing the default ones, just tap a “Default” at the bottom and change the fields you want to modify:

After finishing editing, tap the Save icon in the top right.

Resolution charts

Let me show you some resolution chart framegrabs in all the four main modes (default narrow / VGA / XGA / Wide Full) to see the resolution difference between them. The resolution in ascending order. These are framegrab links with the extinction point (the value of line per vertical/horizontal width where it's no longer possible to count the originally five lines):

VGA, 475x475
XGA: 500x500
Full sensor, NR: 1: 500x500
Full sensor, NR: 0: 500x500
Narrow: 600x600

(Warning, large – around 1.5 Mbytes each! - images!)

Low-light performance

The non-narrow modes seem to have approximately the same low-light performance – all of them are much better than that of the default 720p mode. The best are the VGA and the XGA mode – they are clearly cleaner than any of the Full sensor modes, let alone the default 720p one. Disabling TemporalNoiseReductionMode doesn't really result in a much worse (noisier) image in Full sensor mode.

All in all, should you want to shoot video in dark, use either the VGA or the XGA mode.

I haven't played with the “Binned” boolean in LiveSourceOptions; feel free to report back whether binned mode works and, if it does, does it deliver dramatically better low-light performance by sacrificing vertical and/or horizontal resolution, as is the case with the iPhone 4S binned mode activated by my 4S tweaks (see my 4S article).

The following links are full PNG (so that the original quality is in no way compromised by applying another recompression) framegrabs; feel free to compare the noise levels. (Large images!)

Full sensor, TemporalNoiseReductionMode = 0
Full sensor, TemporalNoiseReductionMode = 1
Default 720p


HERE are the sources. Feel free to use the tweak – hope you'll enjoy the much wider FoV and/or the settable bitrate and/or the much better low-light performance.

NOTE: make sure you do back up /System/Library/PrivateFrameworks/MediaToolbox.framework/N90/AVCaptureSession.plist before using the app, particularly if you want to directly modify the entries in the Advanced view tab. Sometimes (back in the iOS4 times) Camera (or its video mode) stopped working after some months and/or entering some extreme values in Advanced mode, necessiating restoring the original version of AVCaptureSession.plist.

Master your iPhone in one minute a day:

Sign up to iPhone Life's Tip of the Day Newsletter and we'll send you a tip each day to save time and get the most out of your iPhone or iPad.

UPDATE (Some hours later): I couldn't sleep without thoroughly testing the above-mentioned, newly-discovered “Binned” directory entry. As I've found, it works in exactly the same way as on the iPhone 4S: when enabled, it halves the resolution in both(!) dimensions (both vertically and horizontally) but substantially improves the low-light capabilities. Binning (this way) doesn't have any effect on the frame-per-second recording speed.

Three test shots showing all this in practice (as usual, large, uncompressed, direct video framegrabs!):

720p mode resolution test, with binning enabled
720p mode low light test, with binning enabled
720p mode low light test, with binning disabled

Enabling it only works in the native, default 720p mode. Enabling it on non-720p modes (I've tested all the three: VGA, XGA and full sensor) has absolutely no effect on anything.

I've modified the “Easy view” tab to incorporate the switch – the source link now points to the new version. In the next screenshot, I've annotated the new switch. Just enable it if you want to test it:

Again, it'll only have any effect in the 720p mode and, as with the iPhone 4S, I don't really recommend it because of the far inferior resolution.

Master your iPhone in one minute a day: Sign up here to get our FREE Tip of the Day delivered right to your inbox.

<p>Werner Ruotsalainen is an iOS and Java programming lecturer who is well-versed in programming, hacking, operating systems, and programming languages. Werner tries to generate unique articles on subjects not widely discussed. Some of his articles are highly technical and are intended for other programmers and coders.</p>
<p>Werner also is interested in photography and videography. He is a frequent contributor to not only mobile and computing publications, but also photo and video forums. He loves swimming, skiing, going to the gym, and using his iPads. English is one of several languages he speaks.</p>