用途
该技能用于在用户请求生成、创建或想象视频时,生成高质量视频。它通过结构化提示词和 Python 脚本完成视频生成,支持使用参考图像作为引导或视频的首帧/尾帧。
主要能力
- 为 AIGC 视频生成创建结构化 JSON 提示词。
- 支持参考图像作为引导,或作为视频的首帧/尾帧。
- 通过自动化 Python 脚本执行生成视频。
使用方式
第一步:理解需求
当用户请求生成视频时,需要识别以下信息:
- 主体/内容:视频中应包含什么。
- 风格偏好:艺术风格、氛围、色彩方案。
- 技术规格:宽高比、构图、光照。
- 参考图像:用于引导生成的任何图像。
无需检查 /mnt/user-data 下的文件夹。
第二步:创建结构化提示词
在 /mnt/user-data/workspace/ 中生成结构化 JSON 文件,命名模式为:{descriptive-name}.json。
第三步:创建参考图像(可选,当 image-generation 技能可用时)
为视频生成创建参考图像。如果只提供 1 张图像,则将其用作视频的引导帧。
第三步:执行生成
调用 Python 脚本:
python /mnt/skills/public/video-generation/scripts/generate.py \
--prompt-file /mnt/user-data/workspace/prompt-file.json \
--reference-images /path/to/ref1.jpg \
--output-file /mnt/user-data/outputs/generated-video.mp4 \
--aspect-ratio 16:9
参数说明:
- --prompt-file:JSON 提示词文件的绝对路径(必填)。
- --reference-images:参考图像的绝对路径(可选)。
- --output-file:输出视频文件的绝对路径(必填)。
- --aspect-ratio:生成视频的宽高比(可选,默认:16:9)。
注意:不要读取 Python 文件,只需使用参数调用它。
视频生成示例
用户请求:“生成一段短视频片段,描绘《纳尼亚传奇:狮子、女巫和魔衣橱》的开场场景。”
第一步:在线搜索《纳尼亚传奇:狮子、女巫和魔衣橱》的开场场景。
第二步:创建包含以下内容的 JSON 提示词文件:
{
"title": "The Chronicles of Narnia - Train Station Farewell",
"background": {
"description": "World War II evacuation scene at a crowded London train station. Steam and smoke fill the air as children are being sent to the countryside to escape the Blitz.",
"era": "1940s wartime Britain",
"location": "London railway station platform"
},
"characters": ["Mrs. Pevensie", "Lucy Pevensie"],
"camera": {
"type": "Close-up two-shot",
"movement": "Static with subtle handheld movement",
"angle": "Profile view, intimate framing",
"focus": "Both faces in focus, background soft bokeh"
},
"dialogue": [
{
"character": "Mrs. Pevensie",
"text": "You must be brave for me, darling. I'll come for you... I promise."
},
{
"character": "Lucy Pevensie",
"text": "I will be, mother. I promise."
}
],
"audio": [
{
"type": "Train whistle blows (signaling departure)",
"volume": 1
},
{
"type": "Strings swell emotionally, then fade",
"volume": 0.5
},
{
"type": "Ambient sound of the train station",
"volume": 0.5
}
]
}
第三步:使用 image-generation 技能生成参考图像。加载 image-generation 技能,并根据该技能生成单张参考图像 narnia-farewell-scene-01.jpg。
第四步:使用 generate.py 脚本生成视频:
python /mnt/skills/public/video-generation/scripts/generate.py \
--prompt-file /mnt/user-data/workspace/narnia-farewell-scene.json \
--reference-images /mnt/user-data/outputs/narnia-farewell-scene-01.jpg \
--output-file /mnt/user-data/outputs/narnia-farewell-scene-01.mp4 \
--aspect-ratio 16:9
不要读取 Python 文件,只需使用参数调用它。
输出处理
生成后:
- 视频通常保存在 /mnt/user-data/outputs/。
- 使用 present_files 工具与用户分享生成的视频(优先)以及生成的图像(如适用)。
- 提供生成结果的简要描述。
- 如需调整,可提供迭代选项。
注意事项
- 无论用户使用何种语言,提示词始终使用英文。
- JSON 格式确保提示词结构化、可解析。
- 参考图像可显著提升生成质量。
- 迭代优化是获得最佳结果的正常过程。