Tuesday, January 11, 2011

Enable HD video recording on iPhone 3GS

,

Summary:
  • I added ‘Super’ high quality mode in rev4, which uses the image sensor in still image mode  to capture video, so it will only record at 15fps, but the quality is amazing.  Thanks to a tip from Fyta.
  • The photo camera is fixed.  It will no longer go crazy in lowlight.
  • The video is not stretched, you are recording at 1080×800, which is 4:3, just like the original video.
  • The video is a lot higher in resolution and bitrate than the original, but the files are bigger, and it will take more power to encode.  Keep an eye on the disk space and battery life!
  • if you email the video or send it to youtube using iOS, it will reencode it to a lower quality.  Use Pixelpipe from the appstore to upload in original quality, or download it to your computer and go from there.
  • I am assuming your iOS device is running firmware 4.1, I have not tested this with older versions of iOS
  • There is a cydia app coming for all you non-tinkerers.
One quick look at the ARM Cortex processor that the 3GS uses [PDF Spec], it’s apparent that the chip is capable of handling 720p video encoding.  So all we need to do is by-pass the artificial limitation Apple has imposed on the hardware.  Here is a way to get the phone to record video (and playback on the iPhone) at 1080×800 @ 30fps at up to 15Mbps.  (up from the original 640×480 @ 3Mbps)  (I am using the non-standard 1080×800 in order to keep the video at the right aspect ratio)

For the truly impatient:
Download the pre-edited file HDVideo3GS.zip.
Jailbreak your device and install SSH
Decide if you want HD or SuperHD, see comparison of different video mode.
Copy the 3 .plist files to /System/Library/PrivateFrameworks/Celestial.framework/N88/ (Backup your original!)
Reboot your iPhone 3GS and enjoy HD video

Details, for the tinkerers:
  • Open /System/Library/PrivateFrameworks/Celestial.framework/N88/AVCapture.plist with a Plist editor
  • Under the AVCaptureMode_AudioVideoRecording key, set the width and height for the capture key to 1080×800, respectively.  This value controls the dimension of the video it is encoded at.
  • Set the width and height for the preview key to 440×320.  This value controls the size of the on-screen preview.  It does not have any effect on the final video.
  • Set the width and height for the sensor key to 1920×1080.  This value controls the active region of the sensor, so basically, we want to use the entire sensor.  This source will be automatically downscaled to the proper resolution at encoding time.  Setting it to the full size (2048×1536 seems to turn on a special ‘photo mode’, which is slower than video mode, but the quality is much better)
  • Increase the encoding average bitrate to 20Mbps (20000000bps), this records a much larger video file (~ 2MB for every second of video)
  • Increase the encoding bitrate cap to 40Mbps.  Also, lower the minimum quantizer from 19 to 15 or something, just for the heck of it.
  • Set the H264 profile from 3_0 to 3_1  (because wikipedia says so)
  • Save and close this file.
  • To make the phone playback the recorded HD video. Simply edit CameraRollValidator.plist and MediaValidator.plist, they can be found in the same place as AVCapture.plist. (If you don’t do this, the file can only be played back on your computer)
  • Replace 768 with 1280
  • And replace  MaxLevel30 with  MaxLevel31
  • Save these two files and reboot your iDevice

0 comments to “Enable HD video recording on iPhone 3GS”

Post a Comment

 

Mr.Mobile Copyright © 2011 | Template design by O Pregador | Powered by Blogger Templates