如何用图像生成视频
把一张静态图像变成视频。在 Get3W 中这对应 first-to-video run type —— 你的图像会作为视频的首帧。
快速开始
视频耗时比图像长,因此建议异步提交后轮询:
bash
curl -X POST "https://api.get3w.com/v1/kling/kling-3/first-to-video" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"image_url": "https://your-cdn.com/your-image.png",
"prompt": "A person slowly turning their head and smiling",
"duration": 5,
"resolution": "1080p"
}'python
import time
import requests
headers = {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
}
task = requests.post(
"https://api.get3w.com/v1/kling/kling-3/first-to-video",
headers=headers,
json={
"image_url": "https://your-cdn.com/your-image.png",
"prompt": "A person slowly turning their head and smiling",
"duration": 5,
"resolution": "1080p"
}
).json()
time.sleep(task.get("estimated_duration") or 30)
while True:
data = requests.get(
f"https://api.get3w.com/v1/requests/{task['id']}",
headers=headers
).json()
if data["status"] == "completed":
print(data["outputs"][0])
break
if data["status"] == "failed":
print(f"Failed ({data['code']}):", data["error"])
break
time.sleep(5)选择模型
| Slug | 说明 |
|---|---|
google/veo-3.1/first-to-video | 质量最高,原生音频 |
google/veo-3.1-fast/first-to-video | 更快更便宜的 Veo |
kling/kling-3/first-to-video | 运动效果好,稳定可靠 |
kling/kling-3-turbo/first-to-video | 更快的 Kling |
bytedance/seedance-2.5/first-to-video | 提示词遵循度好 |
alibaba/wan-3/first-to-video | 通用场景 |
minimax/hailuo-2.3/first-to-video | 富有创意和表现力的运动 |
runway/gen-4.5/first-to-video | 电影质感 |
常用参数
| 参数 | 类型 | 说明 |
|---|---|---|
image_url | string | 首帧图像的 URL |
prompt | string | 期望运动效果的描述 |
duration | integer | 视频时长(秒) |
resolution | string | 输出分辨率,如 720p、1080p |
seed | integer | 用于复现结果的随机种子 |
各模型支持的时长和分辨率不同,两者都会影响价格。
相关 Run Type
| Run type | 适用场景 |
|---|---|
first-to-video | 你只有一张图要让它动起来 |
first-last-to-video | 你有起始帧和结束帧,需要在两者之间插值 |
reference-to-video | 你想用参考图来引导视频生成 |
text-to-video | 你没有源图像 |
只需替换路径中的 run type 并相应调整输入 —— 例如 first-last-to-video 需要同时提供首帧和末帧。
工作流程
- 托管图像到公网可访问的 URL —— 供应商会直接抓取
- 根据质量、速度和成本选择模型
- 写运动提示词,描述如何运动,而不只是描述场景
- 提交后轮询,或传入
?webhook=改用回调 - 在文件过期前下载输出
小技巧
- 描述运动,而非内容 —— 场景已由图像确定,提示词应说明什么在动
- 让运动合理可信 —— 与图像内容矛盾的运动容易产生画面瑕疵
- 先做短的 —— 先用 5 秒验证,再为更长的片段付费
- 批量场景用 webhook —— 并行轮询大量长视频任务会很快失控
下一步
- 如何生成语音 —— 添加旁白
- 如何创建数字人 —— 会说话的数字形象
- Webhook 模式 —— 免去轮询