seedance-video
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSeedance 视频生成
Seedance Video Generation
使用字节跳动 Seedance-1.5-pro 模型 (doubao-seedance-1-5-pro-251215) 根据文本或图片生成视频。
Generate videos from text or images using ByteDance's Seedance-1.5-pro model (doubao-seedance-1-5-pro-251215).
前置要求
Prerequisites
安装 SDK:
bash
pip install 'volcengine-python-sdk[ark]'Install the SDK:
bash
pip install 'volcengine-python-sdk[ark]'功能
Features
- 文生视频: 根据文本提示词生成视频
- 图生视频: 根据首帧图片生成视频
- 自定义参数: 支持设置时长、宽高比、水印等
- 任务管理: 创建任务、查询状态、自动下载
- Text-to-video: Generate videos based on text prompts
- Image-to-video: Generate videos based on the first frame image
- Custom parameters: Support setting duration, aspect ratio, watermark, etc.
- Task management: Create tasks, query status, and auto download results
使用方法
Usage
1. 快速生成视频 (文生视频)
1. Quick video generation (text-to-video)
bash
cd ~/.openclaw/workspace/skills/seedance-video
python3 scripts/generate_video.py "一只可爱的猫咪在草地上玩耍" --wait -o cat.mp4bash
cd ~/.openclaw/workspace/skills/seedance-video
python3 scripts/generate_video.py "A cute cat playing on the grass" --wait -o cat.mp42. 自定义参数
2. Custom parameters
bash
python3 scripts/generate_video.py "日落时分的海边" \
--duration 10 \
--ratio 16:9 \
--wait \
-o sunset.mp4bash
python3 scripts/generate_video.py "Seaside at sunset" \
--duration 10 \
--ratio 16:9 \
--wait \
-o sunset.mp43. 图生视频
3. Image-to-video
bash
python3 scripts/generate_video.py "猫咪动起来" \
--image-url https://example.com/cat.jpg \
--duration 5 \
--waitbash
python3 scripts/generate_video.py "Make the cat move" \
--image-url https://example.com/cat.jpg \
--duration 5 \
--wait4. 仅创建任务(不等待)
4. Create task only (no waiting)
bash
python3 scripts/generate_video.py "星空下的城市" -o starry.mp4bash
python3 scripts/generate_video.py "City under the starry sky" -o starry.mp4返回任务ID
Return task ID
然后稍后查询状态并下载:
```bash
python3 scripts/generate_video.py --status <task_id> --wait -o starry.mp4
Then query the status and download later:
```bash
python3 scripts/generate_video.py --status <task_id> --wait -o starry.mp4参数说明
Parameter Description
| 参数 | 默认值 | 说明 |
|---|---|---|
| 必填 | 视频描述提示词 |
| output.mp4 | 输出文件路径 |
| doubao-seedance-1-5-pro-251215 | 模型 ID |
| 5 | 视频时长(秒) |
| 16:9 | 宽高比 (16:9, 9:16, 1:1, 4:3 等) |
| false | 添加水印 |
| false | 返回最后一帧图片 |
| 无 | 首帧图片 URL (图生视频) |
| false | 等待视频生成完成并下载 |
| 无 | 查询指定任务ID的状态 |
| Parameter | Default Value | Description |
|---|---|---|
| Required | Video description prompt |
| output.mp4 | Output file path |
| doubao-seedance-1-5-pro-251215 | Model ID |
| 5 | Video duration (seconds) |
| 16:9 | Aspect ratio (16:9, 9:16, 1:1, 4:3, etc.) |
| false | Add watermark |
| false | Return the last frame image |
| None | First frame image URL (for image-to-video) |
| false | Wait for video generation to complete and download automatically |
| None | Query the status of the specified task ID |
API 密钥配置
API Key Configuration
需要设置 或 环境变量。
ARK_API_KEYSEEDANCE_API_KEYYou need to set the or environment variable.
ARK_API_KEYSEEDANCE_API_KEY配置方式(推荐)
Configuration Method (Recommended)
- 复制配置模板:
bash
cp .canghe-skills/.env.example .canghe-skills/.env- 编辑 文件,填写你的 API Key:
.canghe-skills/.env
ARK_API_KEY=your-actual-api-key-here- Copy the configuration template:
bash
cp .canghe-skills/.env.example .canghe-skills/.env- Edit the file and fill in your API Key:
.canghe-skills/.env
ARK_API_KEY=your-actual-api-key-here或使用环境变量
Or use environment variables
bash
export ARK_API_KEY="your-api-key"bash
export ARK_API_KEY="your-api-key"或
Or
export SEEDANCE_API_KEY="your-api-key"
undefinedexport SEEDANCE_API_KEY="your-api-key"
undefined加载优先级
Loading Priority
- 系统环境变量 ()
process.env - 当前目录
.canghe-skills/.env - 用户主目录
~/.canghe-skills/.env
- System environment variables ()
process.env - in the current directory
.canghe-skills/.env - in the user home directory
~/.canghe-skills/.env
提示词优化建议
Prompt Optimization Suggestions
- 具体描述: 描述场景、主体、动作、环境等细节
- 风格明确: 指定摄影风格(如"电影感"、"纪录片风格")
- 光线描述: 说明光线条件(如"黄金时刻"、"柔和自然光")
- 镜头语言: 描述镜头运动(如"缓慢推进"、"稳定器拍摄")
Refer to Seedance-1.5-pro Prompt Guide:
- Specific description: Describe details such as scene, subject, action, environment, etc.
- Clear style: Specify the photography style (such as "cinematic", "documentary style")
- Light description: Specify lighting conditions (such as "golden hour", "soft natural light")
- Lens language: Describe camera movement (such as "slow push-in", "stabilizer shooting")
示例提示词
Example Prompts
一只金毛犬在秋天的公园里奔跑,金色落叶飘落,下午的阳光透过树叶,电影感镜头,稳定器拍摄,4K画质一个机器人在未来城市的霓虹灯街道上行走,赛博朋克风格,雨夜,倒影,广角镜头,电影色调A golden retriever running in an autumn park, golden fallen leaves falling, afternoon sunlight passing through the leaves, cinematic lens, stabilizer shooting, 4K qualityA robot walking on a neon street in a future city, cyberpunk style, rainy night, reflections, wide-angle lens, cinematic color tonePython API 使用
Python API Usage
python
from volcenginesdkarkruntime import Ark
from scripts.generate_video import create_video_task, wait_for_videopython
from volcenginesdkarkruntime import Ark
from scripts.generate_video import create_video_task, wait_for_video初始化客户端
Initialize client
client = Ark(
base_url="https://ark.cn-beijing.volces.com/api/v3",
api_key="your-api-key"
)
client = Ark(
base_url="https://ark.cn-beijing.volces.com/api/v3",
api_key="your-api-key"
)
创建视频任务
Create video task
result = create_video_task(
client=client,
model="doubao-seedance-1-5-pro-251215",
prompt="一只鸟在天空中飞翔",
duration=5
)
task_id = result["task_id"]
result = create_video_task(
client=client,
model="doubao-seedance-1-5-pro-251215",
prompt="A bird flying in the sky",
duration=5
)
task_id = result["task_id"]
等待并获取结果
Wait and get result
final_status = wait_for_video(client, task_id)
video_url = final_status["video_url"]
undefinedfinal_status = wait_for_video(client, task_id)
video_url = final_status["video_url"]
undefined注意事项
Notes
- 异步生成: 视频生成是异步过程,通常需要 30-60 秒
- 任务保存时间: 任务数据仅保留 24 小时
- 限流: 注意账号的 RPM 和并发数限制
- 视频比例: 建议视频宽高比与首帧图片比例接近
- Asynchronous generation: Video generation is an asynchronous process, usually taking 30-60 seconds
- Task retention time: Task data is only retained for 24 hours
- Rate limiting: Pay attention to the RPM and concurrency limits of your account
- Video ratio: It is recommended that the video aspect ratio is close to the ratio of the first frame image
任务状态
Task Status
- : 排队中
queued - : 生成中
running - : 成功
succeeded - : 失败
failed
- : In queue
queued - : Generating
running - : Succeeded
succeeded - : Failed
failed