vhs: Turn Your Terminal Sessions into Beautiful GIFs and Videos with a Simple Script
文章目录
- Declarative tape scripts — Define your demo in a simple text format: set dimensions, font size, framerate, shell type, then chain commands like Type, Sleep, Enter, Hide, and Show. No manual frame timing needed. Multiple output formats — Export to GIF for maximum compatibility, or MP4/WebM when file size isn't a concern. VHS handles frame capture and encoding automatically based on your Output directive. Rich built-in commands — Beyond basic typing, VHS supports variables, ANSI color output, window management (Alt+F4, Ctrl+C), screenshot pauses, and even custom font rendering — giving you pixel-perfect control over the final video.
- VHS has an active community of developers using it for everything from open-source project demos to YouTube content. Here are some of the most insightful recent discussions from GitHub Issues:
- Several users reported that their VHS recordings played back at double speed. The maintainer @maaslalani explained the root cause: "VHS will try to capture a frame every 1/framerate seconds (by default this is every 16.7 milliseconds) however if the capturing process takes longer, let's say 30 milliseconds per frame, then VHS won't have enough frames to render the GIF at 60 FPS, but it will still try — causing the double-speed effect." The workaround is setting Set Framerate 24 in the tape script. This issue sparked a deeper discussion about capturing performance in Docker environments and resource-heavy desktop sessions. @robinovitch61 confirmed the fix worked and shared a working tape configuration template. Insight for users: If your GIFs play too fast, reduce the framerate. Also close background apps (Chrome, VS Code, Slack) during recording for best frame capture rates.
- A long-standing UX issue where the default macOS bash welcome message ("WARNING: The default interactive shell is now zsh...") would appear at the start of recordings. The maintainer tried a fix by adding BASH_SILENCE_DEPRECATION_WARNING=1 to the default shell config, but @knpwrs reported it didn't fully suppress the message: "Now it lasts for 23 frames." @nimrossum shared they saw similar behavior on Windows. The recommended workaround is using Hide Sleep 1s Show after initial settings and before actual content: "As a temporary measure, until we get this fixed, I believe adding Hide + Sleep (placed after output and settings) should skip the frames for you at the beginning." Practical tip: Place Hide Sleep 1s Show right after your Set commands to skip shell initialization noise in your final output.
- Contributor @Exar04 proposed a --with-timestamp flag to record timestamps for each command, enabling audio synchronization and more precise playback control. The feature lead @raphamorim responded positively but asked for tests and suggested Unix POSIX format support: "It would be nice if --timestamp actually received a Unix POSIX format string like '%d/%m/%Y_%H:%M:%S:%N' and returned 20/04/2025_11:47:43:32." @Soviut raised an important concern about granularity: "One issue with this is that there isn't a separate timecode for each typed letter. One use case for the timecode is being able to add audio to each keystroke, and this wouldn't be enough to add audio to each keystroke." Community verdict: The feature is in active development and the maintainers are iterating on the API design. Worth watching if you need audio-synced terminal recordings.
- VHS fills a genuine gap in the developer tooling ecosystem — it turns the notoriously messy process of making quality terminal recordings into a clean, repeatable, scriptable workflow. Its declarative tape format is intuitive enough for quick README demos yet powerful enough for polished content production. The active community (150+ open issues, hundreds of contributors) keeps it improving rapidly, and the Go implementation ensures it runs fast on all major platforms including macOS, Linux, and Windows (via WSL/Docker). If you publish any CLI tool, library, or framework, VHS is arguably the best way to show it off. @charmbracelet/vhs — https://github.com/charmbracelet/vhs
Creating demo videos and GIFs for your CLI tools can be surprisingly painful — screen recorders capture too much, and manually timing frames is error-prone. VHS (short for Video Home System, a loving nod to retro tech) is an open-source CLI tool that records your terminal sessions from simple declarative tape scripts, outputting clean, production-ready GIFs and MP4s with zero friction.
Built with Go and published under the MIT license, VHS parses a human-readable .tape file that describes your terminal setup, commands, and timing — then automatically captures frames and encodes them into the output format of your choice. Whether you're creating documentation, README demos, or social media content, VHS makes your terminal look exactly the way you designed it.
- Declarative tape scripts — Define your demo in a simple text format: set dimensions, font size, framerate, shell type, then chain commands like
Type, Sleep, Enter, Hide, and Show. No manual frame timing needed.
- Multiple output formats — Export to GIF for maximum compatibility, or MP4/WebM when file size isn't a concern. VHS handles frame capture and encoding automatically based on your
Output directive.
- Rich built-in commands — Beyond basic typing, VHS supports variables, ANSI color output, window management (Alt+F4, Ctrl+C), screenshot pauses, and even custom font rendering — giving you pixel-perfect control over the final video.
Type, Sleep, Enter, Hide, and Show. No manual frame timing needed.Output directive.VHS has an active community of developers using it for everything from open-source project demos to YouTube content. Here are some of the most insightful recent discussions from GitHub Issues:
Several users reported that their VHS recordings played back at double speed. The maintainer @maaslalani explained the root cause:
"VHS will try to capture a frame every 1/framerate seconds (by default this is every 16.7 milliseconds) however if the capturing process takes longer, let's say 30 milliseconds per frame, then VHS won't have enough frames to render the GIF at 60 FPS, but it will still try — causing the double-speed effect."
The workaround is setting Set Framerate 24 in the tape script. This issue sparked a deeper discussion about capturing performance in Docker environments and resource-heavy desktop sessions. @robinovitch61 confirmed the fix worked and shared a working tape configuration template.
Insight for users: If your GIFs play too fast, reduce the framerate. Also close background apps (Chrome, VS Code, Slack) during recording for best frame capture rates.
A long-standing UX issue where the default macOS bash welcome message ("WARNING: The default interactive shell is now zsh...") would appear at the start of recordings. The maintainer tried a fix by adding BASH_SILENCE_DEPRECATION_WARNING=1 to the default shell config, but @knpwrs reported it didn't fully suppress the message:
"Now it lasts for 23 frames."
@nimrossum shared they saw similar behavior on Windows. The recommended workaround is using Hide Sleep 1s Show after initial settings and before actual content:
"As a temporary measure, until we get this fixed, I believe adding
Hide+Sleep(placed after output and settings) should skip the frames for you at the beginning."
Practical tip: Place Hide Sleep 1s Show right after your Set commands to skip shell initialization noise in your final output.
Contributor @Exar04 proposed a --with-timestamp flag to record timestamps for each command, enabling audio synchronization and more precise playback control. The feature lead @raphamorim responded positively but asked for tests and suggested Unix POSIX format support:
"It would be nice if
--timestampactually received a Unix POSIX format string like'%d/%m/%Y_%H:%M:%S:%N'and returned20/04/2025_11:47:43:32."
@Soviut raised an important concern about granularity:
"One issue with this is that there isn't a separate timecode for each typed letter. One use case for the timecode is being able to add audio to each keystroke, and this wouldn't be enough to add audio to each keystroke."
Community verdict: The feature is in active development and the maintainers are iterating on the API design. Worth watching if you need audio-synced terminal recordings.
VHS fills a genuine gap in the developer tooling ecosystem — it turns the notoriously messy process of making quality terminal recordings into a clean, repeatable, scriptable workflow. Its declarative tape format is intuitive enough for quick README demos yet powerful enough for polished content production. The active community (150+ open issues, hundreds of contributors) keeps it improving rapidly, and the Go implementation ensures it runs fast on all major platforms including macOS, Linux, and Windows (via WSL/Docker). If you publish any CLI tool, library, or framework, VHS is arguably the best way to show it off.