How to record a video of the iOS Simulator from the command line
simctl recordVideo, stopping cleanly with SIGINT, a clean status bar, knowing when each scene starts, and what to do about the missing camera.
If you want a video of your iOS app, the obvious move is to open Simulator.app and press Command-R, or start QuickTime and drag a rectangle. That works once. It doesn't work when a script has to record a scene, stop at the right moment, and hand the file to an edit that needs to know when each gesture happened.
This is how we record the iOS Simulator in Pullscene, with the commands, the traps we hit, and what we still do differently on Android.
The one command
Xcode ships everything you need in simctl:
xcrun simctl io booted recordVideo --codec=h264 --force out.mp4
bootedtargets the simulator that is running. With several booted, pass its UDID instead (xcrun simctl list devicesgives it).--codec=h264gives you a file every editor and every browser reads. The default HEVC is smaller, but it is a pain downstream.--forceoverwrites the file if it exists, so a second take doesn't fail on the first one's leftovers.
The best part: it works without Simulator.app. The device can be booted headless with xcrun simctl boot <udid>, and recordVideo captures its screen at the device's native resolution. No window on your desktop, no other app sliding over the picture, nothing to crop.
Stop it with SIGINT, not SIGKILL
recordVideo runs until you tell it to stop. How you stop it matters.
Send SIGINT, the same thing as Ctrl-C in a terminal. The process then finishes writing the file and closes it properly. Kill it harder and you get an MP4 with no index at the end: some players open it, most refuse.
In a script, that means keeping a handle on the child process, sending it SIGINT when the scene is over, and waiting for it to exit before you touch the file. We also wait about half a second after the last scene before stopping, so the final frame isn't cut off.
And if your script crashes halfway, stop the recorder in a finally block anyway. A recorder left running keeps writing to disk until someone notices.
Know when the recording really started
Here is the trap that costs the most time. You start recordVideo, and you assume the video begins at that instant. It doesn't. The tool takes a moment to attach, then prints Recording started. Everything before that line is not in the file.
If you note the start time when you spawn the process, all your timings are off by that delay. Your cuts land early, and the voice talks over the wrong screen.
So we read the tool's output and take the time when Recording started appears. If the line never shows up, we fall back to the spawn time plus half a second rather than hang.
Know when each scene starts
A video of a whole demo is not enough. The edit needs to know where each scene begins and ends, to put the right voice and the right slide on it.
You can't get that from the video itself. You get it from the app. In Pullscene, a small driver is injected into a copy of the Flutter app (more in Automate Flutter demo videos). As it plays each scene, it writes lines to the log:
SHOWCASE ready 1764601200123
SHOWCASE start s1 1764601201456
SHOWCASE end s1 1764601208910
The number is a Unix time in milliseconds. The recorder only starts once the app says ready, so the video never opens on a loading screen. Afterwards, each scene's start and end are turned into seconds from the moment the recording started, and the edit cuts on them.
It's the same idea as the prototype, which logged TOUR <scene> <ms>. Clocks on the same Mac agree, so a timestamp from the app and one from the recorder line up to the frame.
Make the simulator look like a phone
A raw simulator screen gives itself away: the clock shows the real time, the battery says whatever your Mac says, and the carrier is odd. In a demo, it distracts.
simctl can override the status bar:
xcrun simctl status_bar booted override --time 9:41 --batteryState charged --batteryLevel 100 --wifiBars 3 --cellularBars 4
9:41 is the time Apple puts on its own screenshots. Clear the override afterwards with xcrun simctl status_bar booted clear, or your simulator keeps lying to you the next morning.
Language matters too. If the video is narrated in French, the app on screen should be in French. We set AppleLanguages and AppleLocale with simctl spawn <udid> defaults write -g, then reboot the device so the app picks them up. It costs a few seconds, only when the language changes.
The simulator has no camera
This one stopped us cold in the prototype. Proofit's new feature was a camera screen, and the iOS Simulator has no camera at all. There is nothing to film.
The Android emulator does have one: a virtual scene, a small 3D room the camera looks at. So for that one scene, the prototype was recorded on the Android emulator, with:
adb shell screenrecord --bit-rate 12000000 /sdcard/scene.mp4
then stopped with pkill -INT screenrecord on the device (the same SIGINT rule), and pulled back with adb pull. The default bit rate is low for text and gradients, hence the 12 Mb/s.
Two things to know about screenrecord: it caps a single recording at three minutes, and it records the device screen only, without the emulator frame. Both fine for one scene. The full Android side, with the emulator's own recorder and a clean status bar, is in How to record the Android emulator screen.
Today Pullscene records Flutter apps on the iOS Simulator. Android recording is coming next, with the same Dart driver on the emulator. When a scene needs hardware the simulator doesn't have, the honest answer for now is to show it differently, or to leave it in "what's left" and say so in the voice.
Boot, record, clean up
Put together, one recording looks like this:
- find a simulator (the one already booted, or an iPhone Pro, or any iPhone) and boot it if needed;
- wait for
xcrun simctl bootstatus <udid> -bto return, so the device is really ready; - set the language and the status bar;
- launch the app, wait for its
readyline, startrecordVideo, and note the time ofRecording started; - let the scenes play, reading their marks from the log;
- send
SIGINTto the recorder, wait for it to exit; - clear the status bar, and shut the simulator down if you booted it yourself.
That last step is easy to skip. We don't: a booted simulator holds a few gigabytes of memory, and a dozen forgotten ones will slow down the Mac that also has to encode the video.
Before you record
None of this helps if the gestures fail. A tips bubble you forgot, a sheet that asks for confirmation, and the take is wasted. That's why we play every scene once without recording, with a screenshot at the end of each, before we film anything. It's in Rehearse before you record.
And the recorder is only half the timing. The other half is the voice, generated before the recording so each scene can hold until its last word: Voice first, picture second.