· 1 min read
How to record video using XCode Simulator
# Dev Note This article was auto-translated from Chinese. Some nuances may be lost in translation.
Using screen recording can be quite cumbersome, especially since you have to manually adjust the frame each time. So, I looked into whether it was possible to record video using the simulator, and I found that it actually is—and surprisingly simple too! You just need to use a command line instruction:
xcrun simctl io booted recordVideo --codec=h264 transition.mp4
After pressing ctl+c, the video file will be automatically generated. Just make sure that there are no files with the same name. Additionally, since I often upload my repros to GitHub, and GitHub doesn’t support video files, I use ffmpeg to convert them into GIF files:
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
Then I’ll take my time to study the parameters of ffmpeg. In any case, this way I can convert video files into GIF files—awesome!
Related Posts
- Using Cloudflare Images for Image Storage and TransformationPutting an image on a web page is the easiest thing in frontend. But doing it properly — resizing, generating every format, holding up under traffic — turns into a whole solution of its own. I ended up handing all of it to Cloudflare Images and keeping just one original.
- Stop Using Access Keys AlreadyAccess Keys are an easily overlooked security risk on AWS. Use OIDC with IAM Roles so GitHub Actions can securely access AWS resources without any secrets.
- Database Primary Keys: AUTO_INCREMENT, UUID, and UUIDv7Backend developers often have to decide on a primary key: auto increment or UUID? What about collisions? How much faster is UUIDv7 compared with created_at + index? After benchmarking 20 million rows and looking at the design trade-offs, this post gives you the answer.
- Sharing My Experience with ZeaburIndependent developers often choose platforms like Vercel for deploying their services. However, when more advanced requirements arise, such as database connections, Vercel can become less convenient. Additionally, the pricing of typical cloud service providers can be quite expensive for solo developers. In this article, I’ll share some insights on using Zeabur and highly recommend it to everyone!