iPhone Life magazine

V1.3 of the iPhone 3G S Video camera enhancer app released with cleaned-up iOS 4.3.x support (with full sources)

I've just posted the new (1.3) version of my iPhone 3G S Video camera enhancer to my Cydia repository. (Please see my previous, dedicated articles [e.g., THIS] on accessing it.)

Unfortunately, when it runs under iOS 4.3.x, it has two main disadvantages compared to the pre-4.3 version:

- no on-device playback of anything over 1 Mbps. That is, you can't set for example 2Mbps as your video data rate if you want to watch the video on your iPhone.

- no Full sensor mode, also meaning less real resolution and worse low-light performance (but much better framerate and no „clicking” bug)

All in all, if you still have a pre-iOS 4.3 3GS, and liked the Full mode very much and/or frequently used data rates (well) over 1 Mbps, you may not want to upgrade to iOS 4.3.x.

Feel free to test / use the new version. Again: don't panic if anything goes wrong. If it does, kill the Camera app (as always), restore the default configuration with the top button on the Simple view and set your settings again. Again, don't forget that you won't be play to play back your videos on the iPhone if you set anything over 1 Mbps as data rate!

Some background for programmers and hackers (as usual, I've made available the sources; they're HERE):

The only real, plist copying-based solution, that of Inspired Geek modified both the old (/System/Library/PrivateFrameworks/Celestial.framework/N88/AVCapture.plist) and the new (/System/Library/Frameworks/AVFoundation.framework/N88/AVCaptureSession.plist) main plist file. I've found this unnecessary. I've, however, kept the code commented out that helps easily accomplish this without major rewrites. We just make sure we call [SystemPlistContentWrapper populateSystemPlistDictionary] and writeDataToSystemFile twice; once with the original systemVersionHigherThan43 value originally set in the app delegate (and accessed as an extern variable in all other places) and, then, simulating a pre-4.3 mode by temporarily setting this variable to NO and calling the same method; now, on a separate instance kept parallel with the old one keeping the 4.3.x-specific / -formatted property list.

You'll need to do this in both Single and Advanced view. I've implemented the former (but, again, commented out everything after finishing my tests and finding out we don't need to modify the old plist at all). These are as follows:

.h:
@property (retain) SystemPlistContentWrapper* mySystemPlistContentWrapper2; // for 4.3+ to achieve double backup

.m:
@synthesize … mySystemPlistContentWrapper2;

buttonPress:
...
if (systemVersionHigherThan43)
{
systemVersionHigherThan43 = NO;
[self.mySystemPlistContentWrapper2 writeDataToSystemFile:[NSNumber numberWithInt:bitSpeed]
liveSourceOptions_Sensor_Width:[NSNumber numberWithInt:sensorWidth]
liveSourceOptions_Sensor_Height:[NSNumber numberWithInt:sensorHeight]
liveSourceOptions_Preview_Width:[NSNumber numberWithInt:440] // previewWidth
liveSourceOptions_Preview_Height:[NSNumber numberWithInt:320]
liveSourceOptions_Capture_Width:[NSNumber numberWithInt:captureWidth]
liveSourceOptions_Capture_Height:[NSNumber numberWithInt:captureHeight]
];
systemVersionHigherThan43 = YES;
}

viewDidLoad:
...
if (systemVersionHigherThan43)
{
systemVersionHigherThan43 = NO;
self.mySystemPlistContentWrapper2 = [[SystemPlistContentWrapper alloc] init];
[self.mySystemPlistContentWrapper2 populateSystemPlistDictionary];
systemVersionHigherThan43 = YES;
}

I've found out that, in order to avoid 480p mode being stuck, you need to avoid setting the little-used preview dimensions when falling back to 480p; hence the additional if ([newLiveSourceOptions_Sensor_Width intValue]!=640 && [newLiveSourceOptions_Sensor_Height intValue]!=480) block in [SystemPlistContentWrapper writeDataToSystemFile]. Basically, it's the main change (in addition to fully removing „Full” when running on 4.3.x) in the code, compared to v1.2. (Note that, at the end, I've commented out entirely the contents of the block. Otherwise, I would have ended up having to check out the particular case of „return to 480p from 1080p”, which would result in a crash. Unlike on the iPhone4, here's no real 16:9 mode so it's not that important to change the default preview size.)

The biggest problem is letting >1 Mbps playback (regardless of the capture size; e.g, VGA videos with over 1 Mbps couldn't be played back either, not only 1080p ones). Inspired Geek, in addition to setting the well-known AVCHD parameters, also greatly increased SVQ3's VideoMaxPixelsPerFrame. I found this pretty much useless. (Nevertheless, I've left the code – after commenting it out – in the app delegate for both media validator plists.) On-phone media playback of files with higher video data rate than 1 Mbps worked just fine under pre-4.3 iOS versions.

Actually, Inspired Geek's modification doesn't go higher in bit speed with high-resolution videos than 800 kbps either (he's using 800k as the hacked speed for high-res video). When modifying 800 000 in AVCaptureSession.plist's AVCaptureSessionPresetHigh/ VideoCompressionProperties/ AverageDataRate to, say, 2800000, reviewing the changes doesn't work any more.

Full sensor mode has entirely been removed because I just couldn't make it work, no matter how hard I tried. Basically, the programmatical change I've made was very easy: by just adding an else branch to [FirstViewController numberOfRowsInComponent] to hide it from the picker under 4.3 (and show it under pre-4.3):

if (systemVersionHigherThan43) return 2;
else return 3;


Want to master your iPhone and iPad? Sign up here to get our tip of the day delivered right to your inbox.
Email icon
Want more? Get our weekly newsletter:

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.

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.