· 1 min read
How to Record Video with Xcode Simulator
This article was auto-translated from Chinese. Some nuances may be lost in translation.
category: iOS tag: iOS
Screen recording is such a hassle since you have to drag and select the capture area every time. So I looked into whether it’s possible to record directly from the simulator, and it turns out you can! It’s surprisingly simple, too—all it takes is a single command in the terminal:
xcrun simctl io booted recordVideo --codec=h264 transition.mp4
Pressing Ctrl+C will stop recording and automatically generate the video file; just make sure you don’t already have an existing file with the same name. Also, since I often upload repros to GitHub and GitHub doesn’t support video files, I use ffmpeg to convert it into a GIF:
ffmpeg -ss 2 -t 20 -i YOUR_VIDEO_NAME -vf "fps=10,scale=320:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop 0 OUTPUT.gif
I’ll dig deeper into ffmpeg parameters later, but anyway, this does the job of turning a video file into a GIF. Awesome!
Related Posts
- When a Measure Becomes a Target: From the Window Tax to Pull Request Counts I once wrote a script to tally how many PRs I contributed in a quarter, how many reviews I left, and how many tickets I closed, hoping to use numbers to prove my output to my manager. My manager simply remarked that performance isn't just about output. Years later, I finally understood—when a measure becomes a target, it ceases to be a good measure. From the British window tax and the Hanoi rat bounty to evaluating developers by PR counts today, the underlying mechanism is exactly the same.
- Using Cloudflare Images for Image Storage and Transformation Putting an image on a webpage is the simplest task in frontend development. But doing it properly—including resizing, generating multiple formats, and withstanding heavy traffic—is actually an entire end-to-end solution. Eventually, I offloaded everything to Cloudflare Images, keeping only a single original image.
- Stop Using AWS Access Keys Access Keys are an easily overlooked security risk in AWS. By pairing OIDC with IAM Roles, GitHub Actions can securely operate AWS resources without storing any secrets.
- Database Primary Keys: AUTO_INCREMENT, UUID, and UUIDv7 Backend developers often face the choice of primary keys: should you use auto-increment or UUID? What about collisions? How does UUIDv7 compare to created_at + index in performance? Here are the design decisions and benchmark results from testing 20 million rows.