vhs  by charmbracelet

CLI tool for recording terminal GIFs as code

created 3 years ago
16,955 stars

Top 2.8% on sourcepulse

GitHubView on GitHub
Project Summary

VHS is a command-line tool that records terminal sessions and generates animated GIFs or other video formats, ideal for creating demos, tutorials, and integration tests for CLI applications. It allows users to script terminal interactions using a declarative .tape file format, offering fine-grained control over typing, timing, and terminal appearance.

How It Works

VHS operates by simulating a terminal environment based on instructions within .tape files. These files define actions like typing commands, pressing keys, pausing, and waiting for specific output patterns. The tool leverages ttyd for terminal emulation and ffmpeg for rendering the recorded sessions into video formats. This approach provides a reproducible and scriptable way to capture CLI behavior, ensuring consistency in demos and tests.

Quick Start & Requirements

  • Install via package managers (macOS/Linux brew, Arch pacman, Nix, Windows scoop/winget), Go (go install), or Docker.
  • Required dependencies: ttyd and ffmpeg must be installed and in your PATH.
  • Official documentation: https://github.com/charmbracelet/vhs
  • Recording: vhs record > cassette.tape
  • Rendering: vhs <cassette>.tape

Highlighted Details

  • Supports GIF, MP4, WebM, and PNG sequences as output formats.
  • Offers extensive customization for terminal appearance (font, size, theme, padding, window bar).
  • Includes a record command to generate .tape files from live terminal sessions.
  • Provides a serve command for self-hosting VHS via SSH, enabling remote execution.

Maintenance & Community

  • Developed by Charm, a collective focused on open-source developer tools.
  • Active community support via Discord.
  • Syntax highlighting available via tree-sitter-vhs for editors like Neovim.

Licensing & Compatibility

  • MIT License.
  • Permissive license suitable for commercial use and integration into closed-source projects.

Limitations & Caveats

The ttyd and ffmpeg dependencies must be correctly installed and accessible in the system's PATH. While VHS can record arbitrary terminal commands, complex TUI applications with heavy reliance on specific terminal capabilities might require careful scripting and testing.

Health Check
Last commit

2 weeks ago

Responsiveness

1 day

Pull Requests (30d)
2
Issues (30d)
4
Star History
734 stars in the last 90 days

Explore Similar Projects

Feedback? Help us improve.