vhs
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseVHS — Terminal Recorder
VHS — 终端录制工具
VHS records terminal sessions from declarative files.
Produces GIF, MP4, or WebM. No screen recording needed — deterministic and reproducible.
.tapeVHS 可通过声明式的文件录制终端会话,输出格式支持GIF、MP4或WebM。无需屏幕录制——录制结果可预测且可重复生成。
.tapeInstall
安装
bash
scoop install vhs # Windows
brew install vhs # macOSRequires (for video encoding). if missing.
ffmpegscoop install ffmpegbash
scoop install vhs # Windows
brew install vhs # macOS需要依赖(用于视频编码)。如果未安装,可执行进行安装。
ffmpegscoop install ffmpegQuick Start
快速开始
bash
undefinedbash
undefinedCreate example tape
创建示例tape文件
vhs new demo.tape
vhs new demo.tape
Record
开始录制
vhs demo.tape
vhs demo.tape
Validate without running
验证tape文件(无需执行)
vhs validate demo.tape
vhs validate demo.tape
Publish to vhs.charm.sh (get shareable URL)
发布到vhs.charm.sh(获取可分享链接)
vhs publish demo.gif
undefinedvhs publish demo.gif
undefinedTape File Syntax
Tape文件语法
Output
输出设置
tape
Output demo.gif # GIF (default, best for READMEs)
Output demo.mp4 # MP4 video
Output demo.webm # WebM videoMultiple lines = multiple formats from one tape.
Outputtape
Output demo.gif # GIF(默认格式,最适合README)
Output demo.mp4 # MP4视频
Output demo.webm # WebM视频多个配置行可让单个tape文件同时生成多种格式。
OutputSettings
基础设置
tape
Set Shell "bash" # Shell to use
Set FontSize 14 # Font size (default 22 — too large for most)
Set FontFamily "JetBrains Mono" # Font family
Set Width 1200 # Terminal width in pixels
Set Height 600 # Terminal height in pixels
Set Padding 15 # Padding around terminal
Set TypingSpeed 50ms # Delay between keystrokes (default 50ms)
Set Theme "Dracula" # Color theme (see Themes below)
Set Framerate 30 # GIF framerate
Set PlaybackSpeed 1.0 # Playback speed multiplier
Set LoopOffset 80% # Where GIF loop restarts (% from end)
Set WindowBar "Colorful" # Window bar: Rings, RingsRight, Colorful, ColorfulRight
Set WindowBarSize 40 # Window bar height in pixels
Set BorderRadius 8 # Terminal border radius
Set MarginFill "#1a1a2e" # Background color outside terminal
Set Margin 20 # Margin size (needs MarginFill)tape
Set Shell "bash" # 使用的Shell
Set FontSize 14 # 字体大小(默认22,对大多数场景来说过大)
Set FontFamily "JetBrains Mono" # 字体家族
Set Width 1200 # 终端宽度(像素)
Set Height 600 # 终端高度(像素)
Set Padding 15 # 终端内边距
Set TypingSpeed 50ms # 按键间隔(默认50ms)
Set Theme "Dracula" # 配色主题(见下方主题列表)
Set Framerate 30 # GIF帧率
Set PlaybackSpeed 1.0 # 播放速度倍数
Set LoopOffset 80% # GIF循环起始位置(从结尾算起的百分比)
Set WindowBar "Colorful" # 窗口栏样式:Rings、RingsRight、Colorful、ColorfulRight
Set WindowBarSize 40 # 窗口栏高度(像素)
Set BorderRadius 8 # 终端边框圆角
Set MarginFill "#1a1a2e" # 终端外部背景色
Set Margin 20 # 终端外边距(需配合MarginFill使用)Commands
命令指令
tape
Type "echo hello" # Type characters
Type@100ms "slow typing" # Type with custom speed
Enter # Press Enter
Enter 3 # Press Enter 3 times
Sleep 2s # Wait 2 seconds
Sleep 500ms # Wait 500 millisecondstape
Type "echo hello" # 输入字符
Type@100ms "slow typing" # 自定义输入速度
Enter # 按下回车键
Enter 3 # 连续按3次回车键
Sleep 2s # 等待2秒
Sleep 500ms # 等待500毫秒Special keys
特殊按键
Backspace 5 # Delete 5 chars
Tab # Tab completion
Ctrl+C # Interrupt
Ctrl+L # Clear screen
Up # Arrow up (history)
Down # Arrow down
Left 3 # Move cursor left 3
Right 3 # Move cursor right 3
Escape # Escape key
Space # Space key
PageUp # Page up
PageDown # Page down
Backspace 5 # 删除5个字符
Tab # 制表补全
Ctrl+C # 中断当前操作
Ctrl+L # 清屏
Up # 上箭头(历史命令)
Down # 下箭头
Left 3 # 光标左移3位
Right 3 # 光标右移3位
Escape # 退出键
Space # 空格键
PageUp # 上翻页
PageDown # 下翻页
Visibility
可见性控制
Hide # Hide commands from output
Show # Show commands again
undefinedHide # 隐藏命令,不显示在录制结果中
Show # 重新显示命令
undefinedRequire
依赖检查
tape
Require git # Fail if git not in PATH
Require nodetape
Require git # 如果git不在PATH中则终止执行
Require nodeRecommended Defaults
推荐默认配置
For README demos and documentation:
tape
Output demo.gif
Set Shell "bash"
Set FontSize 14
Set Width 1100
Set Height 600
Set Theme "Dracula"
Set TypingSpeed 30ms
Set Padding 15
Set WindowBar "Colorful"
Set BorderRadius 8适用于README演示和文档编写的配置:
tape
Output demo.gif
Set Shell "bash"
Set FontSize 14
Set Width 1100
Set Height 600
Set Theme "Dracula"
Set TypingSpeed 30ms
Set Padding 15
Set WindowBar "Colorful"
Set BorderRadius 8Patterns
常用场景示例
Simple command showcase
简单命令展示
tape
Output demo.gif
Set Shell "bash"
Set FontSize 14
Set Width 1100
Set Height 600
Set Theme "Dracula"
Set TypingSpeed 30ms
Set Padding 15
Type "my-tool --help"
Enter
Sleep 3s
Type "my-tool run --input data.json"
Enter
Sleep 5stape
Output demo.gif
Set Shell "bash"
Set FontSize 14
Set Width 1100
Set Height 600
Set Theme "Dracula"
Set TypingSpeed 30ms
Set Padding 15
Type "my-tool --help"
Enter
Sleep 3s
Type "my-tool run --input data.json"
Enter
Sleep 5sComplex commands (use a wrapper script)
复杂命令处理(使用包装脚本)
VHS tape files don't support shell quoting well. For complex commands
with quotes, pipes, or multi-line args, write a helper script:
bash
undefinedVHS的tape文件对Shell引号的支持不佳。对于包含引号、管道符或多行参数的复杂命令,建议编写辅助脚本:
bash
undefineddemo-run.sh
demo-run.sh
#!/bin/bash
echo "Running analysis..."
my-tool analyze --format json | jq '.results[] | .name'
```tape
Type "bash demo-run.sh"
Enter
Sleep 10s#!/bin/bash
echo "Running analysis..."
my-tool analyze --format json | jq '.results[] | .name'
```tape
Type "bash demo-run.sh"
Enter
Sleep 10sHide setup, show the interesting part
隐藏准备步骤,展示核心内容
tape
undefinedtape
undefinedSetup (hidden from recording)
准备步骤(不会出现在录制结果中)
Hide
Type "cd /tmp/demo-project"
Enter
Type "export DEMO_MODE=1"
Enter
Sleep 1s
Show
Hide
Type "cd /tmp/demo-project"
Enter
Type "export DEMO_MODE=1"
Enter
Sleep 1s
Show
Visible demo starts here
可见的演示从这里开始
Type "my-tool init"
Enter
Sleep 3s
undefinedType "my-tool init"
Enter
Sleep 3s
undefinedBefore/after comparison
前后对比展示
tape
Type "# Before:"
Enter
Type "cat config.yaml"
Enter
Sleep 3s
Type "# After running fix:"
Enter
Type "my-tool fix config.yaml"
Enter
Sleep 3s
Type "cat config.yaml"
Enter
Sleep 3stape
Type "# Before:"
Enter
Type "cat config.yaml"
Enter
Sleep 3s
Type "# After running fix:"
Enter
Type "my-tool fix config.yaml"
Enter
Sleep 3s
Type "cat config.yaml"
Enter
Sleep 3sRecording live (interactive)
交互式实时录制
bash
undefinedbash
undefinedRecord your terminal actions into a tape file
将终端操作录制为tape文件
vhs record > my-session.tape
vhs record > my-session.tape
Then edit the tape to clean up timing, add sleeps, etc.
之后可以编辑tape文件,调整时间、添加等待等
vhs my-session.tape
undefinedvhs my-session.tape
undefinedThemes
配色主题
Popular themes for demos:
| Theme | Style |
|---|---|
| Dark purple — high contrast, popular |
| Dark warm — modern, easy on eyes |
| Dark blue — clean |
| Dark muted — professional |
| Dark warm/retro |
| Classic |
| Familiar to devs |
| VS Code-like |
List all:
vhs themes适用于演示的热门主题:
| 主题 | 风格 |
|---|---|
| 深紫色系——高对比度,广受欢迎 |
| 深暖色调——现代风格,护眼 |
| 深蓝色系——简洁干净 |
| 深暗色系——专业感 |
| 深暖复古风 |
| 经典深色主题 |
| 开发者熟悉的GitHub深色风格 |
| 类似VS Code的深色主题 |
查看所有主题:
vhs themesTips
实用技巧
- FontSize 14 — default 22 is way too large for most demos
- TypingSpeed 25-40ms — 50ms default feels slow; 25ms is snappy
- Sleep after Enter — always add after commands to let output render
Sleep - Long commands — use wrapper scripts, VHS quoting is fragile
- GIF size — keep under 5MB for GitHub READMEs; reduce Framerate, Height, or duration
- Multiple outputs — one tape can produce +
.gifsimultaneously.mp4 - Publish — gives a shareable URL on vhs.charm.sh
vhs publish demo.gif - Validate first — catches syntax errors without recording
vhs validate demo.tape
- 字体大小设为14——默认22对大多数演示来说过大
- 输入速度设为25-40ms——默认50ms偏慢,25ms更流畅
- 执行命令后添加Sleep——命令执行后务必添加,等待输出完全渲染
Sleep - 复杂命令用脚本——VHS的引号支持有限,复杂命令建议用包装脚本
- 控制GIF大小——GitHub README中建议保持在5MB以内;可通过降低帧率、高度或时长来压缩
- 多格式输出——单个tape文件可同时生成和
.gif格式.mp4 - 分享录制结果——可生成vhs.charm.sh上的可分享链接
vhs publish demo.gif - 先验证再录制——可提前检查语法错误,无需实际录制
vhs validate demo.tape - 终端尺寸适配——如果输出换行异常,可增大Width或减小FontSize
Gotchas
—
- No shell expansion in Type — types the literal string; variable expansion happens when bash executes it, not in the tape
Type "echo $HOME" - Quoting — avoid nested quotes in Type. Use wrapper scripts for complex commands
- Windows paths — use forward slashes in Type strings (not
C:/dev/...)C:\dev\... - Long recordings — GIFs get huge fast. Keep demos under 30 seconds. Use to compress
Set PlaybackSpeed 2.0 - Terminal size — if output wraps weird, increase Width or reduce FontSize
—