AI 视频导演技能(v3 — 沙箱与云端就绪)
概述
本技能将原始 talking-head 视频直接根据说话内容转化为紧凑、引人入胜的视频。在 v3 中,默认流程需要零 Python 包安装——它仅使用 Python 标准库 + FFmpeg,使其可直接在 Gemini、Claude 或任何沙箱化代理环境中运行。
核心工作流(零依赖模式 — 默认)
第一步:检测语音与修剪静音
运行 scripts/auto_cut_ffmpeg.py 自动检测静音间隙并生成干净的 suggested_cuts:
python3 scripts/auto_cut_ffmpeg.py --input raw_video.mp4 --output work/cuts.json --noise -30dB --min-silence 0.5
第二步:分析语音并构建 work/edit_plan.json
利用对视频的原生多模态理解(或用户提供的文本),执行以下操作:
- 查看来自
work/cuts.json的suggested_cuts,移除任何误启动或重录部分。 - 识别关键的口头视觉线索(产品、技术术语、优势、步骤),并将其映射到后期剪切时间线上同步的
overlays(image或text)。
编写 work/edit_plan.json:
{
"source_video": "raw_video.mp4",
"cuts": [
{ "start": 0.4, "end": 8.2 },
{ "start": 10.1, "end": 22.5 }
],
"overlays": [
{
"type": "image",
"asset_path": "assets/overlay.png",
"start": 3.5,
"end": 6.0,
"position": "top_right",
"scale_width": 320
},
{
"type": "text",
"text": "关键要点",
"start": 8.5,
"end": 11.0,
"position": "bottom_center"
}
]
}
第三步:渲染最终视频
运行 scripts/render_video.py 以应用剪切、合成叠加、标准化音频(-14 LUFS)并导出最终的 MP4:
python3 scripts/render_video.py --plan work/edit_plan.json --output final_video.mp4
可选的本地增强功能
在安装了 requirements.txt 的本地机器上运行时:
- 词级别转录: 使用
scripts/transcribe_and_cut.py(faster-whisper)代替第一步。 - 背景替换: 在第三步之前运行
scripts/swap_background.py(rembg+u2net_human_seg),并将source_video指向work/swapped.mp4。
护栏规则
- 沙箱优先: 在聊天沙箱内部始终默认使用
auto_cut_ffmpeg.py+render_video.py,以确保技能不会因缺失 pip 包而失败。 - 非破坏性: 切勿覆盖
raw_video.mp4。 - 优雅降级: 如果某个
image叠加文件缺失,跳过它或回退到清晰的text标注。