Skip to content

Reverse-engineer any video, shot by shot: filmed, AI-generated or coded, and how to remake it. Breakdowns in the open VIDEO.md format. 逆向一切视频,逐个镜头看是拍的、AI 生成的还是代码做的,再告诉你怎么复刻;拆解结果按 VIDEO.md 格式输出。

Add a narrative line to the breakdown

june147da6733f8b
diff --git a/rea_video/cli.py b/rea_video/cli.py
index ad89f14..2e4ad46 100644
--- a/rea_video/cli.py
+++ b/rea_video/cli.py
@@ -264,6 +264,12 @@ def cmd_summary(args) -> int:
s = b["summary"]
lines = [f"{b['source']['filename']} | {b['source']['duration']}s {b['source']['width']}x{b['source']['height']} {b['source']['fps']}fps",
f"{T('结论', 'Verdict')}: {s['verdict']}", f"{T('置信度', 'Confidence')}: {s['confidence']}", f"VLM: {s.get('vlm') or vlm_note(b['analysis']['vlm'])}", ""]
+ from . import narrative
+
+ steps = narrative.beats(b)
+ if steps:
+ lines[-1:-1] = [T("叙事线", "Narrative") + ": " + " → ".join(
+ f"#{s['shots'][0]}" + (f"-{s['shots'][-1]}" if len(s['shots']) > 1 else "") + f" {s['role_zh'] or (s['points'] or ['?'])[0][:16]}" for s in steps)]
vc = b.get("video_context") or {}
if vc.get("transcoded"):
lines.append(T("平台转码: {p}(噪声类证据失效;原生 30fps 无重复帧: {n})", "Platform transcode: {p} (noise evidence unusable; native 30fps without duplicate frames: {n})",
diff --git a/rea_video/narrative.py b/rea_video/narrative.py
new file mode 100644
index 0000000..30a938e
--- /dev/null
+++ b/rea_video/narrative.py
@@ -0,0 +1,88 @@
+"""What each shot is doing in the story: grabbing attention, adding information, delivering the conclusion ...
+
+A remake that only swaps the subject keeps someone else's argument. The narrative line is the part worth keeping:
+the order of the steps and what each one is for, to be refilled with the remaker's own cases and material.
+
+Nothing here is measured. A role comes from a reader that followed the whole video: the agent's review
+(`review_answers.json`, per shot `narrative`) or the whole-video VLM pass (`segments[].role` / `beat`, matched
+to shots by time). The agent's answer wins where both exist.
+"""
+from __future__ import annotations
+
+from .i18n import LangDict
+
+ROLE_ZH = LangDict({"hook": "抓注意", "context": "交代背景", "info": "补信息", "proof": "给证据", "turn": "转折",
+ "payoff": "给结论", "cta": "引导行动", "mood": "渲染情绪"},
+ en={"hook": "grab attention", "context": "set the scene", "info": "add information", "proof": "show evidence",
+ "turn": "turn", "payoff": "deliver the conclusion", "cta": "call to action", "mood": "set the mood"})
+ROLES = tuple(ROLE_ZH)
+# one line per role, shared by the VLM prompt and the review instructions so both readers use the same words
+ROLE_GUIDE = ("hook 抓注意(开头的悬念、反差、提问、痛点)|context 交代背景(是谁、在哪、什么情况)|info 补信息(讲解、步骤、卖点、数据)|"
+ "proof 给证据(案例、对比、演示、前后效果)|turn 转折(反转、意外、“但是”)|payoff 给结论(答案、观点、结果揭晓)|"
+ "cta 引导行动(关注、下单、评论)|mood 渲染情绪(空镜、氛围、过渡,不推进信息)")
+
+_ALIASES = {**{v: k for k, v in ROLE_ZH._zh.items()}, **{v: k for k, v in ROLE_ZH._en.items()},
+ "钩子": "hook", "背景": "context", "铺垫": "context", "信息": "info", "证据": "proof", "反转": "turn",
+ "结论": "payoff", "conclusion": "payoff", "行动号召": "cta", "情绪": "mood", "过渡": "mood"}
+
+
+def role_code(v) -> str:
+ """A role as answered (code, Chinese or English label, with stray text around it) -> code, or ""."""
+ s = str(v or "").strip().lower()
+ if s in ROLES:
+ return s
+ if s in _ALIASES:
+ return _ALIASES[s]
+ return next((r for r in ROLES if s.startswith(r)), "") or next((c for a, c in _ALIASES.items() if a in s), "")
+
+
+def clean(v) -> dict | None:
+ """One answer ({"role": ..., "point": ...}) to stored form; None when it says nothing."""
+ if not isinstance(v, dict):
+ return None
+ role = role_code(v.get("role"))
+ point = " ".join(str(v.get("point") or "").split())[:200]
+ return {"role": role, "point": point} if role or point else None
+
+
+def _from_whole(b: dict, start: float, end: float) -> dict | None:
+ best, best_ov = None, 0.0
+ for seg in (b.get("whole_video_vlm") or {}).get("segments") or []:
+ if not isinstance(seg, dict) or not isinstance(seg.get("start"), (int, float)) or not isinstance(seg.get("end"), (int, float)):
+ continue
+ ov = min(end, seg["end"]) - max(start, seg["start"])
+ if ov > best_ov:
+ best, best_ov = seg, ov
+ return clean({"role": best.get("role"), "point": best.get("beat")}) if best else None
+
+
+def shot_roles(b: dict) -> dict[int, dict]:
+ """{shot index: {"role", "role_zh", "point", "source"}} for the shots some reader placed in the story."""
+ out = {}
+ for r in b.get("shots", []):
+ got, src = clean((r.get("review") or {}).get("narrative")), "agent"
+ if not got:
+ got, src = _from_whole(b, r["start"], r["end"]), "vlm"
+ if got:
+ out[r["index"]] = dict(got, role_zh=ROLE_ZH[got["role"]] if got["role"] else "", source=src)
+ return out
+
+
+def beats(b: dict) -> list[dict]:
+ """The narrative line: consecutive shots doing the same job merged into one step, in order."""
+ roles = shot_roles(b)
+ out: list[dict] = []
+ for r in b.get("shots", []):
+ n = roles.get(r["index"])
+ if not n:
+ continue
+ last = out[-1] if out else None
+ if last and last["role"] == n["role"] and last["shots"][-1] == r["index"] - 1 and (n["role"] or last["points"] == [n["point"]]):
+ last["end"] = r["end"]
+ last["shots"].append(r["index"])
+ if n["point"] and n["point"] not in last["points"]:
+ last["points"].append(n["point"])
+ else:
+ out.append({"start": r["start"], "end": r["end"], "shots": [r["index"]], "role": n["role"], "role_zh": n["role_zh"],
+ "points": [n["point"]] if n["point"] else [], "source": n["source"]})
+ return out
diff --git a/rea_video/pipeline.py b/rea_video/pipeline.py
index 84b409c..4a68fb9 100644
--- a/rea_video/pipeline.py
+++ b/rea_video/pipeline.py
@@ -730,6 +730,15 @@ def finalize(breakdown: dict, out: Path, engine: str | None = None) -> dict:
res = {k: v.get("result") for k, v in (rec.get("aspects") or {}).items() if v.get("result")}
rec["replication"]["shoot"] = {"summary": aspects.shot_text(rec), **res}
+ from . import narrative
+
+ told = narrative.shot_roles(breakdown)
+ for rec in shot_records: # rewritten on every finalize: a later review replaces the VLM's reading
+ rec.pop("narrative", None)
+ if rec["index"] in told:
+ rec["narrative"] = told[rec["index"]]
+ breakdown["narrative"] = narrative.beats(breakdown)
+
breakdown["audio_plan"] = merge_audio_with_vlm(audio, breakdown.get("whole_video_vlm"))
if pack:
from .packaging import finalize_pack
diff --git a/rea_video/report.py b/rea_video/report.py
index 2487968..71f9428 100644
--- a/rea_video/report.py
+++ b/rea_video/report.py
@@ -11,7 +11,7 @@ import html
import re
from pathlib import Path
-from . import aspects, entities
+from . import aspects, entities, narrative
from .classify import LABEL_ZH
from .i18n import LangDict, T, join, lang, semi
from .packaging import layer_name, anchor_text
@@ -182,7 +182,7 @@ def _content_md(b: dict) -> list[str]:
if not w and not lines:
L.append(T("- 没有整片的内容概括(需要 VLM 或 agent 看完整片);字幕原文见「剪辑包装层」",
"- No whole-video summary (needs the VLM or an agent watching the full video); subtitle text is under “Packaging layer”"))
- return L
+ return L + _narrative_md(b)
if w.get("summary"):
L.append(T("- 概括:{s}", "- Summary: {s}", s=w["summary"]))
bits = []
@@ -199,6 +199,7 @@ def _content_md(b: dict) -> list[str]:
L += ["", T("**结构时间轴**", "**Structure**")]
L += _table([T("时间", "Time"), T("这一段在做什么", "Beat"), T("文案", "Copy"), T("声音", "Audio")],
[[_span(sg.get("start"), sg.get("end")), sg.get("beat", ""), sg.get("copy", ""), sg.get("audio", "")] for sg in segs])
+ L += _narrative_md(b)
if lines:
n = w.get("narration") or {}
head = T("**脚本**", "**Script**")
@@ -210,6 +211,20 @@ def _content_md(b: dict) -> list[str]:
return L
+def _narrative_md(b: dict) -> list[str]:
+ """The story as a sequence of jobs (hook, information, conclusion ...), each with the point it makes."""
+ steps = narrative.beats(b)
+ if not steps:
+ return ["", T("- 没有叙事线(每个镜头在讲什么:需要 VLM 整片分析,或 agent 看图后在 `review_answers.json` 每镜的 `narrative` 里填)",
+ "- No narrative line (what each shot is doing in the story: needs the VLM whole-video pass, or an agent filling `narrative` per shot in `review_answers.json`)")]
+ L = ["", T("**叙事线**", "**Narrative line**"), "",
+ T("复刻时保留这条线:每一步的顺序和作用照搬,讲的那一点换成自己的案例、数据和素材,就不只是换个主角。",
+ "Keep this line in a remake: same order, same job at each step, with the point refilled from your own cases, numbers and material, so it is more than a change of subject.")]
+ L += _table([T("时间", "Time"), T("镜头", "Shots"), T("作用", "Job"), T("在讲什么", "What it says")],
+ [[_span(s["start"], s["end"]), _shots_str(s["shots"]), s["role_zh"] or "—", semi().join(s["points"])] for s in steps])
+ return L
+
+
def _cast_md(b: dict) -> list[str]:
c = entities.cast(b)
L = ["", T("## 角色、场景与道具", "## Cast, scenes and props"), ""]
@@ -479,14 +494,19 @@ def _remake_md(b: dict) -> list[str]:
def _shotlist_md(b: dict) -> list[str]:
units = _unit_of(b)
+ told = narrative.shot_roles(b)
rows = []
for r in b["shots"]:
base = r["base"]
desc = ((r.get("vlm") or r.get("review") or {}).get("description") or "").replace("\n", " ")
- rows.append([r["index"], fmt_time(r["start"]), f"{r['duration']:.2f}s", f"{base['label_zh']} {base['confidence']:.0%}", _origin(r), _layers(r),
+ n = told.get(r["index"]) or {}
+ says = (n.get("role_zh") or "") + (_colon() if n.get("role_zh") and n.get("point") else "") + (n.get("point") or "")
+ rows.append([r["index"], fmt_time(r["start"]), f"{r['duration']:.2f}s", *([says[:48] + ("…" if len(says) > 48 else "") or "—"] if told else []),
+ f"{base['label_zh']} {base['confidence']:.0%}", _origin(r), _layers(r),
CAMERA_ZH.get(r["features"].get("camera", "unknown"), "—"), desc[:40] + ("…" if len(desc) > 40 else ""), _route(r, units)])
return ["", T("## 分镜表", "## Shot list")] + _table(
- ["#", T("时间", "Time"), T("时长", "Length"), T("底层画面", "Base picture"), T("素材来源", "Material"), T("叠加层", "Overlays"), T("运镜", "Camera"),
+ ["#", T("时间", "Time"), T("时长", "Length"), *([T("在讲什么", "What it says")] if told else []),
+ T("底层画面", "Base picture"), T("素材来源", "Material"), T("叠加层", "Overlays"), T("运镜", "Camera"),
T("画面", "Picture"), T("复刻", "Remake")], rows)
diff --git a/rea_video/review.py b/rea_video/review.py
index 67004c2..b8e849b 100644
--- a/rea_video/review.py
+++ b/rea_video/review.py
@@ -9,7 +9,8 @@ import shlex
import time
from .classify import LABEL_ZH, LABELS, top
-from . import aspects
+from . import aspects, narrative
+from .narrative import ROLE_GUIDE
from .vlm import SHOT_PROMPT, shot_hints
SHOOT_LIKE = ("live_action", "avatar", "stop_motion", "film_footage") # shots where "how was it shot / lit" applies
@@ -57,6 +58,11 @@ video_prompt(复刻该镜头的<PROMPT_LANG>视频提示词:先写景别、
拍摄方式(自拍/支架)、主光是什么光源、眼神光、轮廓光/背景灯、画面里可见的光源;和测量冲突时写明依据。
最后在答案顶层的 aspects 里写整片:机位/场景、推测设备、整体布光、剪辑手法、视频形式。
+每个镜头再填 narrative(这个镜头在讲什么):role 选它在叙事上的作用,point 用一句话写它讲的那一点(去掉具体的人和产品也成立的写法,
+例如"用反常识的数字开场"而不是"说水豚每天睡 12 小时")。先通读 storyboard.jpg 和每镜的 said(这一镜里的字幕)再填,作用是相对整片说的:
+{ROLE_GUIDE}
+报告会把它连成「叙事线」:复刻时保留这条线,把案例和素材换成自己的。
+
答案顶层的 cast 写整片的角色、场景和道具(看 storyboard.jpg 和各镜截图):characters 每个主要角色一条(id 编号、name 称呼、kind person|animal|cartoon|avatar|product|other、
look 外观写到能据此再画出同一个角色、role 作用、voice 音色、shots 出场镜头号);同一个角色在不同镜头要认成同一个。scenes 每个地点一条(id、where、when、look、shots);
props 道具 / 商品 / Logo(name、note、shots);style 一句整体视觉风格与调色。
@@ -112,6 +118,10 @@ def build_tasks(breakdown: dict, out_dir: str) -> tuple[dict, dict]:
pats = patterns()
shots = []
+ said: dict[int, str] = {} # subtitles inside each shot: what the shot says, for its place in the story
+ subs = [c for c in (breakdown.get("packaging") or {}).get("text_cues", []) if c.get("kind") == "subtitle" and c.get("text")]
+ for rec in breakdown["shots"]:
+ said[rec["index"]] = " ".join(c["text"] for c in subs if rec["start"] <= (c["t0"] + c["t1"]) / 2 < rec["end"])[:160]
for rec in breakdown["shots"]:
# only the deterministic layer is shown: the agent should judge independently of any VLM answer
ranked = sorted(rec["deterministic"]["probs"].items(), key=lambda kv: -kv[1])
@@ -132,6 +142,7 @@ def build_tasks(breakdown: dict, out_dir: str) -> tuple[dict, dict]:
"hints": shot_hints(rec["features"], rec["deterministic"]["facts"], dl, dp).split("; 确定性初判=")[0],
**({"aspects": {k: v["result"] for k, v in (rec.get("aspects") or {}).items() if v.get("result")}} if shoot_like else {}),
# the sheet already holds first / middle / last; separate first / last frames would triple the image tokens
+ **({"said": said[rec["index"]]} if said.get(rec["index"]) else {}),
"images": {"sheet": rec["assets"]["sheet"], **({"strip": rec["assets"]["strip"]} if rec["assets"].get("strip") else {})},
"_shoot_like": shoot_like,
})
@@ -173,7 +184,7 @@ def build_tasks(breakdown: dict, out_dir: str) -> tuple[dict, dict]:
tasks["packaging"] = pk_tasks
answers = {"by": "", "shots": [{"id": s["id"], "time": f"{s['start']:.2f}-{s['end']:.2f}",
"label_probs": {}, "image_source": "unknown",
- "evidence": [], "description": "", "embedded_assets": [], "ai_edits": [],
+ "evidence": [], "description": "", "narrative": {"role": "", "point": ""}, "embedded_assets": [], "ai_edits": [],
"replication": {"image_prompt": "", "video_prompt": "", "video_prompt_en": ""},
**({"aspects": aspects.review_template()} if shoot[s["id"]] else {})} for s in shots],
"aspects": aspects.review_template(video=True),
@@ -232,7 +243,7 @@ def _clean(ans: dict) -> tuple[dict | None, str | None]:
return {"label_probs": soft, "raw_probs": {k: round(v / total, 3) for k, v in vals.items()}, "image_source": src,
"evidence": [str(x) for x in (ans.get("evidence") or [])][:8], "description": str(ans.get("description", "")),
"embedded_assets": assets, "replication": rep, "aspects": aspects.clean_answers(ans.get("aspects")),
- "split_suggestion": split,
+ "split_suggestion": split, "narrative": narrative.clean(ans.get("narrative")),
"ai_edits": [{"kind": e["kind"], "evidence": str(e.get("evidence", ""))} for e in (ans.get("ai_edits") or [])
if isinstance(e, dict) and e.get("kind") in EDIT_KINDS]}, None
diff --git a/rea_video/vlm.py b/rea_video/vlm.py
index 229cb9a..f60dbd5 100644
--- a/rea_video/vlm.py
+++ b/rea_video/vlm.py
@@ -327,6 +327,8 @@ WHOLE_PROMPT = """你是短视频拆解专家。完整观看并**仔细收听**
剪辑包装要拆全:字幕之外的花字、标题、章节牌、标签(含跟着物体走的标注)逐个列出时间、样式和动画;
后期贴上去的表情包、GIF 动图、emoji、贴纸、画中画小窗、箭头圈注逐个列出出现/消失时间和位置(画面本身的内容不算)。
角色要跨镜头认成同一个:给每个主要角色(人、动物、卡通形象、数字人、作为主角的商品)一个编号,外观写到能据此把同一个角色再画出来;场景同理(同一地点不同机位算一个场景);道具 / 商品 / Logo 单独列。
+结构要拆出叙事线:segments 每一段除了写 beat(这一段在讲什么,一句话),还要在 role 里选它在叙事上的作用:
+<<NARRATIVE_ROLES>>
已检测到的镜头切分(秒,按顺序即镜头 #1、#2…):{shots}
只返回 JSON:
@@ -334,7 +336,7 @@ WHOLE_PROMPT = """你是短视频拆解专家。完整观看并**仔细收听**
"summary": "一句话概括",
"format": "口播|剧情|商品展示|知识讲解|MV|混剪|影视解说|其他",
"hook": "开头 3 秒如何抓人",
- "segments": [{{"start": 0.0, "end": 3.0, "beat": "这一段在叙事上的作用", "copy": "这一段的旁白/字幕文案", "audio": "人声/音乐/音效"}}],
+ "segments": [{{"start": 0.0, "end": 3.0, "role": "<<NARRATIVE_ENUM>>", "beat": "这一段在讲什么(一句话,换个题材也能照着写的那种)", "copy": "这一段的旁白/字幕文案", "audio": "人声/音乐/音效"}}],
"narration": {{"type": "tts|human|none|mixed", "voice": "性别/年龄感/音色", "style": "语速、情绪、口癖", "language": "zh|en|...",
"lines": [{{"start": 0.0, "end": 2.0, "speaker": "角色编号或 旁白", "text": "台词/旁白原文"}}]}},
"music": {{"present": true, "segments": [{{"start": 0.0, "end": 10.0}}], "style": "风格", "genre": "流派", "mood": "情绪",
@@ -365,6 +367,9 @@ WHOLE_PROMPT = """你是短视频拆解专家。完整观看并**仔细收听**
from .aspects import prompt_block as _aspect_block # noqa: E402
+from .narrative import ROLE_GUIDE as _ROLE_GUIDE, ROLES as _ROLES # noqa: E402
+
+WHOLE_PROMPT = WHOLE_PROMPT.replace("<<NARRATIVE_ROLES>>", _ROLE_GUIDE).replace("<<NARRATIVE_ENUM>>", "|".join(_ROLES))
SHOT_PROMPT = SHOT_PROMPT.replace("<<SHOT_ASPECTS>>", _aspect_block(video=False))
WHOLE_PROMPT = WHOLE_PROMPT.replace("<<VIDEO_ASPECTS>>", _aspect_block(video=True))
diff --git a/skills/rea-video/SKILL.md b/skills/rea-video/SKILL.md
index 4d5753d..415cf23 100644
--- a/skills/rea-video/SKILL.md
+++ b/skills/rea-video/SKILL.md
@@ -43,7 +43,7 @@ rea-video summary out/ref/breakdown.json
```bash
rea-video review out/ref # 写出 review_tasks.json(每镜要看的图、工具判断、优先级)和 review_answers.json(答案模板)
-# 读 review_tasks.json 的 instructions,逐镜看 images 里的图(priority=high 必看),把 label_probs / evidence / description / embedded_assets 填进 review_answers.json;若某镜头实为多刀合并(暗底图形与暗底口播交替时容易被合成一个长镜头),可加 split_suggestion(cuts 切点秒数 + labels 各段类别 + note),报告会在该镜头标注拆分建议,镜头边界本身不变
+# 读 review_tasks.json 的 instructions,逐镜看 images 里的图(priority=high 必看),把 label_probs / evidence / description / narrative / embedded_assets 填进 review_answers.json;narrative 是「这个镜头在讲什么」:role 选叙事作用(抓注意 / 交代背景 / 补信息 / 给证据 / 转折 / 给结论 / 引导行动 / 渲染情绪),point 一句话写它讲的那一点,报告会连成「叙事线」;若某镜头实为多刀合并(暗底图形与暗底口播交替时容易被合成一个长镜头),可加 split_suggestion(cuts 切点秒数 + labels 各段类别 + note),报告会在该镜头标注拆分建议,镜头边界本身不变
# 顶层 cast 填整片的角色 / 场景 / 道具(同一个角色跨镜头认成同一个,外观写到能据此复刻)和一句视觉风格;没开 VLM 时报告的「角色、场景与道具」一节全靠这里
rea-video apply-review out/ref --by <你的名字> # 并入:重写 breakdown.json、report.md、report.html,打印改判了哪些镜头
rea-video summary out/ref/breakdown.json # 用并入后的结果写回复
@@ -80,7 +80,7 @@ rea-video summary out/ref/breakdown.json # 用并入后的结果写回复
## 2. 交付给用户
-按 `references/output-template.md` 回复:先一句话结论,再内容与角色(这条视频讲什么、主要角色和场景),然后复刻方案(按生成单元 / 拍摄场次组织)、分镜表、剪辑包装、声音、真实素材清单、不确定点,最后给 `report.html` 路径。不要把 breakdown.json 贴进对话。
+按 `references/output-template.md` 回复:先一句话结论,再内容与角色(这条视频讲什么、主要角色和场景),叙事线(每一步在抓注意、补信息还是给结论,见 `report.md`「内容与结构」;建议用户保留这条线、换成自己的案例和素材来重写,不只是换个主角),然后复刻方案(按生成单元 / 拍摄场次组织)、分镜表、剪辑包装、声音、真实素材清单、不确定点,最后给 `report.html` 路径。不要把 breakdown.json 贴进对话。
**报告和回复都用用户的语言。**语言的判断顺序:用户明确指定的语言(「用英文出报告」「report in Chinese」)> 用户提问所用的语言 > `rea-video memory` 里的 `lang` 偏好 > 中文。
- 工具支持 `--lang zh` 和 `--lang en`:`decompose` 时就传对,报告文件(`report.html` / `report.md`)、`summary` 输出、VLM 的画面描述和提示词都会是该语言;忘了传可以在 `apply-review out/ref --lang en` 时补上(会重新生成结论和报告文字;VLM 已写好的描述和提示词保持原语言)。看图复核时,`review_answers.json` 里的 evidence / description / prompt 也用这个语言写。
diff --git a/tests/test_report.py b/tests/test_report.py
index 11a779d..523abdb 100644
--- a/tests/test_report.py
+++ b/tests/test_report.py
@@ -161,3 +161,36 @@ def test_open_questions_say_when_nobody_heard_the_sound(breakdown):
b["audio"]["has_audio"] = False
b["analysis"]["vlm"] = {"status": "off", "used": False}
assert not any("声音没有模型听过" in q for q in open_questions(b))
+
+
+def test_narrative_line_from_review_and_whole_video(breakdown):
+ from rea_video import narrative
+
+ b, out = breakdown
+ set_lang("zh")
+ b = json.loads(json.dumps(b))
+ assert "没有叙事线" in markdown(b) and "在讲什么" not in "".join(l for l in markdown(b).split("\n") if l.startswith("| #"))
+ last = b["shots"][-1]
+ b["whole_video_vlm"] = {"segments": [{"start": 0, "end": b["shots"][0]["end"], "role": "抓注意", "beat": "用一张静帧提问"},
+ {"start": b["shots"][0]["end"], "end": last["end"], "role": "info", "beat": "逐条讲解"}]}
+ told = narrative.shot_roles(b)
+ assert told[1]["role"] == "hook" and told[1]["source"] == "vlm" and told[last["index"]]["role"] == "info"
+ tasks, answers = build_tasks(b, str(out))
+ assert "narrative" in answers["shots"][0] and "抓注意" in tasks["instructions"]
+ for a, r in zip(answers["shots"], b["shots"]):
+ a["label_probs"] = {r["base"]["label"]: 1.0}
+ answers["shots"][-1]["narrative"] = {"role": "给结论", "point": "一句话收束观点"}
+ answers["shots"][0]["narrative"] = {"role": "nonsense", "point": ""}
+ apply_answers(b, answers, by="tester")
+ b = finalize(b, out)
+ assert b["shots"][-1]["narrative"] == {"role": "payoff", "point": "一句话收束观点", "role_zh": "给结论", "source": "agent"}
+ assert b["shots"][0]["narrative"]["source"] == "vlm" # an empty review answer leaves the VLM's reading in place
+ assert b["narrative"][0]["role"] == "hook" and b["narrative"][-1]["shots"] == [last["index"]]
+ md = (out / "report.md").read_text(encoding="utf-8")
+ assert "**叙事线**" in md and "给结论" in md and "一句话收束观点" in md
+ assert "在讲什么" in next(l for l in md.split("\n") if l.startswith("| # "))
+ set_lang("en")
+ try:
+ assert narrative.shot_roles(b)[last["index"]]["role_zh"] == "deliver the conclusion"
+ finally:
+ set_lang("zh")