By Werner Ruotsalainen on Tue, 02/05/2013
As the developer of several video enhancer tools for the iPhone 3GS, 4, and 4S (see THIS for more info on them), as soon as I've jailbroken the iPhone 5 with the just-released “evasi0n” tool, I started looking into enhancing its camera. (As you may have guessed, you won't have access to anything I'm going to describe if you don't jailbreak. Unfortunately, Apple — unlike their competitors — locks down their platform heavily, and thus, makes it impossible to write camera enhancer tools like this without jailbreaking.)
First, let me elaborate on the problems with the stock video recorder of the iPhone 5. Yes, you, if you're an iPhone 4 / 4S / iPad 3 user and have read my past articles on enhancing them, you already know the answer: the biggest problem is the narrow field-of-view (FoV). While for example the, camera-wise (also) absolutely stunning Nokia Lumia 920 shoots video using 28 mm wide, all iPhone models starting with the iPhone 4 shoots videos at around 41-43 mm. (The iPhone 5 is somewhat – about 2 mm – wider than the previous two models but it's still pretty narrow at around 41mm.) This is waaaaay narrower and much harder to use with close subjects than not only the top smartphones (again, the Nokia Lumia 920 comes to mind as the most important alternative with an excellent camera,) but even the still shooting mode of the same device.
Let me show you an example of the latter, on the iPhone 5. The following is a still shot of the interior of my room, taken with the phone (again, the iPhone 5):
(as with almost all the images in this article, click for the original!)
Below is a full-sized framegrab from the video taken under exactly the same circumstances, from exactly the same position:
(BTW, before you ask: those rugs hanging in front of the window are the products of the famous Finnish firm Marimekko.)
Notice the difference? The video seems to be heavily “zoomed in” compared to the still shot.
Well, the latter is one of the biggest problems with the iPhone 5 (4/4S') camera. And the one I've fixed, of course.
What you need to do
Currently, iExplorer (as of version 184.108.40.206 for the Mac) won't be of help (otherwise, I'd recommend it). From the Cydia store, get the absolutely stunning iFile for your iPhone, navigate to /System/Library/Frameworks/MediaToolbox.framework/N42 and delete the file (standard swipe to left / right) AVCaptureSession.plist after backing it up to, say, your desktop computer. You can back it up by just downloading it (clicking its link) using the Web browser interface explained below. A screenshot of this:
(I've annotated both the file you'll need to delete and the Wi-Fi icon (see below).)
Then, start the Web browser in iFile with the second icon at the bottom (see annotation above) and enter the address it displays into your desktop browser. Navigate to the same /System/Library/Frameworks/MediaToolbox.framework/N42 directory:
Click “Browse...” at the bottom, navigate to my new, enhanced file and upload it. HERE's the file. Again, you'll want to backup the original plist file with the stock 1080p config. If you do, however, lose it, HERE it is. So that the changes are seen, restart the Camera app (by manually killing it in the task manager; respringing will also work).
Note that I'll very soon release the iPhone 5 version of my previous video camera enhancer. If you're afraid of overwriting the plist file yourself with iFile, you may want to wait for them. (I cannot give a time estimate, though. I'll be traveling very busily this week and will hardly have any time for coding for fun.)
If you do as is explained above, you'll need to manually delete and re-upload the plist file when you want to switch between the two modes. Therefore, if you often plan to switch (particularly because of the framerate problem – see below), you'd better wait for my “official” configuration tool.
The good and the bad
As with my past iPhone 4 (and, for that matter, 3GS) hack, the resolution is absolutely excellent. Let me present you with two crops from THIS full (warning, 2.7 MByte!) framegrab:
That is, it has no problems with the true resolution (unlike, say, some community-issued, absolutely useless "1080p" hacks for the 3GS - see my past articles on them if interested).
As with my iPhone 4 enhancer, the iPhone 5 enhancer, as it makes use of every single pixel on the sensor before resizing the full image, the “hacked” video has excellent low-light performance. Unlike the stock video recorder, of course – which can also be spotted by the second image shown above being considerably darker than the first.
Problems: the frame rate
As with the iPhone 4, dynamically reading and resizing the entire sensor area (that is, 8 Mpixels) can't be done 30 times a second. The iPhone 5, unfortunately, isn't a camera monster like the 41 Mpixel Nokia Pureview 808, which is able to do the same with its absolutely, incredibly fast circuitry. The iPhone 5, which has a far slower and less efficient camera handler, just can't do the same.
This means the average frame rate you can achieve will be around 19.5 fps. This is more than sufficient if you, for example, just shoot “social” video (e.g., a family meeting) where a much wider field of view is far more important than the framerate (or where low-light performance is absolutely essential), preferably on a tripod but in no way OK when shooting, say, sports events. (This is why I told you above you may want to restore the original plist from time to time!)
I've provided a small video showing my standardized 60 fps counter (see THIS for more info) HERE (warning, a 6 Mbyte download). As you can see, on average, every third frame has been recorded. (As has been explained in my earlier articles, use Quicktime to step over the video frame-by-frame.) I've shot the video with my 17” MBP running at full brightness to avoid the phone's slowing down the effective framerate to be able to gain more photons.
Unfortunately, the traditional ways of disabling noise reduction or binning don't seem to have any effect on the speed. I've added the (properly configured) keys “TemporalNoiseReductionMode”, “Binned”, “ChromaNoiseReduction” and even “MinFrameRate” under AVCaptureDevices / 0 / AVCaptureSessionPresetHigh / LiveSourceOptions – without any effect. (Consult my older, iPhone 4S-specific articles on their effects when not using the entire sensor area!) I'll, however, play with these further – I may still be able to come up with something. (Don't expect much, though – as pointed out above, reading even a 8 Mpixel sensor 30 times a second requires a blazingly fast hardware very few phones or even true cameras have.)
How does it work?
It's very similar to my old iPhone 4 wide FoV hacks. (Please refer to my old articles on them.)
1, I've increased AVCaptureDevices / 0 / AVCaptureSessionPresetHigh / LiveSourceOptions / Sensor to use the entire sensor area instead of just the center crop of it. This is why 1080 became 2448 (Height) and 1920 became 3264 (Width).
2, In order to record as high-resolution a footage as possible, I've very thoroughly examined the capabilities of the built-in H.264 encoder of the phone and found out that, using 4:3 aspect ratio (that is, the same as that of the sensor), the highest resolution it can encode video at is 1664x1248. Should you go further (to even 1668x1251), the recorded footage will be illegal. It's this (1664x1248) value that I've entered to AVCaptureDevices / 0 / AVCaptureSessionPresetHigh / LiveSourceOptions / Capture.
I've tried very hard to enable 60 (or anything over 30 fps, for that matter, even at 720p) recording. Absolutely no success so far – (at least currently) it seems it's just impossible under iOS 6 on both the iPhone 5 and the 4S with not only AppStore apps, but also with jailbroken ones, unlike with iOS 5 and the iPhone 4S. See the discussion HERE for more info.
UPDATE (Jun/04/2013): HERE is the current version of the tweak. In the foreseeable future, I won't be able to develop it further as I've just lost my iPhone 5 jailbreak, which means I wouldn't be able to test it. (Story of it in THIS thread , along with some advice, should you also encounter the same "fading Apple logo" problem.) The main (first) tab is working just fine under 6.1.2 and previous, JB'able versions.
Just transfer the DEB file to your iPhone 5 and, from iFile, tap it. Select “Installer” from the menu (will also work in the free version of iFile).
1, Always kill the Camera app so that the changes are seen.
2, Don't enable the “NR" switch (the one in the upper right corner) if you want acceptable (around 19 fps) framerate
3, Don't use the “Advanced” (second) tab. I haven't rewritten it for iPhone 5 compliance.
The sources of the DEB file are HERE. A complete discussion and list of previous versions HERE. The tweak works together with CameraTweak just fine.