Use the script bundled with the skill to generate/edit videos via theByteDance Seedance video model on Volcano Engine Ark:
- Doubao Seedance series video models (via the Ark contents/generations/tasks API)
- Supports text-to-video and image-to-video (single-image / multi-image reference)
Default settings:
- Default model:
doubao-seedance-1-5-pro-251215(can be overridden with--model) - Default duration:
5seconds - Default aspect ratio:
16:9
Text-to-video
uv run {baseDir}/scripts/generate_video.py \
--prompt "一个在草地上奔跑的小狗视频,阳光明媚,电影感" \
--filename "奔跑小狗.mp4"
Using a YAML configuration file
You can write all video generation parameters into a YAML configuration file, then use it via the --config parameter:
Text-to-video configuration example (text2video.yaml):
prompt: 一个在草地上奔跑的小狗视频,阳光明媚,电影感
filename: 奔跑小狗.mp4
ratio: 16:9
duration: 5
Image-to-video configuration example (with a list of URL reference images,image2video.yaml):
prompt: 将图1的表情换为图2的表情,做一个眨眼微笑的短视频
filename: 表情女孩.mp4
images:
- https://ark-project.tos-cn-beijing.volces.com/doc_image/seedream4_imagesToimage_1.png
- https://ark-project.tos-cn-beijing.volces.com/doc_image/seedream4_5_imagesToimage_2.png
ratio: 9:16
duration: 5
Local reference image configuration example (local_images.yaml):
prompt: 多图融合成一个动画短片
filename: 多图融合动画.mp4
images:
- /path/to/参考图1.jpg
- /path/to/参考图2.png
ratio: 16:9
duration: 8
Usage:
uv run {baseDir}/scripts/generate_video.py --config image2video.yaml
Mix configuration files and command-line parameters (command-line parameters take higher priority):
uv run {baseDir}/scripts/generate_video.py --config prompt.yaml --filename "自定义文件名.mp4"
All parameters supported by the YAML configuration file:
prompt: Video content descriptionfilename: Output file nameimages: List of reference images (can be URLs or local file paths)ratio: Aspect ratio (e.g., "16:9", "9:16")duration: Video duration (seconds)model: Full model name (advanced option)api_key: API key
Image-to-video / reference images (URLs or local files are both fine, multiple images, uses the lite i2v model)
uv run {baseDir}/scripts/generate_video.py \
--prompt "参考图片中的女孩,做一个挥手微笑的短视频" \
--filename "挥手女孩.mp4" \
-i "https://example.com/ref_image_1.png" \
-i "/path/to/local_ref_2.jpg" \
--ratio "9:16" \
--duration 8
Reference images only (no explicit text prompt)
uv run {baseDir}/scripts/generate_video.py \
--filename "仅参考图生成视频.mp4" \
-i "/path/to/ref1.jpg" \
-i "/path/to/ref2.png"
Tip: At least one of "prompt" or "reference image" must be present, otherwise the script will report an error.
Notes
API key
- You need to set the
ARK_API_KEYenvironment variable
Parameter descriptions
- prompt: Video content text (Chinese / English both fine)
- image / -i:
- URL: Passed through directly to Ark (e.g., a publicly accessible image link)
- Local file: Automatically read and converted to
data:image/...;base64,...form before sending - Can be passed multiple times to form a multi-image reference (multi-image currently only takes effect under
doubao-seedance-1-0-lite-i2v-250428and other lite i2v models)
- ratio: Aspect ratio, commonly used:
"16:9"(default)"9:16""1:1""21:9"
- duration: Video duration (seconds), determined by the range actually supported by the model / Endpoint
- model(optional, advanced): Directly specify the Ark Endpoint / model ID, overriding the default binding
Polling script get_video_task_status.py extra parameters:
- interval: Polling interval (seconds), default
10, can be adjusted as needed based on task duration and frequency requirements - timeout: Maximum wait time (seconds), default
600, after which the script will report an error and exit
Results and file output
- Ark video generation is usually anasynchronous task:
- The script will call
POST /contents/generations/tasks - On success, it prioritizes parsing the returned
id/task_idas the task ID - If the response body directly carries
video_url, the script will try to fetch and save the video locally
- The script will call
- Save path rules:
- If
--filenameIf no directory is specified, it is saved by default to theoutputs/directory under this repository - If the filename has no extension, it is appended by default with
.mp4
- If
If the call succeeds but the backend only returns a task ID and has not yet generated video_url, the script will output the task ID, which can be used together with a polling script:
# 1) 先创建任务(可能只返回 TASK_ID)
uv run {baseDir}/scripts/generate_video.py \
--prompt "一个示例视频" \
--filename "示例视频.mp4"
# 2) 拿到上一步输出的 TASK_ID 后,轮询直到生成完成并下载视频
uv run {baseDir}/scripts/get_video_task_status.py \
cgt-20260226184301-4h8v6 \
--filename "示例视频.mp4" \
--interval 5
The polling script will:
- Periodically call
GET /contents/generations/tasks/{task_id}to check the task status - When the status is
succeeded/completedandvideo_urlis obtained, automatically download the video locally
Filename recommendations (for caller reference)
- Do not include specific implementation details in the filename (such as "seedance", "ark", etc.)
- The filename language is recommended to match the Prompt language; for example, use a short Chinese filename for a Chinese Prompt (such as
挥手女孩.mp4) - The filename should be meaningful but as short as possible, avoiding overly long sentences
Keyword hints (for discovery / search hits)
- "doubao", "豆包", "Seedance"
- "ByteDance video model", "字节跳动视频生成"
- "文生视频", "图生视频", "视频生成", "短视频生成"