VHS是一款开源的命令行 GIF 生成工具,可自动生成命令行的 GIF 动画,可以用到教程、文档、工具演示、测试等场景上。VHS基于Go语言编写,遵守MIT开源协议。支持多操作系统包括Windows,MacOS和 Linux。

VHS工具支持自定义配置动画字体、间距、行高、延迟、打字速度、主题、删除与指针移动效果等各种属性,功能齐全。

安装:

# macOS or Linux
brew install charmbracelet/tap/vhs ffmpeg
brew install ttyd --HEAD

# macOS (via MacPorts)
sudo port install vhs

# Arch Linux (btw)
pacman -S vhs

# Nix
nix-env -iA nixpkgs.vhs

# Debian/Ubuntu
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://repo.charm.sh/apt/gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/charm.gpg
echo "deb [signed-by=/etc/apt/keyrings/charm.gpg] https://repo.charm.sh/apt/ * *" | sudo tee /etc/apt/sources.list.d/charm.list
# Install ttyd from https://github.com/tsl0922/ttyd/releases
sudo apt update && sudo apt install vhs ffmpeg

# Fedora/RHEL
echo '[charm]
name=Charm
baseurl=https://repo.charm.sh/yum/
enabled=1
gpgcheck=1
gpgkey=https://repo.charm.sh/yum/gpg.key' | sudo tee /etc/yum.repos.d/charm.repo
# Install ttyd from https://github.com/tsl0922/ttyd/releases
sudo yum install vhs ffmpeg

# Void Linux
sudo xbps-install vhs

# Windows
scoop install vhs

 Docker运行安装:

docker run --rm -v $PWD:/vhs ghcr.io/charmbracelet/vhs <cassette>.tape

源代码:

https://github.com/charmbracelet/vhs