关于 tavus-video-gen
通过 Tavus API 生成个性化视频,可让数字形象朗读脚本或对提供的音频进行口型同步。还可设置背景、检查视频状态,并列出或删除视频。
主要功能
- 01根据脚本或音频生成视频
- 02选择现成或自定义数字形象
- 03设置网站或视频背景
- 04生成透明背景 WebM
- 05检查状态并管理视频
适用场景
- 01制作由数字形象讲解的产品演示
- 02将录制旁白转换为口型同步视频
- 03生成带网站或视频背景的视频
- 04查询状态或删除生成的视频
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ tavus-engineering/ tavus-skills --skill tavus-video-gen安装后在 Claude Code 中输入/tavus-video-gen确认已加载。
详细介绍
Tavus 视频生成技能
生成由数字分身朗读脚本的个性化 AI 视频。
快速开始
curl -X POST https://tavusapi.com/v2/videos \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-d '{
"replica_id": "rfe12d8b9597",
"script": "Hey there! Welcome to our product demo."
}'
响应:
{
"video_id": "1e30440cf9",
"status": "queued"
}
完整 API 选项
curl -X POST https://tavusapi.com/v2/videos \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-d '{
"replica_id": "rfe12d8b9597",
"script": "Your script text here",
"video_name": "Product Demo v1",
"callback_url": "https://your-webhook.com/video-ready",
"background_url": "https://example.com/landing-page",
"background_source_url": "https://s3.../background.mp4",
"watermark_url": "https://s3.../logo.png",
"fast": false,
"transparent_background": false
}'
参数
| 参数 | 描述 |
|---|---|
replica_id | 必填。预置或自定义数字分身 ID |
script | 数字分身朗读的文本(使用此项或 audio_url) |
audio_url | 用于数字分身口型同步的预录音频(.wav/.mp3) |
video_name | 显示名称 |
callback_url | 用于完成或出错通知的 Webhook |
background_url | 用作背景录制的网站 URL |
background_source_url | 用作背景的视频文件 URL |
watermark_url | PNG/JPEG 徽标叠加层 |
fast | 快速渲染(会停用部分功能) |
transparent_background | 带 alpha 通道的 WebM(需要 fast: true) |
使用音频代替脚本
{
"replica_id": "rfe12d8b9597",
"audio_url": "https://s3.../narration.mp3"
}
支持的格式:.wav、.mp3
背景选项
网站背景
将滚动显示的网站录制为背景:
{
"background_url": "https://example.com/landing-page"
}
视频背景
使用视频文件:
{
"background_source_url": "https://s3.../promo-bg.mp4"
}
透明背景
用于在视频编辑器中进行合成:
{
"fast": true,
"transparent_background": true
}
输出带 alpha 通道的 .webm 文件。
检查视频状态
curl https://tavusapi.com/v2/videos/{video_id} \
-H "x-api-key: YOUR_API_KEY"
状态值:queued、generating、ready、error、deleted
就绪时:
{
"status": "ready",
"hosted_url": "https://videos.tavus.io/video/xxx",
"download_url": "https://stream.mux.com/.../high.mp4",
"stream_url": "https://stream.mux.com/xxx.m3u8"
}
Webhook 回调
完成时:
{
"video_id": "1e30440cf9",
"status": "ready",
"hosted_url": "https://videos.tavus.io/video/1e30440cf9",
"download_url": "...",
"stream_url": "..."
}
出错时:
{
"video_id": "xxx",
"status": "error",
"status_details": "Error message here"
}
脚本编写最佳实践
- 为保证质量和互动效果,时长控制在 5 分钟以内
- 使用对话式表达(大声朗读以检验效果)
- 使用标点符号表示停顿
- 结构清晰:开场 → 正文 → 行动号召
- 将较长内容拆分为多个视频
列出和删除视频
# List all videos
curl https://tavusapi.com/v2/videos -H "x-api-key: YOUR_API_KEY"
# Delete video
curl -X DELETE https://tavusapi.com/v2/videos/{video_id} \
-H "x-api-key: YOUR_API_KEY"
评论
支持 Markdown