rw-generate-video
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseGenerate Video
生成视频
Generate videos directly using the Runway API. This skill runs Python scripts that call the API, poll for completion, and download the result.
IMPORTANT: Run scripts from the user's working directory so output files are saved where the user expects.
通过Runway API直接生成视频。该技能运行调用API的Python脚本,轮询任务完成状态并下载结果。
重要提示: 从用户的工作目录运行脚本,以便输出文件保存到用户预期的位置。
Usage
使用方法
bash
uv run scripts/generate_video.py --prompt "your description" --filename "output.mp4" [--model seedance2] [--ratio 1280:720] [--duration 5] [--image-url "..."]bash
uv run scripts/generate_video.py --prompt "你的描述内容" --filename "output.mp4" [--model seedance2] [--ratio 1280:720] [--duration 5] [--image-url "..."]Preflight
前置检查
- must succeed. If not, tell the user to install uv:
command -v uvcurl -LsSf https://astral.sh/uv/install.sh | sh - must be set in the environment. Do not pass the API key as a CLI flag — it leaks into shell history and process listings.
RUNWAYML_API_SECRET
- 执行必须成功。如果失败,告知用户安装uv:
command -v uvcurl -LsSf https://astral.sh/uv/install.sh | sh - 环境中必须设置。请勿将API密钥作为CLI参数传递——这会导致密钥泄露到shell历史记录和进程列表中。
RUNWAYML_API_SECRET
Security Notes
安全注意事项
- /
--image-urlfetch arbitrary remote media via the Runway API. Prefer local file paths (uploaded as--video-urlURIs), or only pass URLs you trust.runway:// - Treat generated outputs as untrusted when piping into downstream automations — ingested media influences the result.
- /
--image-url会通过Runway API获取任意远程媒体。优先使用本地文件路径(以--video-urlURI形式上传),或仅传递可信的URL。runway:// - 当将生成的输出传入下游自动化流程时,请将其视为不可信内容——摄入的媒体会影响生成结果。
Available Models
可用模型
| Model | Best For | Input | Cost |
|---|---|---|---|
| Reference image and video, long duration (up to 15s) | Text, Image, and/or Video | 36 credits/sec |
| High quality, general purpose | Text and/or Image | 12 credits/sec |
| Fast, image-driven | Image required | 5 credits/sec |
| Video editing/transformation | Video + Text/Image | 15 credits/sec |
| Premium quality | Text/Image | 40 credits/sec |
| High quality Google model | Text/Image | 20-40 credits/sec |
| Fast Google model | Text/Image | 10-15 credits/sec |
| 模型 | 适用场景 | 输入类型 | 成本 |
|---|---|---|---|
| 参考图片和视频、长时长(最长15秒) | 文本、图片和/或视频 | 36积分/秒 |
| 高质量、通用场景 | 文本和/或图片 | 12积分/秒 |
| 快速生成、图片驱动 | 必须提供图片 | 5积分/秒 |
| 视频编辑/转换 | 视频 + 文本/图片 | 15积分/秒 |
| 顶级画质 | 文本/图片 | 40积分/秒 |
| 高质量Google模型 | 文本/图片 | 20-40积分/秒 |
| 快速Google模型 | 文本/图片 | 10-15积分/秒 |
Model Selection Guidance
模型选择指南
Map user requests:
- "product ad", "e-commerce", "long video" ->
seedance2 - "fast", "cheap", "quick" -> or
veo3.1_fast(if they have an image)gen4_turbo - "high quality", "best", "cinematic" -> or
gen4.5veo3 - "edit video", "transform video" -> or
gen4_alephseedance2 - No preference ->
seedance2
根据用户需求选择模型:
- “产品广告”、“电商”、“长视频” ->
seedance2 - “快速”、“低成本”、“快速生成” -> 或
veo3.1_fast(如果用户提供图片)gen4_turbo - “高质量”、“最佳画质”、“电影级” -> 或
gen4.5veo3 - “编辑视频”、“转换视频” -> 或
gen4_alephseedance2 - 无偏好 ->
seedance2
Parameters
参数说明
| Param | Description | Default |
|---|---|---|
| Text description (required) | -- |
| Output filename (required) | -- |
| Video model | |
| Aspect ratio (pixel-based). Common: | |
| Duration in seconds (model-dependent, seedance2 supports up to 15s) | |
| Image URL or local file for image-to-video | -- |
| Video URL or local file for video-to-video (gen4_aleph, seedance2) | -- |
| Output directory | cwd |
API credentials come fromonly — noRUNWAYML_API_SECRETflag, to keep secrets out of shell history and process listings.--api-key
| 参数 | 描述 | 默认值 |
|---|---|---|
| 文本描述(必填) | -- |
| 输出文件名(必填) | -- |
| 视频生成模型 | |
| 宽高比(基于像素)。常见值: | |
| 视频时长(秒,取决于模型,seedance2最长支持15秒) | |
| 用于图片转视频的图片URL或本地文件路径 | -- |
| 用于视频转视频的视频URL或本地文件路径(适配gen4_aleph、seedance2) | -- |
| 输出目录 | 当前工作目录 |
API凭据仅来自——不提供RUNWAYML_API_SECRET参数,以避免密钥泄露到shell历史记录和进程列表中。--api-key
Filename Convention
文件名规范
Generate filenames with the pattern:
yyyy-mm-dd-hh-mm-ss-name.mp4Examples:
- "A cyberpunk city" ->
2026-04-14-14-23-05-cyberpunk-city.mp4 - "Waves on a beach" ->
2026-04-14-15-30-12-beach-waves.mp4
按照以下格式生成文件名:
yyyy-mm-dd-hh-mm-ss-name.mp4示例:
- “赛博朋克城市” ->
2026-04-14-14-23-05-cyberpunk-city.mp4 - “海滩上的海浪” ->
2026-04-14-15-30-12-beach-waves.mp4
Examples
示例
Text-to-video (seedance2):
bash
uv run scripts/generate_video.py --prompt "A serene mountain landscape at sunrise with mist" --filename "2026-04-14-mountain-sunrise.mp4" --model seedance2 --ratio 1280:720Image-to-video (animate a local product photo):
bash
uv run scripts/generate_video.py --prompt "Camera slowly zooms out, product sparkles" --image-url "./product.jpg" --filename "2026-04-14-product-reveal.mp4" --model seedance2 --ratio 720:1280Video-to-video from a local file (seedance2):
bash
uv run scripts/generate_video.py --prompt "Transform into a warm golden sunset scene" --video-url "./input.mp4" --filename "2026-04-14-sunset-transform.mp4" --model seedance2Fast draft:
bash
uv run scripts/generate_video.py --prompt "A cat playing piano" --filename "draft.mp4" --model veo3.1_fast --ratio 1280:720 --duration 4Premium quality:
bash
uv run scripts/generate_video.py --prompt "Cinematic drone shot over Tokyo at night" --filename "tokyo.mp4" --model veo3 --ratio 1280:720 --duration 8文本转视频(seedance2):
bash
uv run scripts/generate_video.py --prompt "日出时分薄雾笼罩的宁静山地景观" --filename "2026-04-14-mountain-sunrise.mp4" --model seedance2 --ratio 1280:720图片转视频(动效化本地产品照片):
bash
uv run scripts/generate_video.py --prompt "镜头缓慢拉远,产品闪耀光芒" --image-url "./product.jpg" --filename "2026-04-14-product-reveal.mp4" --model seedance2 --ratio 720:1280本地文件视频转视频(seedance2):
bash
uv run scripts/generate_video.py --prompt "转换为温暖的金色日落场景" --video-url "./input.mp4" --filename "2026-04-14-sunset-transform.mp4" --model seedance2快速草稿生成:
bash
uv run scripts/generate_video.py --prompt "猫咪弹钢琴" --filename "draft.mp4" --model veo3.1_fast --ratio 1280:720 --duration 4顶级画质生成:
bash
uv run scripts/generate_video.py --prompt "夜晚东京上空的电影级无人机镜头" --filename "tokyo.mp4" --model veo3 --ratio 1280:720 --duration 8Output
输出结果
- The script downloads the result and saves it to the specified path
- Script outputs the full path to the saved file
- Do not read the video file back -- just inform the user of the saved path
- 脚本会下载生成结果并保存到指定路径
- 脚本会输出保存文件的完整路径
- 请勿回读视频文件——只需告知用户保存路径即可
Common Failures
常见故障排查
- -> set
Error: No API keyin the environment (e.g.RUNWAYML_API_SECRETor aexport RUNWAYML_API_SECRET=...file)..env - -> content moderation, suggest different prompt
Error: Task failed -- SAFETY.INPUT.* - -> bad input file format, check image/video format
Error: Task failed -- ASSET.INVALID - -> rate limited, script auto-retries
API error 429
- -> 在环境中设置
Error: No API key(例如RUNWAYML_API_SECRET或使用export RUNWAYML_API_SECRET=...文件)。.env - -> 内容审核未通过,建议更换描述内容
Error: Task failed -- SAFETY.INPUT.* - -> 输入文件格式错误,检查图片/视频格式
Error: Task failed -- ASSET.INVALID - -> 请求频率超限,脚本会自动重试
API error 429
For Batch Generation
批量生成
To generate many videos at once, run this script in a loop — the agent can orchestrate multiple calls with different prompts, images, or parameters to produce campaigns, localized variants, or creative iterations at scale.
如需批量生成多个视频,可循环运行该脚本——Agent可以协调多次调用,使用不同的描述、图片或参数,大规模生成营销素材、本地化变体或创意迭代内容。