名称: video-message
描述: 通过口型同步的 VRM 虚拟人生成并发送视频消息。当用户要求视频消息、虚拟人视频、视频回复,或需要将 TTS 以视频而非音频形式呈现时使用。
元数据:
{
"openclaw":
{
"emoji": "🎥",
"requires": { "bins": ["ffmpeg", "avatarcam"] },
"install":
[
{
"id": "npm",
"kind": "npm",
"package": "@thewulf7/openclaw-avatarcam",
"global": true,
"bins": ["avatarcam"],
"label": "安装 avatarcam (npm)",
},
{
"id": "brew",
"kind": "brew",
"formula": "ffmpeg",
"bins": ["ffmpeg"],
"label": "安装 ffmpeg (brew)",
},
{
"id": "apt",
"kind": "apt",
"packages": ["xvfb", "xauth"],
"label": "安装无头 X 依赖项(仅限 Linux)",
},
],
},
}
从文本或音频生成虚拟人视频消息。输出为 Telegram 视频笔记(圆形格式)。
npm install -g openclaw-avatarcam
在 TOOLS.md 中配置:
### 视频消息 (avatarcam)
- avatar: default.vrm
- background: #00FF00
| 配置项 | 默认值 | 描述 |
|---|---|---|
avatar |
default.vrm |
VRM 虚拟人文件路径 |
background |
#00FF00 |
背景颜色(十六进制)或图片路径 |
| 平台 | 命令 |
|---|---|
| macOS | brew install ffmpeg |
| Linux | sudo apt-get install -y xvfb xauth ffmpeg |
| Windows | 安装 ffmpeg 并添加到 PATH |
| Docker | 请参阅下方的 Docker 部分 |
注意: macOS 和 Windows 不需要 xvfb,它们具有原生显示支持。
添加到 OPENCLAW_DOCKER_APT_PACKAGES:
build-essential procps curl file git ca-certificates xvfb xauth libgbm1 libxss1 libatk1.0-0 libatk-bridge2.0-0 libgdk-pixbuf2.0-0 libgtk-3-0 libasound2 libnss3 ffmpeg
# 使用纯色背景
avatarcam --audio voice.mp3 --output video.mp4 --background "#00FF00"
# 使用图片背景
avatarcam --audio voice.mp3 --output video.mp4 --background "./bg.png"
# 使用自定义虚拟人
avatarcam --audio voice.mp3 --output video.mp4 --avatar "./custom.vrm"
使用 OpenClaw 的 message 工具并设置 asVideoNote:
message action=send filePath=/tmp/video.mp4 asVideoNote=true
tts text="..." → 音频路径message action=send filePath=... asVideoNote=true 作为视频笔记发送用户:“给我发一个说‘你好’的视频消息”
# 1. 生成 TTS
tts text="Hello! How are you today?" → /tmp/voice.mp3
# 2. 生成视频
avatarcam --audio /tmp/voice.mp3 --output /tmp/video.mp4 --background "#00FF00"
# 3. 作为视频笔记发送
message action=send filePath=/tmp/video.mp4 asVideoNote=true
# 4. 回复
NO_REPLY
| 参数 | 值 |
|---|---|
| 分辨率 | 384x384(正方形) |
| 帧率 | 恒定 30fps |
| 最大时长 | 60 秒 |
| 视频编码 | H.264 (libx264) |
| 音频编码 | AAC |
| 质量 | CRF 18(高质量) |
| 容器 | MP4 |
canvas.captureStream(30) 捕获 WebM 流sendVideoNote API 发送| 平台 | 显示方式 | 备注 |
|---|---|---|
| macOS | 原生 Quartz | 无需额外依赖 |
| Linux | xvfb(无头模式) | apt install xvfb |
| Windows | 原生 | 无需额外依赖 |
Avatarcam 自动检测无头环境:
- 当 $DISPLAY 未设置时使用 xvfb-run(仅限 Linux)
- macOS/Windows 使用原生显示
- GPU 停滞警告可以安全忽略
- 生成时间:约实时长度的 1.5 倍(20 秒音频 ≈ 30 秒处理)
rm /tmp/video*.mp4asVideoNote=true