vhs
Record terminal sessions to GIF or MP4
TLDR
Create a tape file (add commands to the tape file using an editor)
Record inputs to a tape file
Record inputs to a tape file using a specific shell
Stop recording
Validate the syntax of a tape file
Create a GIF from a tape file
Publish a GIF to
SYNOPSIS
vhs tapefile
vhs build tapefile [options]
vhs test tapefile
vhs validate tapefile
vhs version
PARAMETERS
-o, --output
Specifies the path for the output GIF, MP4, or WebM file. If not specified, a temporary file is used.
-f, --frame-rate
Sets the frame rate (frames per second) for the output video or GIF. Higher values result in smoother animations.
-p, --padding
Adds padding (in pixels) around the terminal content within the output. Can be a single value (for all sides) or four values (top, right, bottom, left).
--no-cursor
Disables the blinking cursor in the recorded terminal output.
--no-optimize
Prevents GIF palette optimization, which can result in larger file sizes but may preserve more color fidelity.
--no-compositor
Disables the use of a compositor during rendering, which might improve performance on some systems or for specific use cases.
--shell
Specifies the shell executable to use for the terminal sessions (e.g., /bin/bash, /usr/bin/zsh). Defaults to your system's default shell.
--config
Provides a path to a custom configuration file for vhs settings, overriding default behaviors.
--debug
Enables verbose debug logging, which is useful for troubleshooting issues with the recording or rendering process.
DESCRIPTION
vhs (or "VHS") is a modern command-line tool designed for recording and rendering terminal sessions into high-quality animated GIFs, MP4, or WebM videos. It operates by interpreting a Tapefile, which is a simple, declarative scripting language that defines a sequence of terminal actions, such as typing commands, setting delays, resizing the terminal, and applying visual themes. Internally, vhs leverages a headless browser to simulate the terminal environment, capture frames, and then utilizes external tools like FFmpeg for efficient video and GIF encoding. Its primary goal is to empower developers and content creators to produce visually appealing and easily shareable demonstrations of command-line interfaces or code execution.
CAVEATS
vhs is not a standard Linux utility and must be installed separately (typically via Go). It requires a Go runtime environment and often depends on external tools like ffmpeg for video encoding. The rendering process can be resource-intensive, especially for long or high-resolution recordings, and may require sufficient CPU and RAM. It relies on a custom Tapefile syntax, which requires learning a new scripting language for defining terminal actions.
TAPEFILE SCRIPTING
The core functionality of vhs is driven by a Tapefile, a simple text file containing a sequence of declarative commands. These commands include Output (to specify the output file), Set (to configure global options like theme, font size, or dimensions), and actions like Type (to simulate typing), Sleep (to pause execution), Enter, Backspace, and various key presses (e.g., Ctrl+C). This scripting approach allows for precise control over the recording process, ensuring consistent and reproducible demonstrations.
OUTPUT FORMATS
Beyond animated GIFs, vhs supports generating MP4 and WebM video formats, offering flexibility for different use cases. MP4 and WebM generally provide better compression and quality for longer recordings compared to GIFs, making them suitable for more extensive demonstrations or web embedding.
HISTORY
Developed by Charmbracelet, a team renowned for creating elegant and powerful command-line tools (e.g., Glow, Bubble Tea), vhs emerged as a modern, open-source solution for terminal recording. Its development leverages Go, a language well-suited for building performant CLI applications, and integrates with headless browser technologies to achieve high-fidelity visual output. It gained popularity for its ease of use in creating polished demonstrations for documentation, tutorials, and presentations, quickly becoming a go-to tool for CLI content creation.