Delta Engine Blog

All about multiplatform and game development

Capture the iPhone screen as a video

As the PilotTest video now is done, d like to tell you what I did, to capture the screen of the iPhone. (Without using an extern camera, of course)
In general: when I say "iPhone" in this post, I mean "iPhone or iPod touch, both at firmware 3.0 or higher". (Sorry but I'm lazy and this will be a lot of text anyway)
Because it's needed for this method, at the end of this post I will give some information for those, who are not familiar with the jailbreak and installing apps.

Let's start with the equipment you will need:
  • A jailbroken iPhone
  • The Apple Composite AV-Cable
  • A Video-Grabbing-Card
  • An Application called ScreenSplitr
  • Video-Grabbing software
Unfortunately it seems you need a jailbroken iPhone, as far as the App we will use is not published in the App-Store. Hence I have the source code of this Application (it's open source), maybe one of the developers can build a version from it, we can use without a jailbreak.
I know, buying an original Apple AV cable is annoying, but with the iPhone OS 3.0 Apple has blocked most third party cables on the devices, it has to be the original.
The device for grabbing the signal to your computer can be whatever you like, while it has a Composite-Plug and if you want to have some sound, additionally two cinch-audio-plugs.
I have used this one for example...

Now for the Application: ScreenSplitr is an Open Source project, which uses the screenshot ability, that came with iPhone OS 3.0, to give a video output to the AV-Cable (yepp, audio too). While the actual release uses a very low frame-rate, I have altered the software to give a better framerate. (I will attach 2 versions, one for NTSC output and one for PAL output) Decide for a signal-encoding standard and install the corresponding application on your iPhone. Also make sure your iPhone's settings (Settings->Video->TV-Signal) match this.

Now connect the iPhone to the AV-cable, the AV-Cable to your Grabber and the Grabber to your computer (the order should not matter). It's time to open your Video-Grabbing software. (I can recommend Virtual VCR to windows users) Most programs offer a preview, so you can see if ScreenSplitr is started properly. And again: make sure the video-grabber is set to the same video-encoding settings.
Next you can start ScreenSplitr. ScreenSplitr checks the orientation of your iPhone when it's started. If you want to capture a game, that uses the landscape orientation, turn your iPhone before you start ScreenSplitr.
After starting ScreenSplitr, will close immediately, but on the thumbnail on your home-screen, it now shows a small "on" sign on its thumbnail. (ScreenSplittr now runs in background, "open" it again to stop it)
Now everything your iPhone's display shows is copied to the AV-output. You can start recording in your grabbing-software now.

When you’re done with your recording, you should first stop your grabbing-software and then close ScreenSplitr, since for the grabber stopping ScreenSplitr feels like pulling the cable, and some grabbers react badly to this.

Small summary:
So far I did not talk about the outcome of using a composite cable. In general using a composite connection is not the very best idea, since all color-information of our picture (R,G,B) is send in only one signal. This is of course reducing the pictures quality like nothing else. But why do we use this? Don't we have an alternate? There is an alternate, but as any good alternate it's more expencive. Instead of using the Apple-Composite-AV-Cable you can use the Apple-Component-AV-Cable, which provides a loseless connection. The problem is, tha capture devices that provide a component input are a lot more expensive than composite devices. (A quick look at google-shopping results ~25 € for a composite and ~ 160 € for a component capturer)

More information...
The Jailbreak
To jailbreak an iPhone, for me the easiest way is the blackra1n jailbreak, found here.
Once you have jailbroken the iPhone, you have a blackrain App on your iPhone’s screen, with that you can install one of the “underground AppStores” Cydia or Rock. Both are equal to the AppStore-App, but they use another repository instead, which is not under Apples control.

Get ready to install own apps
To install selfmade applications, you will first have to install an OpenSSH server via Cydia or Rock. After installing this you can access your iPhone via SSH. Just like everybody else, including some viruses looking for jailbroken iPhones still using the initial password.
So let’s change this: (Windows-users have to download a client like Putty, everybody else opens a terminal.) Your iPhone’s IP can be seen in “Settings->WiFi->(your networks name)” on the iPhone. Connect as root to your iPhone, e.g. “ssh root@192.168.1.1”. The initial root-password for the iPhones with firmware 3.0 is “alpine”. After this change the password with the command “passwd”, enter the new password in the next line and press return.

Install ScreenSplitr
The files are copied to the iPhone by using SCP(Windows: e.g. FileZilla using Port 22). Copy the .app to the “/Application” folder on the iPhone, e.g. “scp –r ./ScreenSplitr.app root@192.168.1.1:/Applications/ScreenSplitr.app”.
Make sure all files in the folder "ScreenSplitr[_25].app" have the permission to be executed. (to make sure, just execute "chmod 755 *" in the folder.
After this you need to restart your iPhone, so the app will be listed on the home-screen.
Attached to this post is file called “restart”, copy this to “/usr/bin/” on the iPhone. Now you can execute “ssh root@192.168.1.1 'restart'” to restart the iPhone.

ScreenSplitr_NTSC.zip - 30 Hz version (465.95 kb)

ScreenSplitr_PAL.zip - 25 Hz version(466.44 kb)

restart (8.88 kb)