Use the ByteDance Seedance-1.5-pro model (doubao-seedance-1-5-pro-251215) to generate videos from text or images.
Prerequisites
Install the SDK:
pip install 'volcengine-python-sdk[ark]'
Features
- Text-to-Video: Generate videos from text prompts
- Image-to-Video: Generate videos from a first-frame image
- Custom Parameters: Supports setting duration, aspect ratio, watermark, etc.
- Task Management: Create tasks, query status, auto-download
Usage
1. Quick Video Generation (Text-to-Video)
cd ~/.openclaw/workspace/skills/seedance-video
python3 scripts/generate_video.py "一只可爱的猫咪在草地上玩耍" --wait -o cat.mp4
2. Custom Parameters
python3 scripts/generate_video.py "日落时分的海边" \
--duration 10 \
--ratio 16:9 \
--wait \
-o sunset.mp4
3. Image-to-Video
python3 scripts/generate_video.py "猫咪动起来" \
--image-url https://example.com/cat.jpg \
--duration 5 \
--wait
4. Create Task Only (No Waiting)
python3 scripts/generate_video.py "星空下的城市" -o starry.mp4
# 返回任务ID
Then query the status and download later:
python3 scripts/generate_video.py --status <task_id> --wait -o starry.mp4
Parameter Description
| Parameter | Default Value | Description |
|---|---|---|
prompt |
Required | Video description prompt |
-o, --output |
output.mp4 | Output file path |
-m, --model |
doubao-seedance-1-5-pro-251215 | Model ID |
-d, --duration |
5 | Video duration (seconds) |
-r, --ratio |
16:9 | Aspect ratio (16:9, 9:16, 1:1, 4:3, etc.) |
--watermark |
false | Add watermark |
--return-last-frame |
false | Return the last frame image |
--image-url |
None | First-frame image URL (image-to-video) |
--wait |
false | Wait for video generation to complete and download |
--status |
None | Query the status of a specified task ID |
API Key Configuration
You need to set the ARK_API_KEY or SEEDANCE_API_KEY environment variable.
Configuration Method (Recommended)
- Copy the configuration template:
cp .canghe-skills/.env.example .canghe-skills/.env
- Edit the
.canghe-skills/.envfile and fill in your API Key:
ARK_API_KEY=your-actual-api-key-here
Or use environment variables
export ARK_API_KEY="your-api-key"
# 或
export SEEDANCE_API_KEY="your-api-key"
Loading Priority
- System environment variable (
process.env) - Current directory
.canghe-skills/.env - User home directory
~/.canghe-skills/.env
Prompt Optimization Suggestions
According to the Seedance-1.5-pro Prompt Guide:
- Specific description: Describe details such as the scene, subject, action, environment, etc.
- Clear style: Specify the photography style (e.g., "cinematic", "documentary style")
- Lighting description: Describe the lighting conditions (e.g., "golden hour", "soft natural light")
- Camera language: Describe camera movement (e.g., "slow push-in", "gimbal shot")
Example Prompts
一只金毛犬在秋天的公园里奔跑,金色落叶飘落,下午的阳光透过树叶,电影感镜头,稳定器拍摄,4K画质
一个机器人在未来城市的霓虹灯街道上行走,赛博朋克风格,雨夜,倒影,广角镜头,电影色调
Python API Usage
from volcenginesdkarkruntime import Ark
from scripts.generate_video import create_video_task, wait_for_video
# 初始化客户端
client = Ark(
base_url="https://ark.cn-beijing.volces.com/api/v3",
api_key="your-api-key"
)
# 创建视频任务
result = create_video_task(
client=client,
model="doubao-seedance-1-5-pro-251215",
prompt="一只鸟在天空中飞翔",
duration=5
)
task_id = result["task_id"]
# 等待并获取结果
final_status = wait_for_video(client, task_id)
video_url = final_status["video_url"]
Notes
- Asynchronous generation: Video generation is an asynchronous process and usually takes 30-60 seconds
- Task retention time: Task data is retained for only 24 hours
- Rate limiting: Pay attention to the account's RPM and concurrency limits
- Video ratio: It is recommended that the video aspect ratio be close to the first-frame image ratio
Task Status
queued: Queuedrunning: Generatingsucceeded: Successfailed: Failed