从口播文案生成 scene-scripts.json
何时使用
- 用户提供口播文案(
.txt文件或直接贴文本),要求生成动画脚本 / scene-scripts / 视频分镜 - 用户要求"分析文案"并产出可被 Remotion 管线消费的 JSON
前置准备
- 确认视频名称:向用户确认
name(英文,用作目录名),如认知偏见_达克效应 - 读取配置:从
narrator_pipeline/config.yaml获取以下关键参数:fps(帧率,当前 30)image_style(图片风格描述,写入 image_prompt 类字段时参考)cover_*系列字段(封面信息,后处理注入)
- 输出路径:
src/remotions/{name}/scenes/scene-scripts.json - 预清理:若目标路径已有旧文件,先确认是否覆盖
三阶段工作流
阶段 1:场景拆分 + Topic 生成
将口播全文拆为若干大场景(Scene),并生成封面钩子 topic。
详细规则见 PHASE_1_SCENE_SPLIT.md
输入:口播全文
输出:{ "topic": "...", "scenes": [{ "sceneId", "sceneName", "text" }] }
阶段 2:逐场景分镜 + 模板选型
对每个 scene 的 text 做分镜切分,产出 items,每个 item 选择一个模板。
详细规则见 PHASE_2_ITEM_TEMPLATE.md
模板详情请查阅 scene-scripts-templates skill 的各 references/*.md 子文件。
输入:单个 scene 的 text、topic、sceneName
输出:该 scene 的 items 数组
阶段 3:逐 Item 参数细化
对每个 item,根据其 template 的 param_schema 填充 param 对象。
详细规则见 PHASE_3_PARAM.md
输入:item 的 text、template、所在 scene 全文(上下文)
输出:item 的 param + content 数组
后处理(阶段 3 完成后)
完成三阶段分析后,对整份 JSON 执行以下后处理:
- 清理临时字段:删除 scene 级
text、item 级text - content 归一化:每条 content 仅保留
{ "text": "..." },不写 startFrame/durationFrames(留给 Step2 音频处理) - 锚点清洗:
- 非 TEXT_FOCUS 模板:校验
param.anchors,showFrom必须是 content 数组的合法 0-based 下标,text非空 - TEXT_FOCUS 模板:不使用
anchors,使用coreSentenceAnchors,每项coreSentenceAnchor必须是coreSentence拼接后的子串
- 非 TEXT_FOCUS 模板:校验
- 注入 fps:顶层写入
"fps": 30(或 config 中的值) - 注入 cover:按
narrator_pipeline/config.yaml中的cover_*字段注入顶层cover对象(详见 OUTPUT_FORMAT.md) - param 禁止字段:
param内不得出现content或totalDurationFrames(这两者只属于 item 顶层)
输出格式
最终 JSON 结构规范与完整示例见 OUTPUT_FORMAT.md
校验
生成完成后,按 VALIDATION_RULES.md 自查。
也可运行校验脚本(从项目根目录执行):
python -m narrator_pipeline.cli.validate_scene_scripts src/remotions/{name}/scenes/scene-scripts.json
硬性约束(全流程必须遵守)
- 原文零修改:所有 item 的 content[].text 拼接后,必须与口播原文完全一致(允许忽略空白差异)。严禁修改、缩写、重新措辞
- 完整覆盖:所有 scene 的所有 item 的 content 拼合,必须 100% 覆盖口播全文,不遗漏、不重叠
- 换行保留:原文中的段落分隔必须以
\n保留在对应位置 - 模板合法:
template必须来自 scene-scripts-templates skill 定义的合法模板列表 - 分场景输出:为避免单次输出过大,按 scene 逐步生成,每完成一个 scene 的全部 items + params 后再处理下一个
与 Python 管线的关系
本 skill 替代 narrator_pipeline 分析域(Step1)的 Gemini AI 分析环节。后续步骤:
- Step2(TTS):
python -m narrator_pipeline.audio.step2 --name {name} - Step3(生图):
python -m narrator_pipeline.images.step3 --name {name} - Step4(代码生成):
python -m narrator_pipeline.codegen.step4 --name {name}