Enhancing the video recording quality of the iPhone 3GS - Part I

The video recorder of the iPhone 3G S can heavily be enhanced. As opposed to the iPhone 4, where the main enhancements are “only” making the field-of-view much wider, the data rate selectable and, with pixel binning, the low-light performance much better (by sacrificing some resolution and speed), the enhancements of the 3G S camera, in addition to the better low-light performance through pixel-binning, are waaaay superior: you can greatly increase the resolution, almost to the level of the iPhone 4 or traditional cameras.

So far, no one has released any tool that would have made it easy to quickly switch between the different configurations. Sure, there is a Winterboard theme called „HD Video Enabler for 3GS” but, it seems, it doesn't work (see the comments for example HERE, HERE and HERE). It didn't work on my device either. The widely known solutions (e.g., THIS) don't work on 4.3+ either and, of course, they don't offer any kind of quick switching (actually, you even need a desktop computer to even switch! Compare this to the easiness of my switching solution, which only needs the phone itself). Therefore, I took the liberty to make my previous, iPhone 4-specific application support the 3G S too.

First and foremost, there are two main “enhanced” modes, in addition to the factory VGA (640*480; 480p for short) video recording mode, you'll want to use, both with its own advantages and disadvantages: a mode not utilizing all pixels but still delivering good resolution (the 1080p mode, named after the Sensor setting of 1920*1080) and around 29-30 fps speed and the full pixel-binned mode, which is pretty similar to the “enhanced” mode of the iPhone4 in that its frame rate is about half of the original mode but it offers way better low-light performance. In addition, as opposed to the iPhone4, the latter mode sports way better true resolution (while that of the 1080p mode isn't that bad either, at least compared to the absolutely rubbish, original 480p mode).

Full sensor caveats: „clicking” sound and freezing video

Unfortunately, there's a big problem with the latter (full sensor) mode greatly reducing its usability: every once a while (between one and two minutes in general; there may be more occurrences) the video (but not the audio!) recording stops for around a second and the aperture gets set again, meaning a discernible and pretty ugly brightness peak. There is a clear click in the audio stream when video recording resumes. If that's not a problem and you must have absolutely the best video quality (even with these problems), go for the full sensor mode; otherwise, stick with the 1080p mode, which offers about 30 fps and no problems like this – on the expense of reduced resolution and low-light performance.

The click can be seen and heard in for example the video below, at around 0:10:

(direct YT link; original MOV file)

My utility

As with my iPhone4 hack tool, you'll need to jailbreak your phone and add the Cydia repo http://www.winmobiletech.com/cy (or http://winmobiletech.com/cy ). Inside it, download the 3GS-specific hacker tool:

Note that, as usual, I provide you with the full(!) source. It's HERE. You can freely compile it and deploy on your phone, should you want to avoid using Cydia.

The tool works exactly than the iPhone4 version. It has two main tabs, of which most users will only want to use the first, Simple view. It has two pickers:

- the left one sets the preferred video mode: 480p, 1080p or full sensor. In general, you'll want to switch between the two latter, depending on your needs as the default, factory 480p mode offers absolutely no advantage over any of the two other modes – as opposed to the case of the iPhone4)

- the right one sets the data rate. The higher you go on the list, the faster the data rate.

After making your selection, just tap Go to write the changes.

I'll release another, updated version some time with rewritten help (now, it refers to the iPhone4) and added average data rates. The 3G S computes the effective data rate than the iPhone 4; that is, the same data rate means about 10 times higher effective data rate on the iPhone4 than on the 3G S. In the meantime, if you find the highest data rate is still too low for your needs, use Advanced view to enter your own ones. The Advanced view is used exactly like on the iPhone4 (it remembers settings over restarts; don't forget to tap “Save” to overwrite the system plist!) and is entirely filled with the default 480p values:

Writing to the system files

The app uses system calls to make files writable and assumes the root password is still “alpine”. Should this fail (this was the case under 4.2.1; it worked under 4.3.3 on the iPhone4), you will need to change the write permission of some files to “world” using iFile. Even the trial version will suffice of the latter.

Get iFile and navigate to either /System/Library/Frameworks/AVFoundation.framework/ (if you have iOS 4.3.x) or /System/Library/PrivateFrameworks/Celestial.framework/ (with pre-iOS 4.3). Scroll down to “N88” but don't step into it (note that, on the iPhone4, you do exactly the same, except that you need to scroll down to N90 instead of N88 and, if you prefer allowing writing access to files one-by-one [you don't switch on “Apply hierarchically”], don't need to allow writing to CameraRollValidator.plist and MediaValidator.plist):

Tap the arrow on the right (see red oval in the screenshot above) and switch on “Apply hierarchically” (at the top):

Now, scroll down to the Access Permissions group:

Now, tap “World” (emphasized with a red oval in the above screenshot):

Now, tap “Write” (see red oval above) so that a checkmark appears to the right of it:

Now, you can go back (tap “File Attributes” on the top left) and tap Done in the top right corner so that the permissions are set.

If you don't want to grant write access to all files in the subdirectory (there're few of them and you can safely do this!), make sure you do the same to AVCapture.plist [in pre-4.3] or AVCaptureSession.plist [in 4.3+], CameraRollValidator.plist and MediaValidator.plist!

More to come...

This was strictly an intro to my utility and using iFile to grant file system permissions applicable to both the iPhone 3G S and the iPhone 4. I'll soon (I don't know when; probably today) post a second part, in which I provide you with a lot of frame grabs and example videos, thoroughly comparing the three video modes to each other - and to those of the (enhanced) iPhone 4, in order to make it easier for you to select from it. I will also evaluate and list the user tweaks I've tested (e.g., those of Jekku).

The second part, however, will "only" be a showcase of examples (emphasizing the quality difference between the available camera modes) and not strictly needed to start using my utility now.


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>