Sora:通过 Openclaw Skills 实现的专业 AI 视频生成

作者:互联网

2026-03-26

AI教程

什么是 Sora 视频生成?

Sora 技能让用户能够通过精简的界面直接利用 OpenAI 最先进的视频生成模型。作为 Openclaw Skills 生态系统的一部分,它通过自动管理 API 通信、轮询完成状态以及处理文件下载,简化了创建高保真视频内容的过程。

该技能专为需要从自然语言提示或静态参考图像合成电影视觉效果的开发人员和创作者而设计。它内置了自动图像缩放逻辑,确保任何视觉输入都完美符合 Sora API 的要求,从而实现无缝的图生视频转换。

下载入口:https://github.com/openclaw/skills/tree/main/skills/pauldelavallaz/sora-video-gen

安装与下载

1. ClawHub CLI

从源直接安装技能的最快方式。

npx clawhub@latest install sora-video-gen

2. 手动安装

将技能文件夹复制到以下位置之一

全局模式 ~/.openclaw/skills/ 工作区 /skills/

优先级:工作区 > 本地 > 内置

3. 提示词安装

将此提示词复制到 OpenClaw 即可自动安装。

请帮我使用 Clawhub 安装 sora-video-gen。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。

Sora 视频生成 应用场景

  • 为营销和商业项目生成高端电影场景。
  • 将静态产品照片转换为动态镜头。
  • 使用先进的提示词工程技术进行视觉叙事原型设计。
  • 在大型 AI 驱动的内容流水线中自动化视频素材创建。
Sora 视频生成 工作原理
  1. 用户向技能脚本提供文本提示或参考图像。
  2. 技能验证参数,如时长(4、8 或 12 秒)和分辨率(最高 1792x1024)。
  3. 如果提供了参考图像,脚本会自动将其调整为目标视频尺寸,以防止 API 错误。
  4. 向 OpenAI Sora 端点发送请求,技能开始每 10 秒轮询一次状态更新。
  5. 生成完成后,技能会在临时 URL 过期前将 MP4 文件下载到指定的输出路径。

Sora 视频生成 配置指南

要开始使用此技能,请确保已配置 OpenAI API 密钥。使用以下命令初始化视频生成:

# 设置您的 API 密钥
export OPENAI_API_KEY='your_openai_api_key'

# 运行基础的文生视频生成
uv run ~/.clawdbot/skills/sora/scripts/generate_video.py r
  --prompt "Cinematic shot of a futuristic city" r
  --filename "city.mp4"

Sora 视频生成 数据架构与分类体系

Sora 技能采用结构化方法来管理视频生成参数和生成的媒体文件:

属性 类型 描述
prompt 字符串 用于引导视频动作和风格的描述性文本。
input_reference 文件 用作起始帧的可选 PNG/JPG 图像。
model 字符串 在 sora-2 和 sora-2-pro 模型之间选择。
size 字符串 分辨率格式(例如 1280x720,1024x1792)。
output 文件 MP4 视频文件,通常在 1.5MB 到 3MB 之间。
name: sora
description: Generate videos using OpenAI's Sora API. Use when the user asks to generate, create, or make videos from text prompts or reference images. Supports image-to-video generation with automatic resizing.

Sora Video Generation

Generate videos using OpenAI's Sora API.

API Reference

Endpoint: POST https://api.openai.com/v1/videos

Parameters

Parameter Values Description
prompt string Text description of the video (required)
input_reference file Optional image that guides generation
model sora-2, sora-2-pro Model to use (default: sora-2)
seconds 4, 8, 12 Video duration (default: 4)
size 720x1280, 1280x720, 1024x1792, 1792x1024 Output resolution

Important Notes

  • Image dimensions must match video size exactly - the script auto-resizes
  • Video generation takes 1-3 minutes typically
  • Videos expire after ~1 hour - download immediately

Usage

# Basic text-to-video
uv run ~/.clawdbot/skills/sora/scripts/generate_video.py r
  --prompt "A cat playing piano" r
  --filename "output.mp4"

# Image-to-video (auto-resizes image)
uv run ~/.clawdbot/skills/sora/scripts/generate_video.py r
  --prompt "Slow dolly shot, steam rising, warm lighting" r
  --filename "output.mp4" r
  --input-image "reference.png" r
  --seconds 8 r
  --size 720x1280

# With specific model
uv run ~/.clawdbot/skills/sora/scripts/generate_video.py r
  --prompt "Cinematic scene" r
  --filename "output.mp4" r
  --model sora-2-pro r
  --seconds 12

Script Parameters

Flag Description Default
--prompt, -p Video description (required) -
--filename, -f Output file path (required) -
--input-image, -i Reference image path None
--seconds, -s Duration: 4, 8, or 12 8
--size, -sz Resolution 720x1280
--model, -m sora-2 or sora-2-pro sora-2
--api-key, -k OpenAI API key env var
--poll-interval Check status every N seconds 10

API Key

Set OPENAI_API_KEY environment variable or pass --api-key.

Prompt Engineering for Video

Good prompts include:

  1. Camera movement: dolly, pan, zoom, tracking shot
  2. Motion description: swirling, rising, falling, shifting
  3. Lighting: golden hour, candlelight, dramatic rim lighting
  4. Atmosphere: steam, particles, bokeh, haze
  5. Mood/style: cinematic, commercial, lifestyle, editorial

Example prompts:

Food commercial:

Slow dolly shot of gourmet dish, soft morning sunlight streaming through window, 
subtle steam rising, warm cozy atmosphere, premium food commercial aesthetic

Lifestyle:

Golden hour light slowly shifting across mountains, gentle breeze rustling leaves, 
serene morning atmosphere, premium lifestyle commercial

Product shot:

Cinematic close-up, dramatic lighting with warm highlights, 
slow reveal, luxury commercial style

Workflow: Image → Video

  1. Generate image with Nano Banana Pro (or use existing)
  2. Pass image as --input-image to Sora
  3. Write prompt describing desired motion/atmosphere
  4. Script auto-resizes image to match video dimensions

Output

  • Videos saved as MP4
  • Typical file size: 1.5-3MB for 8 seconds
  • Resolution matches --size parameter