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 格式输出。
Python agent-skillsai-videoaigc-detectionclaude-codecodexffmpegprompt-engineeringremotionreverse-engineeringshort-videoshot-detectionsubtitlesvideo-analysisvideo-breakdownvideo-editingvideo-generationvideomdvlm
report: 加 --lang zh|en,报告、结论、summary 和 VLM 描述跟用户语言走
june8d1dced9d773
diff --git a/docs/cli.md b/docs/cli.mdindex 470c905..f5e1ca3 100644--- a/docs/cli.md+++ b/docs/cli.md@@ -82,11 +82,11 @@ rea-video capsule-draft out/ref/breakdown.json --capsule-root $CC --capsule-name| 命令 | 作用 ||---|---|-| `decompose VIDEO [--vlm] [--no-ocr] [--ocr-lang zh\|ja] [--no-packaging]` | 拆解,输出 breakdown.json、report.html/md、storyboard.jpg、每镜首尾帧,以及 `packaging/`(字幕 SRT、带样式的 ASS、包装时间轴、贴纸截图);`--no-packaging` 跳过包装层(省约每分钟 30–50 秒);`--ocr-lang ja` 用日文识别模型读字幕和花字(首次使用自动下载约 10 MB 到 `$REA_VIDEO_MODELS`,离线时可用 `$REA_OCR_REC_MODEL` 指向本地模型),`rea-video prefs ocr_lang ja` 可设成默认 |+| `decompose VIDEO [--vlm] [--no-ocr] [--ocr-lang zh\|ja] [--lang zh\|en] [--no-packaging]` | 拆解,输出 breakdown.json、report.html/md、storyboard.jpg、每镜首尾帧,以及 `packaging/`(字幕 SRT、带样式的 ASS、包装时间轴、贴纸截图);`--lang en` 让结论、报告、`summary` 输出和 VLM 描述都用英文(默认中文;agent 按用户提问的语言选,`rea-video prefs lang en` 可设成默认;breakdown.json 里的 `*_zh` 字段名保留,内容跟报告语言走);`--no-packaging` 跳过包装层(省约每分钟 30–50 秒);`--ocr-lang ja` 用日文识别模型读字幕和花字(首次使用自动下载约 10 MB 到 `$REA_VIDEO_MODELS`,离线时可用 `$REA_OCR_REC_MODEL` 指向本地模型),`rea-video prefs ocr_lang ja` 可设成默认 || `review OUT_DIR` | 给能看图的 agent 生成逐镜看图任务(review_tasks.json)和答案模板(review_answers.json) |-| `apply-review OUT_DIR [ANSWERS] [--by NAME]` | 把 agent 看图的答案和确定性结果融合,重写 breakdown.json 和报告 |+| `apply-review OUT_DIR [ANSWERS] [--by NAME] [--lang zh\|en]` | 把 agent 看图的答案和确定性结果融合,重写 breakdown.json 和报告;`--lang` 可以在这一步换报告语言(结论、证据和报告文字重新生成,VLM 已写好的描述和提示词保持原语言) || `correct OUT_DIR --shots N --label L [--real yes/no] [--note]` | 用户指出判错:改正结论和报告,并记入记忆(以后同一文件自动套用,同类镜头复核时提示) |-| `prefs [KEY VALUE] [--note TEXT]` | 用户偏好:默认引擎、是否默认开 VLM、VLM 配置文件、复核者名字、给 agent 的自由文字说明 |+| `prefs [KEY VALUE] [--note TEXT]` | 用户偏好:默认引擎、是否默认开 VLM、VLM 配置文件、复核者名字、报告语言(`lang zh\|en`)、给 agent 的自由文字说明 || `memory [--export-labels YAML]` | 看记住了什么(偏好、常见纠正类型);把纠正导出成评测样本 || `probe VIDEO` | 只看元数据线索(拍摄设备、AIGC 隐式标识、C2PA、编辑器签名) || `summary breakdown.json` | 紧凑打印结论,标出需要复核的低置信镜头 |diff --git a/rea_video/aspects/__init__.py b/rea_video/aspects/__init__.pyindex f2cac26..da7f670 100644--- a/rea_video/aspects/__init__.py+++ b/rea_video/aspects/__init__.py@@ -8,6 +8,8 @@ from __future__ import annotationsimport htmlimport json+from ..i18n import T, semi+from . import framing, camera, lighting, grade, editing, fmt # noqa: F401 (registration order matters)from .base import FILMED, PHOTOGRAPHIC, REGISTRY, ShotCtx, getfrom .subject import subject@@ -58,7 +60,7 @@ def review_guide() -> str:lines = []for a in REGISTRY:for f in a.shot_fields:- lines.append(f" {a.key}.{f.key}({f.zh}):{f.question}")+ lines.append(T(" {a}.{f}({l}):{q}", " {a}.{f} ({l}): {q}", a=a.key, f=f.key, l=f.zh, q=f.question))return "\n".join(lines)@@ -106,14 +108,15 @@ def shooting_plan(b: dict) -> dict:fr, cam, li, ed, fo = (A.get(k) or {} for k in ("framing", "camera", "lighting", "editing", "format"))steps = []if fo:- steps.append(f"形式:{fo['lines'][0].split(':', 1)[1].split('(')[0]}")+ steps.append(T("形式:{f}", "Format: {f}", f=fmt.FORMAT_ZH[fo["result"]["format"]].split("(")[0].split(" (")[0]))if fr.get("result", {}).get("shot_size"):- steps.append(f"取景:以{fr['result']['shot_size']}为主" + (f",{fr['result']['camera_angle']}" if fr["result"].get("camera_angle") else ""))+ steps.append(T("取景:以{s}为主", "Framing: mostly {s}", s=fr["result"]["shot_size"])+ + (T(",{a}", ", {a}", a=fr["result"]["camera_angle"]) if fr["result"].get("camera_angle") else ""))if cam.get("lines"):steps.append(cam["lines"][0])st = li.get("setup") or {}if st:- steps.append(f"布光:{st['name']}——{st['detail']}")+ steps.append(T("布光:{n}——{d}", "Lighting: {n} — {d}", n=st["name"], d=st["detail"]))if ed.get("lines"):steps.append(ed["lines"][0])return {"steps": steps, "gear": st.get("gear", [])}@@ -141,9 +144,9 @@ def shot_text(r: dict) -> str:asp = r.get("aspects") or {}fr, cam, li = ((asp.get(k) or {}).get("result") or {} for k in ("framing", "camera", "lighting"))parts = [fr.get("shot_size"), fr.get("camera_angle"), cam.get("support_zh"),- li.get("setup_name"), li.get("key_direction") and f"主光{li['key_direction']}", li.get("ratio") and f"光比{li['ratio']}",- li.get("quality")]- return ";".join(p for p in parts if p)+ li.get("setup_name"), li.get("key_direction") and T("主光{k}", "key light {k}", k=li["key_direction"]),+ li.get("ratio") and T("光比{r}", "lighting ratio {r}", r=li["ratio"]), li.get("quality")]+ return semi().join(p for p in parts if p)# ---------------------------------------------------------------- report -----------------------------------------@@ -151,12 +154,12 @@ def shot_text(r: dict) -> str:def _src(row: dict) -> str:bits = []if row.get("measured") not in (None, ""):- bits.append(f"测量:{row['measured']}")+ bits.append(T("测量:{v}", "measured: {v}", v=row["measured"]))if row.get("vlm"):- bits.append(f"VLM:{row['vlm']}")+ bits.append(T("VLM:{v}", "VLM: {v}", v=row["vlm"]))if row.get("agent"):- bits.append(f"看图:{row['agent']}")- return ";".join(bits)+ bits.append(T("看图:{v}", "agent review: {v}", v=row["agent"]))+ return semi().join(bits)def report_md(b: dict) -> list[str]:@@ -164,22 +167,25 @@ def report_md(b: dict) -> list[str]:if not any(A.get(a.key) for a in REGISTRY):return []li = A.get("lighting") or {}- L = ["", "## 拍法、打光与剪辑", ""]+ L = ["", T("## 拍法、打光与剪辑", "## Camera, lighting and editing"), ""]L += [f"- {x}" for x in summary_lines(b)]plan = b.get("shooting_plan") or {}if plan:- L += ["", "**复刻拍摄方案**", ""] + [f"{i}. {s}" for i, s in enumerate(plan["steps"], 1)]+ L += ["", T("**复刻拍摄方案**", "**Shooting plan for the remake**"), ""] + [f"{i}. {s}" for i, s in enumerate(plan["steps"], 1)]if plan.get("gear"):- L += ["", "器材:"] + [f"- {g}" for g in plan["gear"]]+ L += ["", T("器材:", "Gear:")] + [f"- {g}" for g in plan["gear"]]if (li.get("setup") or {}).get("notes"):- L += [f"- 注意:{n}" for n in li["setup"]["notes"]]+ L += [T("- 注意:{n}", "- Note: {n}", n=n) for n in li["setup"]["notes"]]rows = [(a, r) for a in REGISTRY for r in (A.get(a.key) or {}).get("fields", [])]if rows:- L += ["", "| 维度 | 项目 | 结论 | 来源 |", "|---|---|---|---|"]+ L += ["", T("| 维度 | 项目 | 结论 | 来源 |", "| Aspect | Item | Verdict | Sources |"), "|---|---|---|---|"]for a, r in rows:L.append(f"| {a.title} | {r['zh']} | {str(r['final']).replace('|', '/')} | {_src(r).replace('|', '/')} |")- L += ["", "- 说明:光比、软硬、色温、景别由主体像素测得(有人脸用人脸,没有用画面清晰区域,后者是估算);平台转码会压暗部,软硬和补光偏保守;"- "机位角度、光源种类、眼神光、轮廓光以看图结果为准。测量和看图不一致时两者都列出。"]+ L += ["", T("- 说明:光比、软硬、色温、景别由主体像素测得(有人脸用人脸,没有用画面清晰区域,后者是估算);平台转码会压暗部,软硬和补光偏保守;"+ "机位角度、光源种类、眼神光、轮廓光以看图结果为准。测量和看图不一致时两者都列出。",+ "- Note: lighting ratio, soft / hard, colour temperature and shot size are measured on the subject's pixels (the face when there is one, "+ "otherwise the in-focus region, which is an estimate); platform transcodes crush the shadows, so hardness and fill read conservative; "+ "camera angle, light source, catchlight and rim light follow the image readers. Where measurement and readers disagree, both are listed.")]return L@@ -192,9 +198,9 @@ def report_html(b: dict) -> str:plan = b.get("shooting_plan") or {}plan_html = ""if plan:- plan_html = ("<h4>复刻拍摄方案</h4><ol>" + "".join(f"<li>{esc(s)}</li>" for s in plan["steps"]) + "</ol>"- + ("<h4>器材</h4><ul>" + "".join(f"<li>{esc(g)}</li>" for g in plan.get("gear", [])) + "</ul>" if plan.get("gear") else ""))+ plan_html = (f"<h4>{T('复刻拍摄方案', 'Shooting plan for the remake')}</h4><ol>" + "".join(f"<li>{esc(s)}</li>" for s in plan["steps"]) + "</ol>"+ + (f"<h4>{T('器材', 'Gear')}</h4><ul>" + "".join(f"<li>{esc(g)}</li>" for g in plan.get("gear", [])) + "</ul>" if plan.get("gear") else ""))rows = "".join(f"<tr><td>{esc(a.title)}</td><td>{esc(r['zh'])}</td><td>{esc(str(r['final']))}</td><td class='muted'>{esc(_src(r))}</td></tr>"for a in REGISTRY for r in (A.get(a.key) or {}).get("fields", []))table = f"<table style='width:100%;font-size:13px;border-collapse:collapse'>{rows}</table>" if rows else ""- return f"<section class='shot'><h3 style='margin:4px 0'>拍法、打光与剪辑</h3><ul>{items}</ul>{plan_html}{table}</section>"+ return f"<section class='shot'><h3 style='margin:4px 0'>{T('拍法、打光与剪辑', 'Camera, lighting and editing')}</h3><ul>{items}</ul>{plan_html}{table}</section>"diff --git a/rea_video/aspects/base.py b/rea_video/aspects/base.pyindex 968273b..8788712 100644--- a/rea_video/aspects/base.py+++ b/rea_video/aspects/base.py@@ -20,6 +20,8 @@ from dataclasses import dataclass, fieldimport numpy as np+from ..i18n import T+# shots whose picture is photographic enough for camera / light analysis. Live action gets a shooting plan; AI, 3D# and avatar shots get the same measurements as a description of the picture (useful for generation prompts).PHOTOGRAPHIC = ("live_action", "avatar", "ai_video", "cg_3d", "stop_motion")@@ -29,9 +31,10 @@ FILMED = ("live_action", "avatar", "stop_motion")@dataclassclass Field:key: str- zh: str+ zh: str # label; reads as `en` when the report language is English (see _lang_attr)question: str # shown to the VLM / reviewer; empty = measured onlyprefer: str = "measured" # "measured" | "seen"+ en: str = ""@dataclass@@ -46,7 +49,8 @@ class ShotCtx:@dataclassclass Aspect:key: str = ""- title: str = ""+ title: str = "" # reads as `title_en` when the report language is English+ title_en: str = ""shot_fields: list[Field] = field(default_factory=list)video_fields: list[Field] = field(default_factory=list)@@ -71,6 +75,19 @@ class Aspect:return out+def _lang_attr(cls, name: str, en_name: str) -> None:+ """Make `cls.<name>` (set once, in Chinese) read as `cls.<en_name>` when the report language is English."""+ def get(self):+ return T(self.__dict__[name], self.__dict__.get(en_name) or None)++ def set(self, v):+ self.__dict__[name] = v+ setattr(cls, name, property(get, set))+++_lang_attr(Field, "zh", "en")+_lang_attr(Aspect, "title", "title_en")+REGISTRY: list[Aspect] = []@@ -92,7 +109,7 @@ def seen(shot: dict, aspect: str, field_key: str) -> dict[str, str]:for src, rk in (("agent", "review"), ("vlm", "vlm")):r = shot.get(rk) or {}v = ((r.get("aspects") or {}).get(aspect) or {}).get(field_key) or (r.get("cinematography") or {}).get(field_key)- if v and str(v).strip() not in ("不适用", "unknown", "无法判断"):+ if v and str(v).strip().lower() not in ("不适用", "unknown", "无法判断", "n/a", "not applicable"):out[src] = str(v).strip()return outdiff --git a/rea_video/aspects/camera.py b/rea_video/aspects/camera.pyindex 622597f..2709b9d 100644--- a/rea_video/aspects/camera.py+++ b/rea_video/aspects/camera.py@@ -5,22 +5,25 @@ jittery translation = handheld, smooth translation = moving rig or careful handhare the image readers' call (perspective distortion, depth of field, picture quality)."""from __future__ import annotations+from ..i18n import LangDict, T, join, semi+from .base import FILMED, PHOTOGRAPHIC, Aspect, Field, ShotCtx, field_table, register, seen, weighted_modeSUPPORT = {"handheld_like": "handheld", "smooth_move": "moving", "static": "fixed", "static_with_subject_motion": "fixed","planar_zoom_pan": "fixed"}-SUPPORT_ZH = {"handheld": "手持", "moving": "移动机位(稳定器/手持平移)", "fixed": "固定机位(三脚架/支架/放在桌上)"}+SUPPORT_ZH = LangDict({"handheld": "手持", "moving": "移动机位(稳定器/手持平移)", "fixed": "固定机位(三脚架/支架/放在桌上)"},+ en={"handheld": "handheld", "moving": "moving camera (gimbal / handheld pan)", "fixed": "fixed camera (tripod / mount / on the desk)"})class Camera(Aspect):def __init__(self):- super().__init__(key="camera", title="机位", shot_fields=[- Field("camera_support", "拍摄方式", "手持自拍(前置镜头)|他人手持|三脚架/支架固定|稳定器|桌面俯拍支架|无法判断", prefer="seen"),- Field("lens", "镜头", "手机前置广角|手机后置主摄|手机长焦|相机人像/长焦|无法判断(依据:透视变形、背景虚化)", prefer="seen"),- Field("speed", "速度", "正常|慢动作|延时摄影|变速(先快后慢等)|倒放;依据(水花、头发、人流、云的运动)", prefer="seen"),+ super().__init__(key="camera", title="机位", title_en="Camera", shot_fields=[+ Field("camera_support", "拍摄方式", "手持自拍(前置镜头)|他人手持|三脚架/支架固定|稳定器|桌面俯拍支架|无法判断", prefer="seen", en="camera support"),+ Field("lens", "镜头", "手机前置广角|手机后置主摄|手机长焦|相机人像/长焦|无法判断(依据:透视变形、背景虚化)", prefer="seen", en="lens"),+ Field("speed", "速度", "正常|慢动作|延时摄影|变速(先快后慢等)|倒放;依据(水花、头发、人流、云的运动)", prefer="seen", en="speed"),], video_fields=[- Field("setups", "机位/场景", "一共几个场景、几个机位,各拍什么", prefer="seen"),- Field("gear_guess", "推测设备", "手机/相机档次、稳定器、麦克风(领夹麦/机顶麦)、补光灯等,写依据", prefer="seen"),+ Field("setups", "机位/场景", "一共几个场景、几个机位,各拍什么", prefer="seen", en="set-ups / locations"),+ Field("gear_guess", "推测设备", "手机/相机档次、稳定器、麦克风(领夹麦/机顶麦)、补光灯等,写依据", prefer="seen", en="likely gear"),])def measure(self, ctx: ShotCtx) -> dict:@@ -29,9 +32,9 @@ class Camera(Aspect):move = Nonez, pan = f.get("zoom_per_s", 0.0) or 0.0, f.get("pan_px_per_s", 0.0) or 0.0if abs(z) > 0.01:- move = "推" if z > 0 else "拉"+ move = T("推", "push-in") if z > 0 else T("拉", "pull-out")elif pan > 6:- move = "摇/移"+ move = T("摇/移", "pan / track")return {"support": SUPPORT.get(cam), "motion": cam, "move": move,"shake": round(float(f.get("sign_flip_rate", 0.0) or 0.0), 3)}@@ -51,10 +54,10 @@ class Camera(Aspect):second = sorted(shares.items(), key=lambda kv: -kv[1])[1:2]support = "mixed" if second and second[0][1] >= 0.3 else supmoves, _ = weighted_mode([(res[r["index"]].get("move"), r["duration"]) for r in main])- text = "、".join(f"{SUPPORT_ZH.get(k, k)} {v:.0%}" for k, v in shares.items())- lines = [f"机位:{text or '未测出'}" + (f";常见运镜 {moves}" if moves else "")]+ text = join(f"{SUPPORT_ZH.get(k, k)} {v:.0%}" for k, v in shares.items())+ lines = [T("机位:{t}", "Camera: {t}", t=text or T("未测出", "not measured")) + (semi() + T("常见运镜 {m}", "typical move {m}", m=moves) if moves else "")]return {"result": {"support": support}, "support_shares": shares, "lines": lines,- "fields": field_table(self, main, b, {"camera_support": SUPPORT_ZH.get(support, "混合:" + text) if support else None})}+ "fields": field_table(self, main, b, {"camera_support": SUPPORT_ZH.get(support, T("混合:", "mixed: ") + text) if support else None})}register(Camera())diff --git a/rea_video/aspects/editing.py b/rea_video/aspects/editing.pyindex 12e953f..530725c 100644--- a/rea_video/aspects/editing.py+++ b/rea_video/aspects/editing.py@@ -10,6 +10,8 @@ from __future__ import annotationsimport cv2import numpy as np+from ..i18n import T, semi+from .base import FILMED, Aspect, Field, ShotCtx, field_table, registerSAME_POSITION = 18.0 # mean |diff| of 0..255 BGR cells of the 6x10 background layout@@ -48,8 +50,8 @@ def _in_gap(t: float, segs: list, tol: float = 0.25) -> bool:class Editing(Aspect):def __init__(self):- super().__init__(key="editing", title="剪辑", video_fields=[- Field("editing", "剪辑手法", "剪气口/跳切、推近放大、多机位切换、插入截图/素材的节奏、转场、卡点", prefer="seen"),+ super().__init__(key="editing", title="剪辑", title_en="Editing", video_fields=[+ Field("editing", "剪辑手法", "剪气口/跳切、推近放大、多机位切换、插入截图/素材的节奏、转场、卡点", prefer="seen", en="editing style"),])def measure(self, ctx: ShotCtx) -> dict:@@ -65,7 +67,8 @@ class Editing(Aspect):out = {"cuts_per_min": round(max(0, len(shots) - 1) / (total / 60), 1), "avg_shot_s": round(total / max(1, len(shots)), 2),"filmed_share": round(f_dur / total, 3), "insert_share": round(1 - f_dur / total, 3)}if not filmed:- out["lines"] = [f"剪辑:每分钟 {out['cuts_per_min']} 刀,平均镜头 {out['avg_shot_s']}s;没有实拍镜头"]+ out["lines"] = [T("剪辑:每分钟 {c} 刀,平均镜头 {a}s;没有实拍镜头", "Editing: {c} cuts per minute, {a}s average shot; no live-action shots",+ c=out["cuts_per_min"], a=out["avg_shot_s"])]out["result"] = {}return outcenters: list[list[float]] = []@@ -102,12 +105,15 @@ class Editing(Aspect):avg_filmed_shot_s=round(f_dur / len(filmed), 2), jump_cuts=jump, punch_ins=punch,filmed_joins=joins, cuts_in_pauses=round(in_gap / joins, 3) if joins and voice else None,beat_synced=bool((b.get("audio") or {}).get("beat_synced_edit")))- line = (f"剪辑:每分钟 {out['cuts_per_min']} 刀,实拍镜头平均 {out['avg_filmed_shot_s']}s;机位/场景 {n_pos} 个;"- f"同机位跳切 {jump} 处、推近切 {punch} 处;插入画面(截图/录屏/卡片/素材)占 {out['insert_share']:.0%}")+ line = T("剪辑:每分钟 {c} 刀,实拍镜头平均 {a}s;机位/场景 {n} 个;同机位跳切 {j} 处、推近切 {p} 处;插入画面(截图/录屏/卡片/素材)占 {i:.0%}",+ "Editing: {c} cuts per minute, {a}s average live-action shot; {n} camera set-up(s) / location(s); {j} jump cut(s) and {p} punch-in(s) "+ "within the same set-up; inserts (screenshots / screen recordings / cards / stock) take {i:.0%}",+ c=out["cuts_per_min"], a=out["avg_filmed_shot_s"], n=n_pos, j=jump, p=punch, i=out["insert_share"])if out["cuts_in_pauses"] is not None and joins >= 3:- line += f";{out['cuts_in_pauses']:.0%} 的切点落在说话停顿处" + ("(剪气口)" if out["cuts_in_pauses"] >= 0.6 else "")+ line += (semi() + T("{r:.0%} 的切点落在说话停顿处", "{r:.0%} of cuts land in pauses of the speech", r=out["cuts_in_pauses"])+ + (T("(剪气口)", " (cutting on breaths)") if out["cuts_in_pauses"] >= 0.6 else ""))if out["beat_synced"]:- line += ";切镜卡在音乐节拍上"+ line += semi() + T("切镜卡在音乐节拍上", "cuts land on the music beat")out["lines"] = [line]out["result"] = {"positions": n_pos, "jump_cuts": jump > 0}out["fields"] = field_table(self, filmed, b, {})diff --git a/rea_video/aspects/fmt.py b/rea_video/aspects/fmt.pyindex cbb4cdb..fed0d39 100644--- a/rea_video/aspects/fmt.py+++ b/rea_video/aspects/fmt.py@@ -8,16 +8,22 @@The image readers' answer to `format` wins when present."""from __future__ import annotations+from ..i18n import LangDict, T, join, semi+from .base import FILMED, Aspect, Field, field_table, register, video_seen-FORMAT_ZH = {"talking_head": "人物口播", "desk": "桌面/物品拍摄(桌拍)", "product": "手持拍物品(开箱/带货/第一视角)",- "vlog": "vlog 随拍", "other": "其他实拍"}+FORMAT_ZH = LangDict({"talking_head": "人物口播", "desk": "桌面/物品拍摄(桌拍)", "product": "手持拍物品(开箱/带货/第一视角)",+ "vlog": "vlog 随拍", "other": "其他实拍"},+ en={"talking_head": "talking head", "desk": "tabletop / object shoot", "product": "handheld product shots (unboxing / selling / POV)",+ "vlog": "vlog", "other": "other live footage"})+# camera-angle answers (either language) that mean the camera looks down at a desk+ABOVE_WORDS = ("顶拍", "俯拍", "top-down", "top down", "overhead", "high angle", "high-angle", "bird")class Format(Aspect):def __init__(self):- super().__init__(key="format", title="形式", video_fields=[- Field("format", "视频形式", "单人口播|访谈|桌面俯拍/开箱/教程|vlog 跟拍|商品展示|剧情|无实拍", prefer="seen"),+ super().__init__(key="format", title="形式", title_en="Format", video_fields=[+ Field("format", "视频形式", "单人口播|访谈|桌面俯拍/开箱/教程|vlog 跟拍|商品展示|剧情|无实拍", prefer="seen", en="video format"),])def summarize(self, shots: list[dict], b: dict) -> dict:@@ -34,7 +40,7 @@ class Format(Aspect):face = share(lambda r: asp(r, "framing").get("subject") == "face")focus = share(lambda r: asp(r, "framing").get("subject") == "focus")- from_above = share(lambda r: any(w in (asp(r, "framing").get("camera_angle") or "") for w in ("顶拍", "俯拍")))+ from_above = share(lambda r: any(w in (asp(r, "framing").get("camera_angle") or "").lower() for w in ABOVE_WORDS))fixed = share(lambda r: asp(r, "camera").get("support") == "fixed")handheld = share(lambda r: asp(r, "camera").get("support") in ("handheld", "moving"))speech = bool(((b.get("audio") or {}).get("voice") or {}).get("present"))@@ -50,8 +56,9 @@ class Format(Aspect):else:kind = "other"seen = video_seen(b, self.key, "format")- lines = [f"形式:{FORMAT_ZH[kind]}(人脸为主体 {face:.0%}、物品/手为主体 {focus:.0%}、手持 {handheld:.0%})"- + (f";看图判断:{seen.get('agent') or seen.get('vlm')}" if seen else "")]+ lines = [T("形式:{f}(人脸为主体 {a:.0%}、物品/手为主体 {b:.0%}、手持 {c:.0%})", "Format: {f} (face as subject {a:.0%}, objects / hands as subject {b:.0%}, handheld {c:.0%})",+ f=FORMAT_ZH[kind], a=face, b=focus, c=handheld)+ + (semi() + T("看图判断:{s}", "image readers: {s}", s=seen.get("agent") or seen.get("vlm")) if seen else "")]return {"result": {"format": kind}, "shares": {"face": round(face, 3), "focus": round(focus, 3), "from_above": round(from_above, 3),"fixed": round(fixed, 3), "handheld": round(handheld, 3)},"lines": lines, "fields": field_table(self, filmed, b, {"format": FORMAT_ZH[kind]})}diff --git a/rea_video/aspects/framing.py b/rea_video/aspects/framing.pyindex a95a102..af53341 100644--- a/rea_video/aspects/framing.py+++ b/rea_video/aspects/framing.py@@ -7,18 +7,23 @@ from __future__ import annotationsimport numpy as np+from ..i18n import LangDict, T, join, semi+from .base import FILMED, PHOTOGRAPHIC, Aspect, Field, ShotCtx, field_table, register, seen, weighted_mode+SIZES = LangDict({"ecu": "大特写", "cu": "特写", "mcu": "近景", "ms": "中景", "fs": "全景", "ls": "远景"},+ en={"ecu": "extreme close-up", "cu": "close-up", "mcu": "medium close-up", "ms": "medium shot", "fs": "full shot",+ "ls": "wide shot"})# face height / frame height-FACE_SIZES = [(0.40, "大特写"), (0.25, "特写"), (0.14, "近景"), (0.08, "中景"), (0.04, "全景"), (0.0, "远景")]+FACE_SIZES = [(0.40, "ecu"), (0.25, "cu"), (0.14, "mcu"), (0.08, "ms"), (0.04, "fs"), (0.0, "ls")]# in-focus subject area / frame area-AREA_SIZES = [(0.45, "特写"), (0.22, "近景"), (0.08, "中景"), (0.0, "全景")]+AREA_SIZES = [(0.45, "cu"), (0.22, "mcu"), (0.08, "ms"), (0.0, "fs")]def size_from(table, v: float | None) -> str | None:if v is None:return None- return next(name for th, name in table if v >= th)+ return SIZES[next(name for th, name in table if v >= th)]def shot_size(face_h: float | None) -> str | None:@@ -27,10 +32,10 @@ def shot_size(face_h: float | None) -> str | None:class Framing(Aspect):def __init__(self):- super().__init__(key="framing", title="取景", shot_fields=[- Field("shot_size", "景别", "特写|近景|中景|全景|远景(按画面主体,人物按头肩/半身/全身)"),- Field("camera_angle", "机位角度", "平视|略俯拍|俯拍|顶拍(正上方俯拍桌面)|略仰拍|仰拍", prefer="seen"),- Field("composition", "构图", "主体位置与留白(居中/三分线/对称/框中框),竖屏还是横屏", prefer="seen"),+ super().__init__(key="framing", title="取景", title_en="Framing", shot_fields=[+ Field("shot_size", "景别", "特写|近景|中景|全景|远景(按画面主体,人物按头肩/半身/全身)", en="shot size"),+ Field("camera_angle", "机位角度", "平视|略俯拍|俯拍|顶拍(正上方俯拍桌面)|略仰拍|仰拍", prefer="seen", en="camera angle"),+ Field("composition", "构图", "主体位置与留白(居中/三分线/对称/框中框),竖屏还是横屏", prefer="seen", en="composition"),])def measure(self, ctx: ShotCtx) -> dict:@@ -53,7 +58,7 @@ class Framing(Aspect):elif kind == "focus":out["shot_size"] = size_from(AREA_SIZES, area)out["shot_size_rough"] = True- out["position"] = "居中" if abs(cx - 0.5) < 0.12 else ("偏左" if cx < 0.5 else "偏右")+ out["position"] = T("居中", "centred") if abs(cx - 0.5) < 0.12 else (T("偏左", "left of centre") if cx < 0.5 else T("偏右", "right of centre"))return outdef interpret(self, shot: dict) -> dict:@@ -73,10 +78,11 @@ class Framing(Aspect):size, sizes = weighted_mode([(res[r["index"]].get("shot_size"), r["duration"]) for r in main])angle, angles = weighted_mode([(res[r["index"]].get("camera_angle"), r["duration"]) for r in main])subj, subjects = weighted_mode([(res[r["index"]].get("subject"), r["duration"]) for r in main])- lines = [f"取景:景别 " + ("、".join(f"{k} {v:.0%}" for k, v in list(sizes.items())[:3] if v >= 0.01) or "未测出")- + (f";机位角度 {angle}" if angle else "")- + {"face": ";主体是人脸(按脸高算景别)", "focus": ";主体是画面清晰区域(没有人脸,景别为估算)",- "frame": ";没找到明确主体"}.get(subj, "")]+ lines = [T("取景:景别 ", "Framing: shot size ") + (join(f"{k} {v:.0%}" for k, v in list(sizes.items())[:3] if v >= 0.01) or T("未测出", "not measured"))+ + (semi() + T("机位角度 {a}", "camera angle {a}", a=angle) if angle else "")+ + {"face": semi() + T("主体是人脸(按脸高算景别)", "subject is a face (shot size from face height)"),+ "focus": semi() + T("主体是画面清晰区域(没有人脸,景别为估算)", "subject is the in-focus region (no face; shot size is an estimate)"),+ "frame": semi() + T("没找到明确主体", "no clear subject found")}.get(subj, "")]return {"result": {"shot_size": size, "camera_angle": angle, "subject": subj},"shot_sizes": sizes, "angles": angles, "subjects": subjects, "seconds": round(tot, 2), "lines": lines,"fields": field_table(self, main, b, {"shot_size": size})}diff --git a/rea_video/aspects/grade.py b/rea_video/aspects/grade.pyindex 16a2a8e..ba0d892 100644--- a/rea_video/aspects/grade.py+++ b/rea_video/aspects/grade.py@@ -15,6 +15,8 @@ from __future__ import annotationsimport cv2import numpy as np+from ..i18n import T, join, semi+from .base import PHOTOGRAPHIC, Aspect, Field, ShotCtx, field_table, register, weighted_medianMEASURES = ("sat", "contrast", "black", "white", "shadow_b", "highlight_b", "mean_b", "mean_l", "bright_share", "dark_share",@@ -59,36 +61,38 @@ def words(m: dict) -> dict:if not m:return {}sat, con, black = m["sat"], m["contrast"], m["black"]- sat_w = "接近黑白" if sat < 0.06 else "低饱和" if sat < 0.2 else "高饱和" if sat > 0.45 else "饱和度正常"- con_w = "低对比" if con < 0.16 else "高对比" if con > 0.28 else "对比正常"+ sat_w = (T("接近黑白", "near monochrome") if sat < 0.06 else T("低饱和", "low saturation") if sat < 0.2+ else T("高饱和", "high saturation") if sat > 0.45 else T("饱和度正常", "normal saturation"))+ con_w = T("低对比", "low contrast") if con < 0.16 else T("高对比", "high contrast") if con > 0.28 else T("对比正常", "normal contrast")lifted = black > 12split = m["shadow_b"] < -5 and m["highlight_b"] > 8 # strict: dark blue / green objects tint shadows a little too- tone = "偏暖" if m["mean_b"] > 12 else "偏冷" if m["mean_b"] < 2 else "中性"+ warm = m["mean_b"] > 12+ tone = T("偏暖", "warm") if warm else T("偏冷", "cool") if m["mean_b"] < 2 else T("中性", "neutral")if sat < 0.06:- look = "黑白"+ look = T("黑白", "black and white")elif split:- look = "青橙电影感(暗部偏青、亮部偏暖)"+ look = T("青橙电影感(暗部偏青、亮部偏暖)", "teal-orange cinematic (teal shadows, warm highlights)")elif lifted and m["mean_l"] > 55 and sat < 0.3:- look = "日系清新(明亮、低饱和、黑位抬高)"- elif lifted and tone == "偏暖":- look = "复古胶片(黑位抬高、偏暖)"+ look = T("日系清新(明亮、低饱和、黑位抬高)", "airy Japanese-style (bright, low saturation, lifted blacks)")+ elif lifted and warm:+ look = T("复古胶片(黑位抬高、偏暖)", "vintage film (lifted blacks, warm)")elif m["mean_l"] < 35 and sat < 0.3:- look = "暗调低饱和(电影感)"+ look = T("暗调低饱和(电影感)", "dark and desaturated (cinematic)")elif sat > 0.45 and con > 0.2:- look = "高饱和鲜艳"+ look = T("高饱和鲜艳", "vivid, high saturation")else:- look = "自然(接近原色)"- return {"look": look, "saturation": sat_w, "contrast": con_w, "black": "黑位抬高(发灰的暗部)" if lifted else "黑位正常",- "tone": tone}+ look = T("自然(接近原色)", "natural (close to the original colours)")+ return {"look": look, "saturation": sat_w, "contrast": con_w,+ "black": T("黑位抬高(发灰的暗部)", "lifted blacks (greyish shadows)") if lifted else T("黑位正常", "normal blacks"), "tone": tone}class Grade(Aspect):def __init__(self):- super().__init__(key="grade", title="调色", shot_fields=[+ super().__init__(key="grade", title="调色", title_en="Grade", shot_fields=[Field("color_grade", "调色风格", "调色风格:自然 / 青橙电影感 / 日系清新 / 复古胶片 / 黑白 / 高饱和 / 暗调…,写依据(暗部颜色、黑位、饱和度)",- prefer="measured"),+ prefer="measured", en="colour grade"),], video_fields=[- Field("grade_overall", "整体调色", "整片调色风格,是否用了 LUT / 滤镜(剪映滤镜、胶片模拟),不同段落是否不同", prefer="seen"),+ Field("grade_overall", "整体调色", "整片调色风格,是否用了 LUT / 滤镜(剪映滤镜、胶片模拟),不同段落是否不同", prefer="seen", en="overall grade"),])def measure(self, ctx: ShotCtx) -> dict:@@ -106,8 +110,8 @@ class Grade(Aspect):ms = [(r["aspects"][self.key]["measured"], r["duration"]) for r in main]med = {k: weighted_median([(m.get(k), w) for m, w in ms]) for k in MEASURES}w = words(med)- lines = [f"调色:{w['look']};{w['saturation']}、{w['contrast']}、{w['black']}、整体{w['tone']}"]- return {"result": {"look": w["look"].split("(")[0]}, "measured": {k: round(v, 3) for k, v in med.items() if v is not None},+ lines = [T("调色:{l}", "Grade: {l}", l=w["look"]) + semi() + join((w["saturation"], w["contrast"], w["black"], T("整体{t}", "overall {t}", t=w["tone"])))]+ return {"result": {"look": w["look"].split("(")[0].split(" (")[0]}, "measured": {k: round(v, 3) for k, v in med.items() if v is not None},"words": w, "lines": lines, "fields": field_table(self, main, b, {"color_grade": w["look"]})}diff --git a/rea_video/aspects/lighting.py b/rea_video/aspects/lighting.pyindex d60c3c4..3d64212 100644--- a/rea_video/aspects/lighting.py+++ b/rea_video/aspects/lighting.py@@ -20,12 +20,32 @@ import mathimport cv2import numpy as np+from ..i18n import T, semi+from .base import (FILMED, PHOTOGRAPHIC, Aspect, Field, ShotCtx, field_table, mode_seen, register, seen, video_seen,weighted_median, weighted_mode)MEASURES = ("ratio", "top_bottom", "transition", "subject_luma", "bg_luma", "dark_share", "warmth", "bg_warmth", "bg_blur", "point_lights","bg_std")-OUTDOOR_WORDS = ("户外", "室外", "街", "公园", "海边", "沙滩", "山", "田野", "操场", "天台", "阳台外", "outdoor")+OUTDOOR_WORDS = ("户外", "室外", "街", "公园", "海边", "沙滩", "山", "田野", "操场", "天台", "阳台外", "outdoor", "outside", "exterior",+ "street", "park", "beach", "seaside", "mountain", "field", "rooftop", "playground")+INDOOR_WORDS = ("室内", "indoor", "interior", "inside")+HARD_TRANSITION = 0.16 # lit -> shadow ramp narrower than this share of the subject = hard light+FROM_BELOW_TB = 0.85 # top / bottom luma below this = lit from below (screen, desk bounce)+++def hard_light(m: dict) -> bool:+ return m.get("transition") is not None and m["transition"] <= HARD_TRANSITION+++def from_below(m: dict) -> bool:+ return (m.get("top_bottom") or 1.0) < FROM_BELOW_TB+++def is_outdoor(location: str | None) -> bool:+ """What an image reader said about the place (either language) names an outdoor spot and not an indoor one."""+ loc = (location or "").lower()+ return bool(loc) and any(k in loc for k in OUTDOOR_WORDS) and not any(k in loc for k in INDOOR_WORDS)def _lin(gray: np.ndarray) -> np.ndarray:@@ -98,96 +118,144 @@ def words(m: dict) -> dict:"""Plain-language reading of measurements (one shot, or a video's medians)."""if not m or m.get("ratio") is None:return {}- r, side = m["ratio"], {"left": "画面左侧", "right": "画面右侧"}.get(m.get("key_side"), "?")- key = "正面(光从镜头方向来,主体两侧亮度接近)" if r < 1.35 else (f"{side}偏前方" if r < 2.5 else f"{side}(侧光)")+ r, side = m["ratio"], {"left": T("画面左侧", "frame left"), "right": T("画面右侧", "frame right")}.get(m.get("key_side"), "?")+ key = (T("正面(光从镜头方向来,主体两侧亮度接近)", "frontal (from the camera side; both sides of the subject about equally bright)") if r < 1.35+ else (T("{side}偏前方", "{side}, three-quarter front", side=side) if r < 2.5 else T("{side}(侧光)", "{side} (side light)", side=side)))tb = m.get("top_bottom") or 1.0- vert = "从下往上(屏幕/桌面反光/低位光源)" if tb < 0.85 else ("从上往下(顶灯/路灯/高位光源)" if tb > 1.35 else "与主体同高")+ vert = (T("从下往上(屏幕/桌面反光/低位光源)", "from below (screen / desk bounce / low source)") if from_below(m)+ else (T("从上往下(顶灯/路灯/高位光源)", "from above (ceiling light / street lamp / high source)") if tb > 1.35 else T("与主体同高", "at subject height")))tr = m.get("transition")- quality = (("柔光(几乎没有明暗分界)" if r < 1.35 else "无法判断") if tr is None- else "柔光(明暗过渡宽)" if tr >= 0.32 else "硬光(明暗分界清楚)" if tr <= 0.16 else "中等柔度")+ quality = ((T("柔光(几乎没有明暗分界)", "soft light (almost no lit / shadow edge)") if r < 1.35 else T("无法判断", "unclear")) if tr is None+ else T("柔光(明暗过渡宽)", "soft light (wide lit-to-shadow ramp)") if tr >= 0.32+ else T("硬光(明暗分界清楚)", "hard light (sharp shadow edge)") if hard_light(m) else T("中等柔度", "medium-soft"))warm = m.get("warmth") or 0.0- ct = "偏暖(约 3000–4000K)" if warm > 14 else ("偏冷(日光/冷白 LED)" if warm < 4 else "中性(约 5000K)")+ ct = (T("偏暖(约 3000–4000K)", "warm (about 3000–4000K)") if warm > 14+ else (T("偏冷(日光/冷白 LED)", "cool (daylight / cool-white LED)") if warm < 4 else T("中性(约 5000K)", "neutral (about 5000K)")))blur = m.get("bg_blur")- depth = None if blur is None else ("背景明显虚化(浅景深/人像模式)" if blur < 0.45 else "背景略虚" if blur < 0.8 else "背景清晰")+ depth = None if blur is None else (T("背景明显虚化(浅景深/人像模式)", "background clearly blurred (shallow depth of field / portrait mode)") if blur < 0.45+ else T("背景略虚", "background slightly soft") if blur < 0.8 else T("背景清晰", "background sharp"))sep = Noneif m.get("bg_luma") is not None and m.get("subject_luma") is not None:d = m["subject_luma"] - m["bg_luma"]- sep = "主体比背景亮" if d > 25 else ("背景比主体亮(逆光/背景灯更亮)" if d < -25 else "主体和背景亮度接近")+ sep = (T("主体比背景亮", "subject brighter than background") if d > 25+ else (T("背景比主体亮(逆光/背景灯更亮)", "background brighter than subject (backlit / background lights brighter)") if d < -25+ else T("主体和背景亮度接近", "subject and background about equally bright")))low = (m.get("subject_luma", 255) < 95 and (m.get("dark_share") or 0) > 0.25) or (m.get("bg_luma") is not None and m["bg_luma"] < 35)- return {"key_direction": key, "vertical": vert, "ratio": f"约 {r:.1f}:1(相差 {math.log2(max(r, 1.0)):.1f} 档)",+ return {"key_direction": key, "vertical": vert,+ "ratio": T("约 {r:.1f}:1(相差 {st:.1f} 档)", "about {r:.1f}:1 ({st:.1f} stops)", r=r, st=math.log2(max(r, 1.0))),"quality": quality, "color_temp": ct, "depth": depth, "separation": sep, "low_light": bool(low),"mixed_color": m.get("bg_warmth") is not None and abs(m["bg_warmth"] - warm) > 10,"point_lights": int(m.get("point_lights") or 0)}# Lighting set-ups, first match wins. `when(m, w)` gets the measurements and their reading.-# gear: per subject kind ("face" = people, "other" = desk / product / hands).+# gear: per subject kind ("face" = people, "other" = desk / product / hands). name_en / detail_en / gear_en: English report.SETUPS = [# ---- outdoor (needs an image reader to say "outdoor"; pixels cannot tell a window from the sky)- {"key": "outdoor_backlit", "name": "户外逆光(太阳或亮天空在主体后方)",+ {"key": "outdoor_backlit", "name": "户外逆光(太阳或亮天空在主体后方)", "name_en": "outdoor backlight (sun or bright sky behind the subject)","when": lambda m, w: w.get("outdoor") and not w["low_light"] and m.get("bg_luma") is not None and m["bg_luma"] - m.get("subject_luma", 0) > 25,"detail": "太阳在主体后方或侧后方,头发和肩膀有亮边,脸靠天空和地面反光照亮;常在日出日落前后拍(黄金时刻)",+ "detail_en": "sun behind or behind-and-beside the subject, rim on hair and shoulders, face lit by sky and ground bounce; usually shot around sunrise / sunset (golden hour)","gear": {"face": ["傍晚太阳低时拍,人背对太阳", "正面用反光板(金色更暖)或补光灯提亮脸", "曝光按脸测,天空允许过曝一点"],- "other": ["物品背光放,边缘会被勾亮", "正面用白卡/反光板补光"]}},- {"key": "outdoor_sun", "name": "户外直射阳光(硬光)",- "when": lambda m, w: w.get("outdoor") and not w["low_light"] and (m["ratio"] >= 2.0 or w["quality"].startswith("硬光")),+ "other": ["物品背光放,边缘会被勾亮", "正面用白卡/反光板补光"]},+ "gear_en": {"face": ["shoot when the sun is low, subject with their back to it", "bounce board (gold for warmth) or a fill light from the front to lift the face",+ "expose for the face; let the sky clip a little"],+ "other": ["place the object against the light so its edges get a rim", "white card / bounce board as fill from the front"]}},+ {"key": "outdoor_sun", "name": "户外直射阳光(硬光)", "name_en": "outdoor direct sun (hard light)",+ "when": lambda m, w: w.get("outdoor") and not w["low_light"] and (m["ratio"] >= 2.0 or hard_light(m)),"detail": "晴天阳光直接照在主体上,阴影边缘清楚、反差大",+ "detail_en": "direct sun on the subject: sharp shadow edges, high contrast","gear": {"face": ["让太阳在人物侧前方 45°,避开正午顶光", "暗部用反光板补,或拍摄时站到有反光的浅色墙边"],- "other": ["阳光斜射时拍,影子更长更有质感", "暗部用白卡补光"]}},- {"key": "outdoor_soft", "name": "户外阴天/背阴处柔光",+ "other": ["阳光斜射时拍,影子更长更有质感", "暗部用白卡补光"]},+ "gear_en": {"face": ["put the sun 45° to the front-side of the subject; avoid midday top light", "fill the shadow side with a bounce board, or stand next to a light-coloured wall"],+ "other": ["shoot with the sun low and raking: longer shadows, more texture", "white card to fill the shadows"]}},+ {"key": "outdoor_soft", "name": "户外阴天/背阴处柔光", "name_en": "outdoor soft light (overcast / open shade)","when": lambda m, w: w.get("outdoor") and not w["low_light"],"detail": "阴天或站在建筑阴影里,天空当一盏大柔光灯,几乎没有硬阴影",+ "detail_en": "overcast sky or the shade of a building: the sky is one huge soft source, almost no hard shadows","gear": {"face": ["阴天或找建筑的阴影处,面朝开阔的天空", "可选:反光板从下方补一点眼神光"],- "other": ["放在阴影里、面朝开阔天空", "白色泡沫板反光让暗部更亮"]}},+ "other": ["放在阴影里、面朝开阔天空", "白色泡沫板反光让暗部更亮"]},+ "gear_en": {"face": ["overcast day or open shade next to a building, subject facing the open sky", "optional: bounce board from below for a little catchlight"],+ "other": ["place it in the shade facing the open sky", "white foam board to bounce light into the shadows"]}},# ---- studio looks- {"key": "low_key", "name": "低调光(主体被单独照亮,背景压黑)",+ {"key": "low_key", "name": "低调光(主体被单独照亮,背景压黑)", "name_en": "low key (subject lit on its own, background held black)","when": lambda m, w: (m.get("bg_luma") is not None and m["bg_luma"] < 22 and not m.get("point_lights")and m.get("subject_luma", 0) >= 100 and (m.get("dark_share") or 0) > 0.4),"detail": "一盏控制得很窄的主光只照主体,背景不打光、保持全黑,戏剧感强",+ "detail_en": "one tightly controlled key lights only the subject; the background gets no light and stays black; dramatic","gear": {"face": ["一盏 LED + 带蜂巢/束光筒的柔光箱,从侧前方打", "背景用黑布或离墙远一点,不要补光", "可选:背后加一盏弱轮廓灯"],- "other": ["黑色背景布 + 一盏带束光筒的灯从侧上方打物品", "用黑卡挡住溢到背景的光"]}},- {"key": "high_key", "name": "高调光(整体明亮、几乎没有暗部)",+ "other": ["黑色背景布 + 一盏带束光筒的灯从侧上方打物品", "用黑卡挡住溢到背景的光"]},+ "gear_en": {"face": ["one LED with a gridded softbox / snoot, from the front-side", "black backdrop or keep well away from the wall; no fill", "optional: a weak rim light from behind"],+ "other": ["black backdrop + one snooted light on the object from high side", "black card to flag light spilling onto the background"]}},+ {"key": "high_key", "name": "高调光(整体明亮、几乎没有暗部)", "name_en": "high key (bright overall, almost no shadows)","when": lambda m, w: (w.get("g") or {}).get("mean_l", 0) > 68 and ((w.get("g") or {}).get("dark_share") or 0) < 0.02 and m["ratio"] < 1.6,"detail": "主体和背景都打得很亮,白色或浅色背景,阴影几乎被补光抹掉;常见于美妆、产品、清新风",+ "detail_en": "subject and background both lit bright, white or pale background, shadows filled almost away; common in beauty, product and airy looks","gear": {"face": ["两盏大柔光箱在人物两侧 45°,再加一盏打亮白色背景", "或白天大窗户 + 白墙,曝光稍微加一点"],- "other": ["白色无缝背景纸 + 两侧柔光箱 + 一盏打背景", "白色泡沫板围住物品补光"]}},- {"key": "colored_ambient", "name": "彩色氛围光(RGB 灯 / 霓虹)",+ "other": ["白色无缝背景纸 + 两侧柔光箱 + 一盏打背景", "白色泡沫板围住物品补光"]},+ "gear_en": {"face": ["two large softboxes at 45° either side, plus one light on the white background", "or a big window by day + white wall, exposed a touch bright"],+ "other": ["white seamless paper + softboxes both sides + one light on the background", "white foam boards around the object as fill"]}},+ {"key": "colored_ambient", "name": "彩色氛围光(RGB 灯 / 霓虹)", "name_en": "coloured ambient light (RGB lights / neon)","when": lambda m, w: ((w.get("g") or {}).get("bright_sat", 0) > 0.5 and ((w.get("g") or {}).get("hue_bins") or 0) >= 2and not w["low_light"]),"detail": "画面里的光带明显颜色(蓝紫、粉红等),通常是 RGB 灯带、彩色补光灯或霓虹招牌,主体可能被两种颜色从两侧夹打",+ "detail_en": "the light carries strong colour (blue-purple, pink ...), usually RGB strips, coloured fill lights or neon signs; the subject may be cross-lit in two colours","gear": {"face": ["主光仍用白光柔光箱照脸,避免肤色发怪", "背景或侧后方放 RGB 灯棒 / 灯带,选两种对比色(蓝 + 粉、青 + 橙)"],- "other": ["两盏 RGB 灯从左右两侧打不同颜色", "背景墙用灯带洗出渐变色"]}},- {"key": "product_still", "name": "产品静物布光(无缝背景)",+ "other": ["两盏 RGB 灯从左右两侧打不同颜色", "背景墙用灯带洗出渐变色"]},+ "gear_en": {"face": ["keep a white softbox as the key on the face so skin stays natural", "RGB tubes / strips behind or to the back-side, two contrasting colours (blue + pink, teal + orange)"],+ "other": ["two RGB lights from left and right in different colours", "LED strip to wash the back wall in a gradient"]}},+ {"key": "product_still", "name": "产品静物布光(无缝背景)", "name_en": "product still-life lighting (seamless background)","when": lambda m, w: (w.get("subject_kind") == "other" and m.get("bg_std") is not None and m["bg_std"] < 12and not w["low_light"]),"detail": "物品放在干净的纯色背景上,背景几乎没有纹理,光从上方或两侧柔和地包住物品",+ "detail_en": "object on a clean plain background with almost no texture; soft light wraps it from above or both sides","gear": {"other": ["静物台或无缝背景纸(白/灰/彩色)", "顶部一盏大柔光箱,两侧各一盏或白卡", "亮面物品(玻璃、金属、手机)用柔光布围起来,避免反射出灯和人"],- "face": ["纯色背景纸 + 两侧柔光箱", "人离背景 1 米以上,避免影子落在背景上"]}},+ "face": ["纯色背景纸 + 两侧柔光箱", "人离背景 1 米以上,避免影子落在背景上"]},+ "gear_en": {"other": ["shooting table or seamless paper (white / grey / coloured)", "one large softbox overhead, one each side or white cards",+ "tent glossy objects (glass, metal, phones) in diffusion so the lights and you do not reflect"],+ "face": ["plain paper backdrop + softboxes both sides", "subject at least 1 m from the backdrop so no shadow lands on it"]}},# ---- the original set-ups- {"key": "ambient_low_light", "name": "夜景/弱光环境光,没有专门补光",+ {"key": "ambient_low_light", "name": "夜景/弱光环境光,没有专门补光", "name_en": "night / low-light ambient, no dedicated fill","when": lambda m, w: w["low_light"],"detail": "主光来自环境(路灯、招牌、室内顶灯、屏幕),主体偏暗、反差由环境决定",+ "detail_en": "the key is whatever is there (street lamps, signs, ceiling lights, screens); the subject sits dark and contrast is set by the surroundings","gear": {"face": ["手机夜景/人像模式,找一盏路灯或招牌做主光,人站在灯斜下方", "想更干净:镜头旁加一个低亮度暖色 LED 小灯(3200K)"],- "other": ["找一处有台灯/氛围灯的位置,把物品放在灯下", "想更干净:加一盏低亮度 LED 小灯从侧上方照物品"]}},- {"key": "back_lit", "name": "逆光/背景比主体亮",+ "other": ["找一处有台灯/氛围灯的位置,把物品放在灯下", "想更干净:加一盏低亮度 LED 小灯从侧上方照物品"]},+ "gear_en": {"face": ["phone night / portrait mode; use a street lamp or sign as the key, subject just off-axis below it",+ "for a cleaner picture: a small dim warm LED (3200K) next to the lens"],+ "other": ["find a spot with a desk lamp / mood light and put the object under it", "for a cleaner picture: a small dim LED from high side on the object"]}},+ {"key": "back_lit", "name": "逆光/背景比主体亮", "name_en": "backlit / background brighter than subject","when": lambda m, w: m.get("bg_luma") is not None and m["bg_luma"] - m.get("subject_luma", 0) > 40,"detail": "背景(窗户、天空、亮墙)比主体亮,主体靠反光或曝光补偿",- "gear": {"face": ["背对窗户坐,或在镜头侧加反光板/补光灯把脸提亮"], "other": ["物品背对窗户,正面放反光板或白卡补光"]}},- {"key": "soft_front", "name": "正面柔光(平光)",+ "detail_en": "the background (window, sky, bright wall) is brighter than the subject, which relies on bounce or exposure compensation",+ "gear": {"face": ["背对窗户坐,或在镜头侧加反光板/补光灯把脸提亮"], "other": ["物品背对窗户,正面放反光板或白卡补光"]},+ "gear_en": {"face": ["sit with your back to the window, with a bounce board / fill light at the camera to lift the face"],+ "other": ["object with its back to the window, bounce board or white card as fill from the front"]}},+ {"key": "soft_front", "name": "正面柔光(平光)", "name_en": "soft frontal light (flat light)","when": lambda m, w: m["ratio"] < 1.35,"detail": "大面积光从镜头方向来,主体上几乎没有阴影:面朝窗户、环形灯,或大柔光箱放在镜头后方",+ "detail_en": "a large source from the camera side, almost no shadow on the subject: facing a window, a ring light, or a big softbox behind the camera","gear": {"face": ["环形灯(18 寸)或带柔光罩的 LED 平板灯,放在手机正后方略高处", "或白天面朝窗户,窗户在镜头后面"],- "other": ["桌面正上方/镜头后方放一盏大柔光灯(或两盏左右对称 45°)", "白色桌面或白卡反光,阴影会更淡"]}},- {"key": "key_fill", "name": "侧前方主光 + 补光(标准布光)",+ "other": ["桌面正上方/镜头后方放一盏大柔光灯(或两盏左右对称 45°)", "白色桌面或白卡反光,阴影会更淡"]},+ "gear_en": {"face": ["18-inch ring light or a diffused LED panel just behind and above the phone", "or face a window by day, window behind the camera"],+ "other": ["one large soft light straight above the desk / behind the camera (or two, symmetrical at 45°)", "white desk or white cards to bounce; shadows go lighter"]}},+ {"key": "key_fill", "name": "侧前方主光 + 补光(标准布光)", "name_en": "three-quarter key + fill (standard set-up)","when": lambda m, w: m["ratio"] < 2.5,"detail": "主光在主体一侧斜前方,另一侧有补光或反光板把阴影提亮",+ "detail_en": "key from the front-side of the subject, fill light or bounce board on the other side lifting the shadows","gear": {"face": ["主光:LED + 柔光箱/柔光伞,人物 45° 侧前方、略高于眼睛", "补光:另一侧反光板或低亮度小灯", "可选:背后加轮廓灯"],- "other": ["主光:LED + 柔光箱从桌面一侧 45° 斜上方打", "另一侧白卡/反光板补光", "可选:后方加一盏轮廓灯勾边"]}},- {"key": "hard_side", "name": "单侧主光,补光很弱(明暗对比强)",+ "other": ["主光:LED + 柔光箱从桌面一侧 45° 斜上方打", "另一侧白卡/反光板补光", "可选:后方加一盏轮廓灯勾边"]},+ "gear_en": {"face": ["key: LED + softbox / umbrella, 45° to the front-side, a little above eye level", "fill: bounce board or a small dim light on the other side",+ "optional: a rim light from behind"],+ "other": ["key: LED + softbox from 45° high on one side of the desk", "white card / bounce board as fill on the other side", "optional: a rim light from behind for edge"]}},+ {"key": "hard_side", "name": "单侧主光,补光很弱(明暗对比强)", "name_en": "single side key, very little fill (high contrast)","when": lambda m, w: True,"detail": "主光在一侧,另一侧明显暗下去,接近伦勃朗光/侧光",+ "detail_en": "key on one side, the other side falls off clearly; close to Rembrandt / side light","gear": {"face": ["一盏 LED + 柔光箱放在人物侧面 60–90°", "不补光,或用黑旗压暗另一侧"],- "other": ["一盏灯从侧面低角度打,制造长影子", "另一侧不补光或用黑卡吸光"]}},+ "other": ["一盏灯从侧面低角度打,制造长影子", "另一侧不补光或用黑卡吸光"]},+ "gear_en": {"face": ["one LED + softbox at 60–90° to the side of the subject", "no fill, or a black flag to darken the other side"],+ "other": ["one light from the side at a low angle for long shadows", "no fill on the other side, or black card to soak up bounce"]}},]@@ -195,37 +263,39 @@ def setup_for(m: dict, w: dict, subject_kind: str = "face", location: str | None"""location: what an image reader said about the place ("户外 白天 街边"); grade: the grade aspect's measurements."""if not w:return {}- ctx = {**w, "outdoor": bool(location) and any(k in location for k in OUTDOOR_WORDS) and "室内" not in location,- "g": grade or {}, "subject_kind": subject_kind}+ ctx = {**w, "outdoor": is_outdoor(location), "g": grade or {}, "subject_kind": subject_kind}s = next(s for s in SETUPS if s["when"](m, ctx))notes = []g = grade or {}if s["key"] == "ambient_low_light" and g.get("bright_sat", 0) > 0.5 and (g.get("hue_bins") or 0) >= 2:- notes.append("暗处的光带明显颜色:霓虹招牌或 RGB 氛围灯")- if w["vertical"].startswith("从下往上"):- notes.append("主体下半部偏亮:可能有来自下方的光(屏幕、桌面反光)")+ notes.append(T("暗处的光带明显颜色:霓虹招牌或 RGB 氛围灯", "the light in the dark carries strong colour: neon signs or RGB mood lights"))+ if from_below(m):+ notes.append(T("主体下半部偏亮:可能有来自下方的光(屏幕、桌面反光)", "lower half of the subject is brighter: likely light from below (screen, desk bounce)"))if w["mixed_color"]:- notes.append("主体和背景色温不一致:混合光源(例如暖色灯 + 冷色窗光/屏幕)")+ notes.append(T("主体和背景色温不一致:混合光源(例如暖色灯 + 冷色窗光/屏幕)",+ "subject and background differ in colour temperature: mixed sources (e.g. warm lamp + cool window light / screen)"))if w.get("depth"):notes.append(w["depth"])- return {"key": s["key"], "name": s["name"], "detail": s["detail"], "notes": notes,- "gear": s["gear"]["face" if subject_kind == "face" else "other"]}+ kind = "face" if subject_kind == "face" else "other"+ gear_en = (s.get("gear_en") or {}).get(kind) or s["gear"][kind]+ return {"key": s["key"], "name": T(s["name"], s.get("name_en")), "detail": T(s["detail"], s.get("detail_en")), "notes": notes,+ "gear": [T(z, e) for z, e in zip(s["gear"][kind], gear_en)]}class Lighting(Aspect):def __init__(self):- super().__init__(key="lighting", title="打光", shot_fields=[- Field("location", "场景", "室内|户外;白天|夜晚;具体场景(卧室/办公室/桌面/街边/车内…)", prefer="seen"),- Field("key_light", "主光", "主光方向与高度(如:画面左前方 45° 略高)及光源(窗户/环形灯/柔光箱/台灯/路灯/屏幕/顶灯)", prefer="seen"),- Field("light_quality", "软硬", "柔光|硬光|混合,依据(阴影边缘、投影)"),- Field("fill_light", "补光", "有无补光/反光板,暗部多暗", prefer="seen"),- Field("rim_light", "轮廓光", "有无轮廓光/背景灯(头发、肩膀、物体边缘的亮边)", prefer="seen"),- Field("catchlight", "眼神光", "眼神光形状(方形=柔光箱/窗,圆环=环形灯,点状=小灯/路灯,无);没有人脸写不适用", prefer="seen"),- Field("practicals", "可见光源", "画面里能看到的光源(台灯、灯带、路灯、招牌、屏幕)", prefer="seen"),- Field("color_temp", "色温", "暖|中性|冷|混合(主体和背景是否不同色温)"),- Field("lighting_setup", "布光方案", "一句话布光方案(如:环形灯正面平光 + 暖色背景灯;两盏柔光箱 45° 夹打桌面)", prefer="seen"),+ super().__init__(key="lighting", title="打光", title_en="Lighting", shot_fields=[+ Field("location", "场景", "室内|户外;白天|夜晚;具体场景(卧室/办公室/桌面/街边/车内…)", prefer="seen", en="location"),+ Field("key_light", "主光", "主光方向与高度(如:画面左前方 45° 略高)及光源(窗户/环形灯/柔光箱/台灯/路灯/屏幕/顶灯)", prefer="seen", en="key light"),+ Field("light_quality", "软硬", "柔光|硬光|混合,依据(阴影边缘、投影)", en="soft / hard"),+ Field("fill_light", "补光", "有无补光/反光板,暗部多暗", prefer="seen", en="fill"),+ Field("rim_light", "轮廓光", "有无轮廓光/背景灯(头发、肩膀、物体边缘的亮边)", prefer="seen", en="rim / backlight"),+ Field("catchlight", "眼神光", "眼神光形状(方形=柔光箱/窗,圆环=环形灯,点状=小灯/路灯,无);没有人脸写不适用", prefer="seen", en="catchlight"),+ Field("practicals", "可见光源", "画面里能看到的光源(台灯、灯带、路灯、招牌、屏幕)", prefer="seen", en="practicals"),+ Field("color_temp", "色温", "暖|中性|冷|混合(主体和背景是否不同色温)", en="colour temperature"),+ Field("lighting_setup", "布光方案", "一句话布光方案(如:环形灯正面平光 + 暖色背景灯;两盏柔光箱 45° 夹打桌面)", prefer="seen", en="lighting set-up"),], video_fields=[- Field("lighting_overall", "整体布光", "整片的布光方案:主光、补光、轮廓光、环境光、色温;不同场景分别写", prefer="seen"),+ Field("lighting_overall", "整体布光", "整片的布光方案:主光、补光、轮廓光、环境光、色温;不同场景分别写", prefer="seen", en="overall lighting"),])def measure(self, ctx: ShotCtx) -> dict:@@ -272,10 +342,12 @@ class Lighting(Aspect):gm = [(((r.get("aspects") or {}).get("grade") or {}).get("measured") or {}, r["duration"]) for r in main]g = {k: weighted_median([(x.get(k), d) for x, d in gm]) for k in ("mean_l", "dark_share", "bright_sat", "hue_bins")}st = setup_for(med, w, kind or "face", loc.get("agent") or loc.get("vlm"), {k: v for k, v in g.items() if v is not None})- lines = [f"打光:{st['name']}。主光 {w['key_direction']},{w['vertical']};光比 {w['ratio']};{w['quality']};色温{w['color_temp']}"- + (f";{';'.join(st['notes'])}" if st.get("notes") else "")]+ lines = [T("打光:{n}。主光 {k},{v};光比 {r};{q};色温{c}", "Lighting: {n}. Key light {k}, {v}; lighting ratio {r}; {q}; colour temperature {c}",+ n=st["name"], k=w["key_direction"], v=w["vertical"], r=w["ratio"], q=w["quality"], c=w["color_temp"])+ + (semi() + semi().join(st["notes"]) if st.get("notes") else "")]if not filmed:- lines.append("(画面不是实拍:以上是画面里的光影,用于写生成提示词,不是拍摄方案)")+ lines.append(T("(画面不是实拍:以上是画面里的光影,用于写生成提示词,不是拍摄方案)",+ "(not live footage: the above describes the light in the picture, for generation prompts, not a shooting plan)"))return {"result": {"setup": st["key"]}, "measured": {k: (round(v, 3) if isinstance(v, float) else v) for k, v in med.items()},"words": w, "setup": st, "filmed": bool(filmed), "lines": lines,"fields": field_table(self, main, b, {"light_quality": w["quality"], "color_temp": w["color_temp"]})}diff --git a/rea_video/assets.py b/rea_video/assets.pyindex ef15e9f..2850af4 100644--- a/rea_video/assets.py+++ b/rea_video/assets.py@@ -14,21 +14,33 @@ rendered layouts: rectangles or regions whose texture is photographic (high greyentropy) or that hold dense small UI text (a screenshot pasted into a card)."""from __future__ import annotations+from .i18n import LangDict, T, join+import cv2import numpy as npBLOCK = 16-KIND_ZH = {+KIND_ZH = LangDict({"real_footage": "实拍视频素材", "photo_or_image": "照片/图片素材", "screenshot": "界面截图","screen_recording": "录屏素材", "video_clip": "嵌入视频片段", "ai_generated": "AI 生成", "rendered": "制作方渲染","photo": "真实照片", "ai_image": "AI 生成图", "graphic": "设计图形", "logo": "Logo/品牌标识", "product_photo": "商品实拍图",-}-REF_ZH = {"product_photo": "商品参考图", "logo": "Logo/品牌参考", "photo": "人物/场景参考图", "real_footage": "动作/场景参考视频",- "screenshot": "界面参考图", "screen_recording": "界面参考录屏", "video_clip": "参考视频", "photo_or_image": "参考图"}+}, en={+ "real_footage": "live footage", "photo_or_image": "photo / image", "screenshot": "UI screenshot",+ "screen_recording": "screen recording", "video_clip": "embedded video clip", "ai_generated": "AI-generated", "rendered": "rendered by the creator",+ "photo": "photo", "ai_image": "AI-generated image", "graphic": "designed graphic", "logo": "logo / brand mark", "product_photo": "product photo",+})+REF_ZH = LangDict({"product_photo": "商品参考图", "logo": "Logo/品牌参考", "photo": "人物/场景参考图", "real_footage": "动作/场景参考视频",+ "screenshot": "界面参考图", "screen_recording": "界面参考录屏", "video_clip": "参考视频", "photo_or_image": "参考图"},+ en={"product_photo": "product reference image", "logo": "logo / brand reference", "photo": "person / scene reference image",+ "real_footage": "action / scene reference video", "screenshot": "UI reference image", "screen_recording": "UI reference recording",+ "video_clip": "reference video", "photo_or_image": "reference image"})# bases whose pixels a model / renderer produced: what the VLM "sees" in them is a reference, not embedded materialGENERATED_BASES = ("ai_video", "avatar")# a 3D render can still carry a pasted screenshot or recording; products / logos / people in it are modelledRENDER_REF_KINDS = ("product_photo", "logo", "photo", "real_footage", "ai_image")+ORIGIN_ZH = LangDict({"real": "用户真实素材", "ai_generated": "AI 生成", "rendered": "制作方渲染", "mixed": "混合(含真实素材)", "unknown": "待确认"},+ en={"real": "the user's real material", "ai_generated": "AI-generated", "rendered": "rendered by the creator",+ "mixed": "mixed (includes real material)", "unknown": "to confirm"})REAL_KINDS = {"real_footage", "photo_or_image", "screenshot", "screen_recording", "video_clip", "photo", "logo", "product_photo"}@@ -159,10 +171,10 @@ def detect_embedded(frames: list[np.ndarray], ocr_items: list[dict] | None = Nontext_area = sum(t["bbox"][2] * t["bbox"][3] for t in texts) / max(1e-6, nw * nh)if photo_frac >= 0.35 and text_area < 0.2 and not (ny > 0.6 and nh < 0.2): # not a subtitle bandkind = "video_clip" if moving else "photo_or_image"- why = f"区域内 {photo_frac:.0%} 的块是照片纹理(灰度熵高、无平涂色)"+ why = T("区域内 {p:.0%} 的块是照片纹理(灰度熵高、无平涂色)", "{p:.0%} of the blocks in the region have photographic texture (high grey-level entropy, no flat fills)", p=photo_frac)elif (light and sat < 0.3 and len(small) >= 6) or len(small) >= 15:kind = "screen_recording" if moving else "screenshot"- why = f"浅色界面面板内有 {len(texts)} 处文字(其中 {len(small)} 处小字号)"+ why = T("浅色界面面板内有 {n} 处文字(其中 {s} 处小字号)", "a light UI panel holding {n} text items ({s} of them small type)", n=len(texts), s=len(small))if kind:certain = kind in ("screenshot", "screen_recording")found.append({"kind": kind, "kind_zh": KIND_ZH[kind], "bbox": [round(nx, 3), round(ny, 3), round(nw, 3), round(nh, 3)],@@ -222,7 +234,7 @@ def material_summary(label: str, image_source: str | None, embedded: list[dict],# (for live action the whole frame is already real footage)# camera footage "in" a generated or filmed picture is not something a remake can be givenif kind not in ("ai_image", "real_footage", "video_clip") and (label != "live_action" or kind in ("product_photo", "logo")):- refs.append({"kind": kind, "kind_zh": REF_ZH.get(kind, "参考素材"), "description": desc, "source": "vlm"})+ refs.append({"kind": kind, "kind_zh": REF_ZH.get(kind, T("参考素材", "reference material")), "description": desc, "source": "vlm"})continueif kind == "real_footage":kind = "video_clip" # a clip inside a layout: real file, but not necessarily camera footage@@ -249,6 +261,5 @@ def material_summary(label: str, image_source: str | None, embedded: list[dict],origin = baseif real and base in ("ai_generated", "rendered"):origin = "mixed"- zh = {"real": "用户真实素材", "ai_generated": "AI 生成", "rendered": "制作方渲染", "mixed": "混合(含真实素材)", "unknown": "待确认"}[origin]- return {"origin": origin, "origin_zh": zh, "has_real_material": bool(real), "uncertain": bool(uncertain),+ return {"origin": origin, "origin_zh": ORIGIN_ZH[origin], "has_real_material": bool(real), "uncertain": bool(uncertain),"items": [dict(i, kind_zh=KIND_ZH.get(i["kind"], i["kind"])) for i in items], "references": refs}diff --git a/rea_video/audio.py b/rea_video/audio.pyindex 4a1a99b..f2a2c58 100644--- a/rea_video/audio.py+++ b/rea_video/audio.py@@ -11,6 +11,8 @@ numpy only (no librosa/scipy):- edit: do cuts land on beats / onsets?"""from __future__ import annotations+from .i18n import LangDict, T, join, semi+import numpy as npfrom .media import extract_audio@@ -22,8 +24,10 @@ T_HOP = HOP / SR_KS_MAJOR = np.array([6.35, 2.23, 3.48, 2.33, 4.38, 4.09, 2.52, 5.19, 2.39, 3.66, 2.29, 2.88])_KS_MINOR = np.array([6.33, 2.68, 3.52, 5.38, 2.60, 3.53, 2.54, 4.75, 3.98, 2.69, 3.34, 3.17])_NOTES = ["C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B"]-SFX_TYPE_ZH = {"whoosh": "嗖/转场呼啸", "ding": "叮/提示音", "pop": "啵/弹出", "click": "咔哒/点击", "impact": "重击/低频冲击",- "typing": "打字/连续点击", "hit": "打点/敲击"}+SFX_TYPE_ZH = LangDict({"whoosh": "嗖/转场呼啸", "ding": "叮/提示音", "pop": "啵/弹出", "click": "咔哒/点击", "impact": "重击/低频冲击",+ "typing": "打字/连续点击", "hit": "打点/敲击"},+ en={"whoosh": "whoosh / transition swish", "ding": "ding / notification", "pop": "pop", "click": "click",+ "impact": "impact / low-end hit", "typing": "typing / rapid clicks", "hit": "hit / tap"})def _stft(x: np.ndarray) -> np.ndarray:@@ -435,28 +439,31 @@ def merge_audio_with_vlm(audio: dict, whole: dict | None) -> dict:plan = []if voice.get("present") or n.get("type") in ("tts", "human", "mixed"):plan.append({"track": "voice", "rule": "A01-narration" if n.get("type") != "human" else "A01-narration",- "what": f"{'TTS 旁白' if n.get('type') == 'tts' else ('真人口播/对白' if n.get('type') == 'human' else '人声')}"- f",{n.get('voice') or voice.get('gender_hint') or ''},{n.get('style') or ''}".strip(","),- "how": "capsule-cinema DoubaoTTSTool / UniversalTTSTool(或 MiniMax 克隆音色);需要卡原时间窗时用时长可控 TTS(A02)",+ "what": (T("TTS 旁白", "TTS voice-over") if n.get('type') == 'tts' else (T("真人口播/对白", "human talking head / dialogue") if n.get('type') == 'human' else T("人声", "voice"))+ + f"{T(',', ', ')}{n.get('voice') or voice.get('gender_hint') or ''}{T(',', ', ')}{n.get('style') or ''}").strip(T(",", ", ")),+ "how": T("capsule-cinema DoubaoTTSTool / UniversalTTSTool(或 MiniMax 克隆音色);需要卡原时间窗时用时长可控 TTS(A02)",+ "capsule-cinema DoubaoTTSTool / UniversalTTSTool (or a MiniMax cloned voice); use duration-controlled TTS (A02) when it must fit the original time window"),"segments": voice.get("segments", [])[:40], "lines": n.get("lines", [])[:60],"real_material": n.get("type") == "human"})if music.get("present") or m.get("present"):src = m.get("source_guess") or "unknown"plan.append({"track": "music", "rule": "A03-music",- "what": ";".join(x for x in [m.get("style") or m.get("genre") or "", m.get("mood") or "",+ "what": semi().join(x for x in [m.get("style") or m.get("genre") or "", m.get("mood") or "",f"{music.get('tempo_bpm') or m.get('bpm_estimate') or '?'} BPM",(f"{music['key']['tonic']} {music['key']['mode']}" if music.get("key") else "")] if x),- "how": ("疑似知名歌曲,需要授权或换成风格相近的授权曲/生成曲" if src == "popular_song" else- "capsule-cinema UniversalMusicGenerationTool(Suno)或曲库:按 BPM/调性/情绪选曲,在段落变化点对齐镜头"),+ "how": (T("疑似知名歌曲,需要授权或换成风格相近的授权曲/生成曲", "Possibly a well-known song: needs a licence, or swap in a licensed / generated track in a similar style") if src == "popular_song" else+ T("capsule-cinema UniversalMusicGenerationTool(Suno)或曲库:按 BPM/调性/情绪选曲,在段落变化点对齐镜头",+ "capsule-cinema UniversalMusicGenerationTool (Suno) or a stock library: pick by BPM / key / mood and line up the shots with the section changes")),"segments": music.get("segments", []), "section_changes": music.get("section_changes", []),"source_guess": src, "song_guess": m.get("song_guess", ""),"beat_synced_cuts": bool(audio.get("beat_synced_edit") or m.get("beat_synced_cuts"))})if sfx:- plan.append({"track": "sfx", "rule": "A04-sfx", "what": f"{len(sfx)} 个音效",- "how": "按时间点摆放:capsule-cinema SoundEffectsTool / 音效库,或像 plush 配方那样程序合成(音高对齐 BGM 调性)",+ plan.append({"track": "sfx", "rule": "A04-sfx", "what": T("{n} 个音效", "{n} SFX", n=len(sfx)),+ "how": T("按时间点摆放:capsule-cinema SoundEffectsTool / 音效库,或像 plush 配方那样程序合成(音高对齐 BGM 调性)",+ "Place by timestamp: capsule-cinema SoundEffectsTool / an SFX library, or synthesise procedurally like the plush recipe (pitched to the music key)"),"events": sfx[:200]})if whole.get("ambience"):- plan.append({"track": "ambience", "rule": "A04-sfx", "what": whole["ambience"], "how": "环境声素材或视频生音效模型"})+ plan.append({"track": "ambience", "rule": "A04-sfx", "what": whole["ambience"], "how": T("环境声素材或视频生音效模型", "Ambience stock or a video-to-audio model")})return {"sfx_merged": sfx[:300], "plan": plan, "mix": whole.get("mix", "")}diff --git a/rea_video/classify.py b/rea_video/classify.pyindex def20da..b327da0 100644--- a/rea_video/classify.py+++ b/rea_video/classify.py@@ -25,11 +25,13 @@ import mathimport refrom difflib import SequenceMatcher+from .i18n import LangDict, T, join+LABELS = ["live_action", "ai_video", "avatar", "cg_3d", "code_render", "screen_capture", "still_motion", "static_hold","anim_2d", "stop_motion"]# labels the deterministic layer cannot score: decided by image readers only (see pipeline._vlm_gate)UNMEASURED = ("anim_2d", "stop_motion")-LABEL_ZH = {+LABEL_ZH = LangDict({"live_action": "实拍","ai_video": "AI 生成视频","avatar": "数字人口播",@@ -40,8 +42,20 @@ LABEL_ZH = {"static_hold": "静帧停留","anim_2d": "2D 动画","stop_motion": "定格动画",-}-IMAGE_SOURCE_ZH = {"ai_image": "AI 生成图", "photo": "真实照片", "graphic": "设计/渲染图形", "screenshot": "截图", "unknown": "未知"}+}, en={+ "live_action": "live action",+ "ai_video": "AI-generated video",+ "avatar": "AI avatar (talking head)",+ "cg_3d": "3D render",+ "code_render": "code / template render",+ "screen_capture": "screen recording / screenshot",+ "still_motion": "still image + pan/zoom",+ "static_hold": "static hold",+ "anim_2d": "2D animation",+ "stop_motion": "stop motion",+})+IMAGE_SOURCE_ZH = LangDict({"ai_image": "AI 生成图", "photo": "真实照片", "graphic": "设计/渲染图形", "screenshot": "截图", "unknown": "未知"},+ en={"ai_image": "AI-generated image", "photo": "photo", "graphic": "designed / rendered graphic", "screenshot": "screenshot", "unknown": "unknown"})# how much to trust the deterministic layer per label (VLM weight is 1.0)DET_WEIGHT = {"static_hold": 1.6, "still_motion": 1.4, "code_render": 1.0, "screen_capture": 0.6,"cg_3d": 0.5, "live_action": 0.6, "ai_video": 0.6, "avatar": 0.4, "anim_2d": 0.3, "stop_motion": 0.3}@@ -131,14 +145,18 @@ def deterministic(f: dict, overlay: dict | None = None, text: dict | None = Nonesparse_anim = dup > 0.6 and moving > 0.01if frozen and not sparse_anim and f.get("start_end_mad", 0) < 1.0:family = "frozen"- ev.append(f"画面几乎完全静止:{dup:.0%} 的相邻帧逐像素重复,首尾帧差 {f.get('start_end_mad', 0):.2f}")+ ev.append(T("画面几乎完全静止:{dup:.0%} 的相邻帧逐像素重复,首尾帧差 {mad:.2f}",+ "Picture is almost entirely still: {dup:.0%} of adjacent frames are pixel-identical, first-to-last frame difference {mad:.2f}",+ dup=dup, mad=f.get('start_end_mad', 0)))elif kb > 0.45:family = "planar"- ev.append(f"整帧按单一刚体变换运动(拟合内点 {f.get('rigid_inlier_ratio', 0):.0%},残差 {f.get('rigid_residual', 0):.2f}px,无局部运动)"- f"→ 静态图推拉:缩放 {f.get('zoom_per_s', 0) * 100:+.1f}%/s,平移 {f.get('pan_px_per_s', 0):.0f}px/s")+ ev.append(T("整帧按单一刚体变换运动(拟合内点 {inl:.0%},残差 {res:.2f}px,无局部运动)→ 静态图推拉:缩放 {zoom:+.1f}%/s,平移 {pan:.0f}px/s",+ "Whole frame moves as one rigid transform ({inl:.0%} inliers, {res:.2f}px residual, no local motion) → pan/zoom on a still image: zoom {zoom:+.1f}%/s, pan {pan:.0f}px/s",+ inl=f.get('rigid_inlier_ratio', 0), res=f.get('rigid_residual', 0), zoom=f.get('zoom_per_s', 0) * 100, pan=f.get('pan_px_per_s', 0)))elif dup > 0.5:family = "mostly_static"- ev.append(f"{dup:.0%} 的相邻帧完全重复,只有局部元素在动(典型的模板/MG 动画或定格后局部动效)")+ ev.append(T("{dup:.0%} 的相邻帧完全重复,只有局部元素在动(典型的模板/MG 动画或定格后局部动效)",+ "{dup:.0%} of adjacent frames are exact duplicates, only local elements move (typical of template / motion-graphics animation, or a hold with local motion)", dup=dup))else:family = "dynamic"facts["temporal_family"] = family@@ -153,8 +171,9 @@ def deterministic(f: dict, overlay: dict | None = None, text: dict | None = None# judge texture on the lit part only; the palette is small because the shadows are crushedlit_graphic = 0.75 * _sig((f.get("flat_lit", 0) - 0.20) / 0.05) + 0.25 * _sig((axis - 0.33) / 0.03)if lit_graphic < graphic:- ev.append(f"低照度画面:{f.get('dark_ratio', 0):.0%} 的区域接近全黑但带颗粒(不是纯色底),亮部平坦块只有 {f.get('flat_lit', 0):.0%}、"- f"且有人脸:平坦块/少色是暗部被压缩造成的,不按渲染特征算")+ ev.append(T("低照度画面:{dark:.0%} 的区域接近全黑但带颗粒(不是纯色底),亮部平坦块只有 {lit:.0%}、且有人脸:平坦块/少色是暗部被压缩造成的,不按渲染特征算",+ "Low-light shot: {dark:.0%} of the frame is near-black but grainy (not a solid fill), flat blocks cover only {lit:.0%} of the lit part, and there is a face: the flat blocks / small palette come from crushed shadows, not counted as rendered texture",+ dark=f.get('dark_ratio', 0), lit=f.get('flat_lit', 0)))graphic = lit_graphic# a large face held through the shot is a photographic picture: plain walls and dark clothes make flat blocks# after a platform transcode (RULES["big_face"])@@ -163,7 +182,9 @@ def deterministic(f: dict, overlay: dict | None = None, text: dict | None = Nonefacts["big_face"] = big_facefacts["face_area"] = round(f.get("face_area", 0.0), 3) if faces >= 0.3 else 0.0if big_face and graphic > 0.25:- ev.append(f"人脸占画面 {f.get('face_area', 0):.0%}、{faces:.0%} 的采样帧都有:是人物近景画面,平坦色块多来自墙面/衣服,渲染特征降权")+ ev.append(T("人脸占画面 {area:.0%}、{faces:.0%} 的采样帧都有:是人物近景画面,平坦色块多来自墙面/衣服,渲染特征降权",+ "A face covers {area:.0%} of the frame and appears in {faces:.0%} of sampled frames: a close-up of a person, flat colour blocks mostly come from walls / clothing, rendered-texture cues down-weighted",+ area=f.get('face_area', 0), faces=faces))graphic *= bf["graphic_factor"]# (overlay text is a separate layer, so OCR coverage does not count toward the base)photo = 1.0 - graphic@@ -176,20 +197,24 @@ def deterministic(f: dict, overlay: dict | None = None, text: dict | None = Noneui_text = _sig((small_lines - ut["mid"]) / ut["width"])facts["ui_text"] = round(ui_text, 3)if ui_text > 0.5:- ev.append(f"OCR 读到 {small_lines} 行小字号文字:画面里有界面/文档截图")+ ev.append(T("OCR 读到 {n} 行小字号文字:画面里有界面/文档截图", "OCR reads {n} lines of small text: the frame holds a UI / document screenshot", n=small_lines))# background pixels exactly unchanged while something moves = 2D compositing (code/MG)rsb = _sig((zero - 0.94) / 0.015) * _sig((0.1 - tnoise) / 0.03)facts["graphic_score"] = round(graphic, 3)facts["text_like"] = round(text_like, 3)facts["static_composite"] = round(rsb, 3)if graphic > 0.6:- ev.append(f"纹理呈渲染特征:平坦色块 {flat:.0%}、95% 像素仅用 {pal} 种颜色、横竖直边 {axis:.0%}")+ ev.append(T("纹理呈渲染特征:平坦色块 {flat:.0%}、95% 像素仅用 {pal} 种颜色、横竖直边 {axis:.0%}",+ "Rendered texture: {flat:.0%} flat colour blocks, 95% of pixels use only {pal} colours, {axis:.0%} axis-aligned edges", flat=flat, pal=pal, axis=axis))elif graphic < 0.35:- ev.append(f"纹理呈照片/视频特征:噪声 σ={noise:.2f}、用色 {pal} 种、平坦块 {flat:.0%}")+ ev.append(T("纹理呈照片/视频特征:噪声 σ={noise:.2f}、用色 {pal} 种、平坦块 {flat:.0%}",+ "Photographic texture: noise σ={noise:.2f}, {pal} colours, {flat:.0%} flat blocks", noise=noise, pal=pal, flat=flat))if text_like > 0.6:- ev.append("平坦底色上有大量细小高频细节(小字号文字/界面),像截图或文档画面")+ ev.append(T("平坦底色上有大量细小高频细节(小字号文字/界面),像截图或文档画面",+ "Dense fine high-frequency detail on a flat background (small text / UI), looks like a screenshot or document"))if rsb > 0.6 and family != "frozen":- ev.append(f"背景 {zero:.0%} 像素逐帧完全不变、只有局部元素在动:2D 合成/代码动效特征")+ ev.append(T("背景 {zero:.0%} 像素逐帧完全不变、只有局部元素在动:2D 合成/代码动效特征",+ "{zero:.0%} of background pixels never change frame to frame while local elements move: 2D compositing / code-driven motion graphics", zero=zero))# ---- frame-rate fingerprints -------------------------------------------------pulldown = None@@ -204,10 +229,14 @@ def deterministic(f: dict, overlay: dict | None = None, text: dict | None = Noneresampled = (f.get("sharp_alt", 0) > 0.025 or f.get("sharp_period_ac", 0) > 0.45) and not ctx.get("transcoded")if resampled and not pulldown and family == "dynamic":pulldown = "interpolated"- ev.append(f"逐帧清晰度呈周期性起伏(周期 {f.get('sharp_period')} 帧,相关 {f.get('sharp_period_ac', 0):.2f}):画面经过插帧/帧率转换,原始帧率更低")+ ev.append(T("逐帧清晰度呈周期性起伏(周期 {p} 帧,相关 {ac:.2f}):画面经过插帧/帧率转换,原始帧率更低",+ "Per-frame sharpness oscillates periodically (period {p} frames, correlation {ac:.2f}): the footage was frame-interpolated / frame-rate converted from a lower source rate",+ p=f.get('sharp_period'), ac=f.get('sharp_period_ac', 0)))facts["pulldown"] = pulldownif pulldown:- ev.append(f"重复帧呈 {pulldown} 规律({dup:.0%},周期 {per}):原始素材为 24/25fps 后转码,常见于 AI 生成视频、3D/动画渲染或电影素材")+ ev.append(T("重复帧呈 {pd} 规律({dup:.0%},周期 {per}):原始素材为 24/25fps 后转码,常见于 AI 生成视频、3D/动画渲染或电影素材",+ "Duplicate frames follow a {pd} pattern ({dup:.0%}, period {per}): a 24/25fps source transcoded up, typical of AI-generated video, 3D / animation renders or cinema footage",+ pd=pulldown, dup=dup, per=per))live_hint = 0.0live_hint += 1.2 * _sig((noise - 0.9) / 0.2)@@ -221,15 +250,18 @@ def deterministic(f: dict, overlay: dict | None = None, text: dict | None = Nonenative_hfr = bool(fps and fps >= 47 and dup < 0.05 and not pulldown)if native_hfr:live_hint += 1.0- ev.append(f"原生 {fps:.0f}fps 且几乎无重复帧:生成模型通常输出 24/30fps,高帧率原生素材多为手机/相机拍摄")+ ev.append(T("原生 {fps:.0f}fps 且几乎无重复帧:生成模型通常输出 24/30fps,高帧率原生素材多为手机/相机拍摄",+ "Native {fps:.0f}fps with almost no duplicate frames: generators usually output 24/30fps, native high-frame-rate footage is mostly phone / camera captured", fps=fps))facts["native_hfr"] = native_hfrcam_tags = bool((provenance or {}).get("hints", {}).get("camera"))if cam_tags:live_hint += 1.0- ev.append("容器元数据含拍摄设备信息(make/model/location)")+ ev.append(T("容器元数据含拍摄设备信息(make/model/location)", "Container metadata carries capture-device tags (make/model/location)"))if ctx.get("native30") and dup < 0.02 and not pulldown:live_hint += 0.9- ev.append(f"整片是原生 30fps、实拍类镜头没有 24fps 源的重复帧({ctx.get('native30_share', 0):.0%} 时长):手机直出常见,生成模型多输出 24fps")+ ev.append(T("整片是原生 30fps、实拍类镜头没有 24fps 源的重复帧({share:.0%} 时长):手机直出常见,生成模型多输出 24fps",+ "The whole file is native 30fps and photographic shots carry no 24fps-source duplicate frames ({share:.0%} of the duration): typical of straight-from-phone footage, generators mostly output 24fps",+ share=ctx.get('native30_share', 0)))live_hint = min(1.0, max(0.0, live_hint / 2.9))gen_tags0 = bool((provenance or {}).get("hints", {}).get("generator"))degraded = bool(ctx.get("transcoded") and noise < 0.9)@@ -237,16 +269,20 @@ def deterministic(f: dict, overlay: dict | None = None, text: dict | None = Noneif degraded and not pulldown and not gen_tags0 and live_hint < 0.45:# compression erased the sensor noise: its absence no longer argues for AIlive_hint = 0.45- ev.append("经过平台二次转码(" + "、".join(ctx.get("platform", [])) + "),传感器噪声被压没了:噪声类证据失效,实拍还是 AI 主要看帧率和画面内容")+ ev.append(T("经过平台二次转码({plat}),传感器噪声被压没了:噪声类证据失效,实拍还是 AI 主要看帧率和画面内容",+ "Platform transcode ({plat}) has compressed the sensor noise away: noise cues no longer apply, live action vs AI rests on frame rate and picture content",+ plat=join(ctx.get("platform", []))))if live_hint > 0.6:- ev.append(f"时域噪声 {tnoise:.2f}、逐像素不变比例 {zero:.0%}:存在传感器噪声,符合实拍")+ ev.append(T("时域噪声 {tn:.2f}、逐像素不变比例 {zero:.0%}:存在传感器噪声,符合实拍",+ "Temporal noise {tn:.2f}, {zero:.0%} of pixels unchanged frame to frame: sensor noise is present, consistent with live action", tn=tnoise, zero=zero))gen_tags = bool((provenance or {}).get("hints", {}).get("generator"))if gen_tags:- ev.append("容器元数据包含生成式工具/AIGC 标识:" + ", ".join(provenance["hints"]["generator"][:3]))+ ev.append(T("容器元数据包含生成式工具/AIGC 标识:", "Container metadata carries a generative tool / AIGC label: ") + ", ".join(provenance["hints"]["generator"][:3]))speech = bool((audio or {}).get("speech_likely"))if faces > 0.6 and family in ("dynamic", "mostly_static") and f.get("camera") in ("static", "static_with_subject_motion"):- ev.append(f"{faces:.0%} 的采样帧有正脸且机位固定" + (",音轨有人声" if speech else ""))+ ev.append(T("{faces:.0%} 的采样帧有正脸且机位固定", "{faces:.0%} of sampled frames show a frontal face on a fixed camera", faces=faces)+ + (T(",音轨有人声", ", voice on the audio track") if speech else ""))# ---- assemble scores ---------------------------------------------------------s = {k: 0.02 for k in LABELS}@@ -259,7 +295,8 @@ def deterministic(f: dict, overlay: dict | None = None, text: dict | None = Noneelif family == "planar":s["still_motion"] += 3.0 * kb * (0.35 if pulldown else 1.0)if pulldown:- ev.append("但运动带有 24fps 源的帧率转换痕迹:更像生成视频里的缓慢推镜,而不是剪辑软件对静图做推拉")+ ev.append(T("但运动带有 24fps 源的帧率转换痕迹:更像生成视频里的缓慢推镜,而不是剪辑软件对静图做推拉",+ "But the motion carries 24fps-source frame-rate conversion marks: more likely a slow push-in inside a generated video than an editor's pan/zoom on a still"))s["ai_video"] += 1.2s["screen_capture"] += 0.5 * graphic * (1 if abs(f.get("zoom_per_s", 0)) < 0.003 else 0.2) # pure scrolls["ai_video"] += 0.3@@ -280,7 +317,9 @@ def deterministic(f: dict, overlay: dict | None = None, text: dict | None = Nones["cg_3d"] += 1.5 * graphic * max(0.0, 1.1 - rsb - 0.8 * text_like) * (1 - 0.8 * ui_gray) * (1 - 0.8 * ui_text)s["screen_capture"] += 1.2 * graphic * ui_textif ui_gray > 0.5 and graphic > 0.6:- ev.append(f"画面几乎无彩色(饱和度 {f.get('saturation', 0):.2f})、只用 {pal} 种颜色:界面/文档类平面画面,不是有光影的 3D 渲染")+ ev.append(T("画面几乎无彩色(饱和度 {sat:.2f})、只用 {pal} 种颜色:界面/文档类平面画面,不是有光影的 3D 渲染",+ "Nearly colourless frame (saturation {sat:.2f}) with only {pal} colours: a flat UI / document picture, not a shaded 3D render",+ sat=f.get('saturation', 0), pal=pal))s["screen_capture"] += 1.2 * graphic * text_like * (0.3 + _sig((0.12 - f.get("saturation", 0.3)) / 0.04))s["live_action"] += 1.5 * photo * live_hints["ai_video"] += 1.5 * photo * (1 - live_hint) * (1.4 if pulldown else 1.0)@@ -454,16 +493,21 @@ def drop_scene_text(layers: list[dict], label: str, vlm_overlay: list | None) ->return keep, [t for l in dropped for t in l["texts"][:3]]+OVERLAY_KIND_ZH = LangDict({"subtitle": "字幕", "title": "标题", "label": "文字标注", "static_graphic": "图形贴片", "layout_template": "版式模板",+ "huazi": "花字", "animated_sticker": "动态贴纸/GIF", "static_sticker": "静态贴纸", "pip": "画中画"},+ en={"subtitle": "subtitles", "title": "title", "label": "text labels", "static_graphic": "static graphics", "layout_template": "layout template",+ "huazi": "styled text", "animated_sticker": "animated sticker / GIF", "static_sticker": "static sticker", "pip": "picture-in-picture"})++def verdict_text(label: str, image_source: str | None, layers: list[dict]) -> str:base = LABEL_ZH[label]if label in ("static_hold", "still_motion") and image_source and image_source != "unknown":- base += f"({IMAGE_SOURCE_ZH.get(image_source, image_source)})"+ base += T("({s})", " ({s})", s=IMAGE_SOURCE_ZH.get(image_source, image_source))kinds = []for l in layers:- name = {"subtitle": "字幕", "title": "标题", "label": "文字标注", "static_graphic": "图形贴片", "layout_template": "版式模板",- "huazi": "花字", "animated_sticker": "动态贴纸/GIF", "static_sticker": "静态贴纸", "pip": "画中画"}.get(l["kind"], l["kind"])+ name = OVERLAY_KIND_ZH.get(l["kind"], l["kind"])if name not in kinds:kinds.append(name)if kinds:- return f"{base} + 代码/剪辑叠加({'、'.join(kinds)})"+ return T("{base} + 代码/剪辑叠加({kinds})", "{base} + code / editor overlays ({kinds})", base=base, kinds=join(kinds))return basediff --git a/rea_video/cli.py b/rea_video/cli.pyindex 8154f86..d7e7cf0 100644--- a/rea_video/cli.py+++ b/rea_video/cli.py@@ -8,6 +8,7 @@ import sysfrom pathlib import Pathfrom .util import LOG, OCR_LANGS, load_env_files, read_json, setup_logging+from .i18n import LANGS, set_langfrom .classify import LABELSfrom .vlm import vlm_note@@ -48,9 +49,12 @@ def cmd_decompose(args) -> int:meta = read_json(Path(args.meta)) if args.meta else Noneuse_vlm = args.vlm or (pref("vlm") == "on" and not args.no_vlm)stems = not args.no_stems and pref("stems", "on") == "on"+ lang = args.lang or pref("lang", "zh")+ if lang not in LANGS:+ raise SystemExit(f"错误:不支持的报告语言 {lang}(可选:{', '.join(LANGS)})")b = decompose(args.video, out, use_vlm=use_vlm, whole_vlm=not args.no_whole, ocr=not args.no_ocr,workers=args.workers, engine=args.engine or pref("engine", "seedance2.0"), platform_meta=meta, stems=stems,- packaging=not args.no_packaging)+ packaging=not args.no_packaging, lang=lang)print(json.dumps({"out": str(out), "verdict": b["summary"]["verdict"], "shots": b["summary"]["shots"],"confidence": b["summary"]["confidence"], "vlm": b["summary"]["vlm"],"report": str(out / "report.html")}, ensure_ascii=False, indent=2))@@ -63,6 +67,7 @@ def cmd_review(args) -> int:out = Path(args.out_dir)b = read_json(out / "breakdown.json")+ set_lang(b.get("lang", "zh"))tasks, answers = build_tasks(b, str(out))(out / "review_tasks.json").write_text(json.dumps(tasks, ensure_ascii=False, indent=2), encoding="utf-8")ans_path = out / "review_answers.json"@@ -82,6 +87,9 @@ def cmd_apply_review(args) -> int:out = Path(args.out_dir)b = read_json(out / "breakdown.json")+ if args.lang:+ b["lang"] = args.lang+ set_lang(b.get("lang", "zh"))answers = read_json(Path(args.answers) if args.answers else out / "review_answers.json")from .memory import pref@@ -223,16 +231,20 @@ def cmd_tiles(args) -> int:def cmd_summary(args) -> int:"""Compact, agent-friendly view of a breakdown (instead of reading the whole JSON)."""+ from .i18n import T, join+b = read_json(Path(args.breakdown))+ set_lang(b.get("lang", "zh"))s = b["summary"]lines = [f"{b['source']['filename']} | {b['source']['duration']}s {b['source']['width']}x{b['source']['height']} {b['source']['fps']}fps",- f"结论: {s['verdict']}", f"置信度: {s['confidence']}", f"VLM: {s.get('vlm') or vlm_note(b['analysis']['vlm'])}", ""]+ f"{T('结论', 'Verdict')}: {s['verdict']}", f"{T('置信度', 'Confidence')}: {s['confidence']}", f"VLM: {s.get('vlm') or vlm_note(b['analysis']['vlm'])}", ""]vc = b.get("video_context") or {}if vc.get("transcoded"):- lines.append(f"平台转码: {'、'.join(vc.get('platform', []))}(噪声类证据失效;原生 30fps 无重复帧: {vc.get('native30')})")+ lines.append(T("平台转码: {p}(噪声类证据失效;原生 30fps 无重复帧: {n})", "Platform transcode: {p} (noise evidence unusable; native 30fps without duplicate frames: {n})",+ p=join(vc.get("platform", [])), n=vc.get("native30")))prov = b.get("provenance", {})if prov.get("aigc") or prov.get("hints"):- lines.append(f"元数据: aigc={prov.get('aigc')} hints={prov.get('hints')}")+ lines.append(f"{T('元数据', 'Metadata')}: aigc={prov.get('aigc')} hints={prov.get('hints')}")from .aspects import shot_textfrom .memory import hint_for, patterns@@ -243,13 +255,13 @@ def cmd_summary(args) -> int:det = r["deterministic"]["probs"]past = None if base["decided_by"] == "user" else hint_for(max(det, key=det.get), pats)mat = (r.get("material") or {}).get("origin_zh", "")- second = "(用户纠正)" if base["decided_by"] == "user" else f"(次选 {alt[0]} {alt[1]:.2f})"+ second = T("(用户纠正)", "(user correction)") if base["decided_by"] == "user" else T("(次选 {l} {p:.2f})", "(runner-up {l} {p:.2f})", l=alt[0], p=alt[1])lines.append(f"#{r['index']:>2} {r['start']:7.2f}-{r['end']:7.2f} {base['label']:<14} {base['confidence']:.2f} {second} "- f"| 素材:{mat} | 叠加:{','.join(sorted({l['kind'] for l in r.get('layers', [])})) or '-'} | {r['features'].get('camera')}"- + (" ← 低置信,需要复核" if base["confidence"] < 0.6 else "")+ f"| {T('素材', 'material')}:{mat} | {T('叠加', 'overlays')}:{','.join(sorted({l['kind'] for l in r.get('layers', [])})) or '-'} | {r['features'].get('camera')}"+ + (T(" ← 低置信,需要复核", " ← low confidence, review it") if base["confidence"] < 0.6 else "")+ (f" ← {base['uncertain']}" if base.get("uncertain") else "")- + (f" ← 有分歧:{base['disputed']}" if base.get("disputed") else "")- + (" ← 用户纠正过素材来源" if (r.get("material") or {}).get("user_corrected") else "")+ + (T(" ← 有分歧:{d}", " ← disputed: {d}", d=base["disputed"]) if base.get("disputed") else "")+ + (T(" ← 用户纠正过素材来源", " ← material origin corrected by the user") if (r.get("material") or {}).get("user_corrected") else "")+ (f" ← {past}" if past else "")+ (f" | {shot_text(r)}" if r["base"]["label"] in ("live_action", "avatar") and shot_text(r) else ""))if s.get("aspects"):@@ -257,22 +269,24 @@ def cmd_summary(args) -> int:a = b.get("audio", {})if a.get("has_audio"):mu = a.get("music", {})- lines += ["", f"人声: {a.get('voice', {}).get('present')} ({a.get('voice', {}).get('ratio')}) | 音乐: {mu.get('present')} "+ lines += ["", f"{T('人声', 'Voice')}: {a.get('voice', {}).get('present')} ({a.get('voice', {}).get('ratio')}) | {T('音乐', 'Music')}: {mu.get('present')} "f"{mu.get('tempo_bpm')}BPM {(mu.get('key') or {}).get('tonic', '')}{(mu.get('key') or {}).get('mode', '')} | "- f"音效: {len((b.get('audio_plan') or {}).get('sfx_merged', []))} | 卡点: {a.get('beat_synced_edit')}"]+ f"{T('音效', 'SFX')}: {len((b.get('audio_plan') or {}).get('sfx_merged', []))} | {T('卡点', 'beat-synced')}: {a.get('beat_synced_edit')}"]if (b.get("sound_sources") or {}).get("summary_zh"):- lines.append("声音来源: " + b["sound_sources"]["summary_zh"])+ lines.append(f"{T('声音来源', 'Sound sources')}: " + b["sound_sources"]["summary_zh"])if (b.get("stems") or {}).get("ok"):- lines.append("音轨: stems/original.wav(原声) stems/vocals.wav(人声) stems/music.wav(配乐)")+ lines.append(T("音轨: stems/original.wav(原声) stems/vocals.wav(人声) stems/music.wav(配乐)",+ "Stems: stems/original.wav (original) stems/vocals.wav (voice) stems/music.wav (music)"))pk = b.get("packaging")if pk:- lines += [""] + [f"包装: {x}" for x in (pk.get("summary_zh") or ["没有检出后期叠加的文字或贴纸"])]+ tag = T("包装", "Packaging")+ lines += [""] + [f"{tag}: {x}" for x in (pk.get("summary_zh") or [T("没有检出后期叠加的文字或贴纸", "no overlaid text or stickers detected")])]low = [st for st in pk.get("stickers", []) if not st.get("in_picture") and st.get("confidence") in ("low", "vlm")]if low:- lines.append("包装: 需要看图确认的贴纸 " + "、".join(f"{st['id']} {st['t0']:.1f}-{st['t1']:.1f}s" for st in low)- + "(截图在 packaging/)")+ lines.append(f"{tag}: " + T("需要看图确认的贴纸 ", "stickers to confirm by eye ") + join(f"{st['id']} {st['t0']:.1f}-{st['t1']:.1f}s" for st in low)+ + T("(截图在 packaging/)", " (crops under packaging/)"))if pk.get("files"):- lines.append("包装文件: " + " ".join(pk["files"].values()))+ lines.append(f"{T('包装文件', 'Packaging files')}: " + " ".join(pk["files"].values()))print("\n".join(lines))return 0@@ -349,6 +363,7 @@ def main(argv: list[str] | None = None) -> int:d.add_argument("--no-ocr", action="store_true", help="不做 OCR(字幕/花字时间轴也会跳过,只剩贴纸检测)")d.add_argument("--ocr-lang", choices=OCR_LANGS, help="字幕/花字的语言:zh 中英(默认)、ja 日文(首次使用自动下载识别模型);也可用 prefs ocr_lang 设成默认")d.add_argument("--no-packaging", action="store_true", help="跳过剪辑包装层(整片字幕时间轴、花字、贴纸/动图、音效卡点);省掉约每分钟 30–50 秒")+ d.add_argument("--lang", choices=LANGS, help="报告、结论和 VLM 描述的语言:zh(默认)/ en;按用户提问的语言选,也可用 prefs lang 设成默认")d.add_argument("--workers", type=int, default=3)d.add_argument("--engine", help="复刻计划使用的 capsule-cinema 视频引擎(默认 prefs 里的 engine,否则 seedance2.0)")d.add_argument("--meta", help='平台元数据 JSON,例如 {"music": {"title": "xx", "author": "yy", "is_original": false, "popular": true}}')@@ -436,6 +451,7 @@ def main(argv: list[str] | None = None) -> int:ar.add_argument("out_dir")ar.add_argument("answers", nargs="?", help="答案文件(默认 <out_dir>/review_answers.json)")ar.add_argument("--by", help="复核者名字(写进报告)")+ ar.add_argument("--lang", choices=LANGS, help="在这一步换报告语言:结论、证据和报告文字重新生成,VLM 已写好的描述和提示词保持原语言")ar.set_defaults(func=cmd_apply_review)co = sub.add_parser("correct", help="用户指出判错:改正这条视频的结论,并记入记忆(以后同类镜头会提示复核)")diff --git a/rea_video/i18n.py b/rea_video/i18n.pynew file mode 100644index 0000000..4b34f3c--- /dev/null+++ b/rea_video/i18n.py@@ -0,0 +1,77 @@+"""Report language.++Chinese is the source language of every user-facing string; English sits next to it. Two helpers:++ T("中文", "English") pick the string for the current report language (optional .format kwargs)+ LangDict(zh={...}, en={...}) a code -> text mapping that resolves per language, so existing `X_ZH[code]`+ lookups (and the `*_zh` fields they fill in breakdown.json) follow the language++The language is set once per run (`set_lang`), from `--lang` / prefs, and stored in breakdown["lang"] so+`finalize` / `summary` / `apply-review` render later in the same language. Default: zh.+"""+from __future__ import annotations++import contextvars+from collections.abc import Mapping+from typing import Iterator++LANGS = ("zh", "en")+LANG_NAMES = {"zh": "中文", "en": "English"}+_lang: contextvars.ContextVar[str] = contextvars.ContextVar("rea_video_lang", default="zh")+++def set_lang(lang: str | None) -> str:+ lang = (lang or "zh").lower()+ if lang not in LANGS:+ raise ValueError(f"unsupported report language {lang!r} (choose from {', '.join(LANGS)})")+ _lang.set(lang)+ return lang+++def lang() -> str:+ return _lang.get()+++def T(zh: str, en: str | None = None, **kw) -> str:+ """Text for the current language; `en` missing falls back to zh. kwargs are applied with str.format."""+ s = en if (en is not None and _lang.get() == "en") else zh+ return s.format(**kw) if kw else s+++def sep() -> str:+ """List separator: 、 in Chinese, ", " in English."""+ return "、" if _lang.get() == "zh" else ", "+++def join(items) -> str:+ return sep().join(str(x) for x in items)+++def semi() -> str:+ """Clause separator: ; in Chinese, "; " in English."""+ return ";" if _lang.get() == "zh" else "; "+++class LangDict(Mapping):+ """code -> display text, resolved per language. Keys and iteration follow the zh table."""++ def __init__(self, zh: dict, en: dict | None = None):+ self._zh = dict(zh)+ self._en = dict(en or {})++ def __getitem__(self, key):+ if _lang.get() == "en" and key in self._en:+ return self._en[key]+ return self._zh[key]++ def __iter__(self) -> Iterator:+ return iter(self._zh)++ def __len__(self) -> int:+ return len(self._zh)++ def __contains__(self, key) -> bool:+ return key in self._zh++ def __repr__(self) -> str:+ return f"LangDict({dict(self.items())!r})"diff --git a/rea_video/memory.py b/rea_video/memory.pyindex 50b1c33..f684b50 100644--- a/rea_video/memory.py+++ b/rea_video/memory.py@@ -18,6 +18,7 @@ from collections import Counterfrom pathlib import Pathfrom .classify import LABEL_ZH, LABELS, top+from .i18n import T, semifrom .util import OCR_LANGSPREF_KEYS = {@@ -27,6 +28,7 @@ PREF_KEYS = {"stems": "decompose 是否默认做人声/配乐分离:on / off","reviewer": "apply-review 默认的复核者名字","ocr_lang": "字幕/花字 OCR 的语言:zh(中英,默认)/ ja(日文,首次使用自动下载约 10 MB 识别模型)",+ "lang": "报告和结论的语言:zh(默认)/ en;agent 应按用户提问的语言选,用户明确指定时以指定为准",}ON_OFF = ("on", "off")HINT_MIN = 2 # a correction pattern becomes a hint once it has been seen this many times@@ -216,36 +218,39 @@ def hint_for(tool_label: str, pats: list[dict]) -> str | None:hits = [p for p in pats if p["tool"] == tool_label and p["count"] >= HINT_MIN]if not hits:return None- return ";".join(f"用户过去 {p['count']} 次把工具判的「{LABEL_ZH.get(p['tool'], p['tool'])}」改成「{LABEL_ZH[p['right']]}」"- for p in hits) + ",请重点核对"+ return semi().join(T("用户过去 {n} 次把工具判的「{a}」改成「{b}」", "users have changed the tool's \"{a}\" to \"{b}\" {n} times before",+ n=p['count'], a=LABEL_ZH.get(p['tool'], p['tool']), b=LABEL_ZH[p['right']])+ for p in hits) + T(",请重点核对", "; check this one carefully")def summary_lines() -> list[str]:prefs = load_prefs()cs = load_corrections()- lines = [f"记忆目录: {home()}"]+ lines = [T("记忆目录: {h}", "Memory dir: {h}", h=home())]set_prefs = {k: v for k, v in prefs.items() if k in PREF_KEYS}- lines.append("偏好: " + (",".join(f"{k}={v}" for k, v in set_prefs.items()) if set_prefs else "(未设置)"))+ lines.append(T("偏好: ", "Preferences: ") + (T(",", ", ").join(f"{k}={v}" for k, v in set_prefs.items()) if set_prefs else T("(未设置)", "(none set)")))for i, n in enumerate(prefs.get("notes", []), 1):- lines.append(f" 说明 {i}: {n}")+ lines.append(T(" 说明 {i}: {n}", " Note {i}: {n}", i=i, n=n))if not cs:- lines.append("纠正: 还没有记录(用户指出判错时运行 rea-video correct)")+ lines.append(T("纠正: 还没有记录(用户指出判错时运行 rea-video correct)", "Corrections: none yet (run rea-video correct when the user points out a wrong call)"))return linesvideos = {c.get("video_key") for c in cs}- lines.append(f"纠正: {len(cs)} 条,涉及 {len(videos)} 条视频")+ lines.append(T("纠正: {n} 条,涉及 {v} 条视频", "Corrections: {n} across {v} videos", n=len(cs), v=len(videos)))for p in patterns(cs):- extra = [f"VLM 也判错 {p['vlm_wrong']}"] if p["vlm_wrong"] else []- extra += [f"agent 复核也判错 {p['review_wrong']}"] if p["review_wrong"] else []- extra += [f"其中转码视频 {p['transcoded']}"] if p["transcoded"] else []- lines.append(f" 工具「{LABEL_ZH.get(p['tool'], p['tool'])}」→ 用户「{LABEL_ZH[p['right']]}」 {p['count']} 个镜头 / {p['videos']} 条视频"- + (f"({','.join(extra)})" if extra else ""))+ extra = [T("VLM 也判错 {n}", "VLM also wrong {n}", n=p['vlm_wrong'])] if p["vlm_wrong"] else []+ extra += [T("agent 复核也判错 {n}", "agent review also wrong {n}", n=p['review_wrong'])] if p["review_wrong"] else []+ extra += [T("其中转码视频 {n}", "{n} transcoded", n=p['transcoded'])] if p["transcoded"] else []+ lines.append(T(" 工具「{a}」→ 用户「{b}」 {c} 个镜头 / {v} 条视频", " tool \"{a}\" → user \"{b}\": {c} shots / {v} videos",+ a=LABEL_ZH.get(p['tool'], p['tool']), b=LABEL_ZH[p['right']], c=p['count'], v=p['videos'])+ + (T("({e})", " ({e})", e=T(",", ", ").join(extra)) if extra else ""))real = [c for c in cs if c.get("real_material") is not None and c["real_material"] != c.get("real_before")]if real:- lines.append(f" 真实素材判断被纠正 {len(real)} 次(漏标 {sum(1 for c in real if c['real_material'])},"- f"误标 {sum(1 for c in real if not c['real_material'])})")+ lines.append(T(" 真实素材判断被纠正 {n} 次(漏标 {m},误标 {f})", " real-material calls corrected {n} times (missed {m}, false {f})",+ n=len(real), m=sum(1 for c in real if c['real_material']), f=sum(1 for c in real if not c['real_material'])))for c in [c for c in cs if c.get("note")][-5:]:- lines.append(f" 备注({c['video']} {c['shot']}): {c['note']}")- lines.append("把纠正过的视频导出为评测样本:rea-video memory --export-labels eval/user_labels.yaml")+ lines.append(T(" 备注({v} {s}): {n}", " note ({v} {s}): {n}", v=c['video'], s=c['shot'], n=c['note']))+ lines.append(T("把纠正过的视频导出为评测样本:rea-video memory --export-labels eval/user_labels.yaml",+ "Export the corrected videos as eval samples: rea-video memory --export-labels eval/user_labels.yaml"))return linesdiff --git a/rea_video/packaging.py b/rea_video/packaging.pyindex 0e81f1f..a3f4b05 100644--- a/rea_video/packaging.py+++ b/rea_video/packaging.py@@ -21,6 +21,8 @@ Everything here is deterministic and best effort: styles and animations are measor the agent's look at the frames still settles fine typography (font family) and odd cases."""from __future__ import annotations+from .i18n import LangDict, T, join, semi+import refrom difflib import SequenceMatcherfrom pathlib import Path@@ -41,39 +43,56 @@ SMALL_W = 160 # sticker search resolutionCELL = 8 # sticker search cell size (px at SMALL_W)MIN_CONF = 0.6-KIND_ZH = {"subtitle": "字幕", "huazi": "花字", "title": "标题", "label": "文字标注", "scene": "画面里的字"}-ANIM_ZH = {"cut": "直接出现", "pop": "缩放弹出", "fade": "淡入", "slide": "滑入", "reveal": "逐字出现",- "cut_out": "直接消失", "pop_out": "缩小消失", "fade_out": "淡出", "slide_out": "滑出"}-STICKER_ZH = {"animated_sticker": "动态贴纸/GIF", "static_sticker": "静态贴纸/图片", "pip": "画中画小窗"}+KIND_ZH = LangDict({"subtitle": "字幕", "huazi": "花字", "title": "标题", "label": "文字标注", "scene": "画面里的字"},+ en={"subtitle": "subtitle", "huazi": "styled text", "title": "title", "label": "text label", "scene": "text in the scene"})+ANIM_ZH = LangDict({"cut": "直接出现", "pop": "缩放弹出", "fade": "淡入", "slide": "滑入", "reveal": "逐字出现",+ "cut_out": "直接消失", "pop_out": "缩小消失", "fade_out": "淡出", "slide_out": "滑出"},+ en={"cut": "hard in", "pop": "scale pop", "fade": "fade in", "slide": "slide in", "reveal": "type-on",+ "cut_out": "hard out", "pop_out": "shrink out", "fade_out": "fade out", "slide_out": "slide out"})+STICKER_ZH = LangDict({"animated_sticker": "动态贴纸/GIF", "static_sticker": "静态贴纸/图片", "pip": "画中画小窗"},+ en={"animated_sticker": "animated sticker / GIF", "static_sticker": "static sticker / image", "pip": "picture-in-picture"})+COLOR_ZH = LangDict({"black": "黑", "white": "白", "grey": "灰", "red": "红", "brown": "棕", "orange": "橙", "yellow": "黄", "green": "绿",+ "cyan": "青", "blue": "蓝", "purple": "紫", "pink": "粉"},+ en={"black": "black", "white": "white", "grey": "grey", "red": "red", "brown": "brown", "orange": "orange", "yellow": "yellow",+ "green": "green", "cyan": "cyan", "blue": "blue", "purple": "purple", "pink": "pink"})+BAND_ZH = LangDict({"top": "顶部", "middle": "中部", "bottom": "底部"}, en={"top": "top", "middle": "middle", "bottom": "bottom"})+EVENT_ZH = LangDict({"subtitle_in": "字幕出现", "huazi_in": "花字出现", "title_in": "标题出现", "label_in": "文字标注出现",+ "sticker_in": "贴纸出现", "sticker_out": "贴纸消失", "cut": "切镜"},+ en={"subtitle_in": "subtitle in", "huazi_in": "styled text in", "title_in": "title in", "label_in": "text label in",+ "sticker_in": "sticker in", "sticker_out": "sticker out", "cut": "cut"})# ----------------------------------------------------------------------------- colour helpersdef color_name(bgr) -> str:+ return COLOR_ZH[_color_code(bgr)]+++def _color_code(bgr) -> str:b, g, r = (int(v) for v in bgr)hsv = cv2.cvtColor(np.uint8([[[b, g, r]]]), cv2.COLOR_BGR2HSV)[0, 0]h, s, v = int(hsv[0]) * 2, int(hsv[1]), int(hsv[2])if v < 55:- return "黑"+ return "black"if s < 40:- return "白" if v > 200 else "灰"+ return "white" if v > 200 else "grey"if s < 90 and v < 150:- return "灰"+ return "grey"if h < 12 or h >= 340:- return "红" if v > 110 else "棕"+ return "red" if v > 110 else "brown"if h < 40:- return "橙" if v > 150 else "棕"+ return "orange" if v > 150 else "brown"if h < 68:- return "黄"+ return "yellow"if h < 165:- return "绿"+ return "green"if h < 195:- return "青"+ return "cyan"if h < 255:- return "蓝"+ return "blue"if h < 295:- return "紫"- return "粉"+ return "purple"+ return "pink"def _hex(bgr) -> str:@@ -467,36 +486,36 @@ def merge_style(styles: list[dict]) -> dict:def style_text(st: dict, line_h: float | None = None, frame_h: int | None = None) -> str:if not st:return ""- parts = [f"{st.get('fill_name', '?')}字"]+ parts = [T("{c}字", "{c} text", c=st.get('fill_name', '?'))]if st.get("stroke"):- parts.append(f"{st['stroke_name']}描边")+ parts.append(T("{c}描边", "{c} outline", c=st['stroke_name']))if st.get("box"):- parts.append(f"{st.get('box_name', '')}底框")+ parts.append(T("{c}底框", "{c} box", c=st.get('box_name', '')).strip())if st.get("gradient"):- parts.append("渐变")+ parts.append(T("渐变", "gradient"))if st.get("multicolor"):- parts.append(f"关键词{st.get('highlight_name', '')}色高亮")+ parts.append(T("关键词{c}色高亮", "keywords highlighted in {c}" if st.get('highlight_name') else "keyword highlight", c=st.get('highlight_name', '')))if st.get("weight", 0) > 0.2:- parts.append("粗体")+ parts.append(T("粗体", "bold"))if line_h:- parts.append(f"字高 {line_h:.1%}" + (f"(约 {line_h * frame_h:.0f}px)" if frame_h else ""))- return "、".join(parts)+ parts.append(T("字高 {h:.1%}", "line height {h:.1%}", h=line_h) + (T("(约 {px:.0f}px)", " (about {px:.0f}px)", px=line_h * frame_h) if frame_h else ""))+ return join(parts)def _decor_score(c: dict) -> tuple[int, list[str]]:st, why = c.get("style") or {}, []if c["line_h"] >= 0.045:- why.append("字号大")+ why.append(T("字号大", "large size"))if abs(c["angle"]) >= 4:- why.append("倾斜")- if st.get("fill_name") not in (None, "白", "黑", "灰"):- why.append(f"{st['fill_name']}色字")+ why.append(T("倾斜", "tilted"))+ if st.get("fill_name") not in (None, COLOR_ZH["white"], COLOR_ZH["black"], COLOR_ZH["grey"]):+ why.append(T("{c}色字", "{c} fill", c=st['fill_name']))if st.get("multicolor") or st.get("gradient"):- why.append("多色/渐变")+ why.append(T("多色/渐变", "multi-colour / gradient"))if st.get("stroke") and st.get("stroke_ratio", 0) >= 0.06:- why.append("粗描边")+ why.append(T("粗描边", "thick outline"))if (c.get("anim_in") or {}).get("kind") == "pop":- why.append("弹出入场")+ why.append(T("弹出入场", "pop-in entrance"))return len(why), why@@ -535,7 +554,7 @@ def classify_cues(cues: list[dict], duration: float) -> None:moving = c["drift"] > 0.04 and c["samples"] >= 2if moving and not (st.get("stroke") or st.get("box")):kind = "scene"- why = ["跟着画面移动、没有描边或底框"]+ why = [T("跟着画面移动、没有描边或底框", "moves with the picture, no outline or box")]elif c.get("_sub_lane") and not (score >= 3 and c["line_h"] >= 0.05):kind = "subtitle"elif cy < 0.3 and (dur >= 0.5 * duration or dur >= 8) and not moving and c.get("_lane_texts", 1) == 1:@@ -910,7 +929,7 @@ def _static_blocks(small: np.ndarray, Dc: np.ndarray, dstep: float, cut_idx: liscontinuest = _sticker(o["box"], o["a"], o["b"], False, False, small, Dc, dstep, gh, gw)st.update(kind="static_sticker", kind_zh=STICKER_ZH["static_sticker"], appears_mid_shot=True, confidence="medium",- evidence="周围画面在动、这一块不动且边界清楚")+ evidence=T("周围画面在动、这一块不动且边界清楚", "the picture around it moves while this block holds still with a clean edge"))res.append(st)return res@@ -1045,16 +1064,16 @@ def visual_events(cues: list[dict], stickers: list[dict], cuts: list[float]) ->for c in cues:if c["kind"] == "scene":continue- what = f"{c['kind_zh']}「{c['text'].replace('/', ' ')[:16]}」出现"+ what = T("{k}「{t}」出现", "{k} \"{t}\" appears", k=c['kind_zh'], t=c['text'].replace('/', ' ')[:16])ev.append({"t": c["t0"], "type": f"{c['kind']}_in", "what": what, "ref": c["id"]})if c.get("mid_motion"):ev.append({"t": None, "type": "mid", "ref": c["id"]})for s in stickers:- ev.append({"t": s["t0"], "type": "sticker_in", "what": f"{s['kind_zh']}出现", "ref": s["id"]})+ ev.append({"t": s["t0"], "type": "sticker_in", "what": T("{k}出现", "{k} appears", k=s['kind_zh']), "ref": s["id"]})if s.get("disappears_mid_shot"):- ev.append({"t": s["t1"], "type": "sticker_out", "what": f"{s['kind_zh']}消失", "ref": s["id"]})+ ev.append({"t": s["t1"], "type": "sticker_out", "what": T("{k}消失", "{k} disappears", k=s['kind_zh']), "ref": s["id"]})for t in cuts:- ev.append({"t": t, "type": "cut", "what": "切镜", "ref": None})+ ev.append({"t": t, "type": "cut", "what": T("切镜", "cut"), "ref": None})return [e for e in ev if e["t"] is not None]@@ -1263,39 +1282,39 @@ def summary_lines(pack: dict, sfx_align: dict | None = None) -> list[str]:if k:anim[k] = anim.get(k, 0) + 1lines = max(c["n_lines"] for c in subs)- bands = {{"top": "顶部", "middle": "中部", "bottom": "底部"}.get(c["band"], c["band"]) for c in subs}- L.append(f"字幕 {len(subs)} 句({'/'.join(sorted(bands))},最多 {lines} 行):{style_text(st, float(np.median([c['line_h'] for c in subs])))}"- + (f";入场:{'、'.join(f'{k}×{v}' for k, v in sorted(anim.items(), key=lambda kv: -kv[1]))}" if anim else "")- + (";说到关键词时变色" if any((c.get('style') or {}).get('highlight_timing') == 'spoken' for c in subs) else "")- + (";句中有弹跳/变色动效" if sum(1 for c in subs if c.get("mid_motion")) >= max(2, 0.2 * len(subs)) else ""))+ bands = {BAND_ZH.get(c["band"], c["band"]) for c in subs}+ L.append(T("字幕 {n} 句({b},最多 {l} 行):{s}", "{n} subtitle lines ({b}, up to {l} rows): {s}",+ n=len(subs), b='/'.join(sorted(bands)), l=lines, s=style_text(st, float(np.median([c['line_h'] for c in subs]))))+ + (T(";入场:{a}", "; entrance: {a}", a=join(f'{k}×{v}' for k, v in sorted(anim.items(), key=lambda kv: -kv[1]))) if anim else "")+ + (T(";说到关键词时变色", "; keywords change colour as they are spoken") if any((c.get('style') or {}).get('highlight_timing') == 'spoken' for c in subs) else "")+ + (T(";句中有弹跳/变色动效", "; bounce / colour-change motion inside lines") if sum(1 for c in subs if c.get("mid_motion")) >= max(2, 0.2 * len(subs)) else ""))for kind in ("huazi", "title", "label"):cs = [c for c in cues if c["kind"] == kind]if cs:- names = "、".join(f"「{c['text'].replace('/', ' ')[:14]}」" for c in cs[:6]) + ("等" if len(cs) > 6 else "")+ names = join(T("「{t}」", "\"{t}\"", t=c['text'].replace('/', ' ')[:14]) for c in cs[:6]) + (T("等", " …") if len(cs) > 6 else "")extra = ""if kind == "huazi":- extra = "(" + "、".join(dict.fromkeys(w for c in cs for w in c.get("decor", []))) + ")"+ extra = T("({d})", " ({d})", d=join(dict.fromkeys(w for c in cs for w in c.get("decor", []))))if kind == "label" and any(c.get("follows") for c in cs):- extra = f"(其中 {sum(1 for c in cs if c.get('follows'))} 个跟着物体移动)"- L.append(f"{KIND_ZH[kind]} {len(cs)} 处{extra}:{names}")+ extra = T("(其中 {n} 个跟着物体移动)", " ({n} of them follow an object)", n=sum(1 for c in cs if c.get('follows')))+ L.append(T("{k} {n} 处{e}:{names}", "{k} ×{n}{e}: {names}", k=KIND_ZH[kind], n=len(cs), e=extra, names=names))st_all = [s for s in pack.get("stickers", []) if not s.get("in_picture")]st = [s for s in st_all if s.get("confidence") != "low"]maybe = len(st_all) - len(st)if maybe:- L.append(f"另有 {maybe} 处疑似贴纸(画面里一块突然变了,可能只是画面内容),需要看图确认")+ L.append(T("另有 {n} 处疑似贴纸(画面里一块突然变了,可能只是画面内容),需要看图确认",+ "{n} more possible stickers (a block of the picture changed suddenly; may just be picture content), check the frames", n=maybe))if st:kinds: dict[str, int] = {}for s in st:kinds[s["kind_zh"]] = kinds.get(s["kind_zh"], 0) + 1loops = sum(1 for s in st if s.get("looping"))- L.append("贴纸/动图 " + "、".join(f"{k} {v} 处" for k, v in kinds.items()) + (f"({loops} 处循环播放)" if loops else "")- + (";VLM 看到的没有截图,需要核对" if any(s.get("confidence") == "vlm" for s in st) else ""))+ L.append(T("贴纸/动图 ", "Stickers / GIFs: ") + join(T("{k} {v} 处", "{k} ×{v}", k=k, v=v) for k, v in kinds.items()) + (T("({n} 处循环播放)", " ({n} looping)", n=loops) if loops else "")+ + (T(";VLM 看到的没有截图,需要核对", "; seen by the VLM without a frame grab, needs checking") if any(s.get("confidence") == "vlm" for s in st) else ""))if sfx_align:on = sfx_align.get("sfx_on", {})if on:- zh = {"subtitle_in": "字幕出现", "huazi_in": "花字出现", "title_in": "标题出现", "label_in": "文字标注出现",- "sticker_in": "贴纸出现", "sticker_out": "贴纸消失", "cut": "切镜"}- L.append("音效卡点:" + "、".join(f"{zh.get(k, k)} {v} 处" for k, v in sorted(on.items(), key=lambda kv: -kv[1])))+ L.append(T("音效卡点:", "SFX hits on: ") + join(T("{k} {v} 处", "{k} ×{v}", k=EVENT_ZH.get(k, k), v=v) for k, v in sorted(on.items(), key=lambda kv: -kv[1])))return L@@ -1304,7 +1323,8 @@ def summary_lines(pack: dict, sfx_align: dict | None = None) -> list[str]:# bases whose own picture has things popping in and out (cards, UI, animated objects): a block that appears# mid-shot there is content unless it also crosses a cut or loops like a GIFCONTENT_BASES = ("code_render", "screen_capture", "cg_3d", "anim_2d", "stop_motion")-LAYER_ZH = {"huazi": "花字", "animated_sticker": "动态贴纸/GIF", "static_sticker": "静态贴纸", "pip": "画中画"}+LAYER_ZH = LangDict({"huazi": "花字", "animated_sticker": "动态贴纸/GIF", "static_sticker": "静态贴纸", "pip": "画中画"},+ en={"huazi": "styled text", "animated_sticker": "animated sticker / GIF", "static_sticker": "static sticker", "pip": "picture-in-picture"})def clean_region(stickers: list[dict], t0: float, t1: float, min_area: float = 0.45) -> tuple[float, float, float, float] | None:@@ -1347,7 +1367,7 @@ def shot_layers(pack: dict, rec: dict, label: str) -> list[dict]:if (label in CONTENT_BASES and s.get("confirmed") is None and s.get("bbox") and not (s.get("crosses_cut") or s.get("looping"))and ov >= 0.5 * (s["t1"] - s["t0"])):s["in_picture"] = True # a thing appearing inside an animated / rendered picture, not a pasted layer- s["in_picture_why"] = f"出现在{label}画面里、不跨切镜也不循环:更像画面内容本身"+ s["in_picture_why"] = T("出现在{l}画面里、不跨切镜也不循环:更像画面内容本身", "appears inside a {l} picture, does not cross a cut or loop: more likely picture content", l=label)continueif not s.get("in_picture") and s.get("confidence") != "low":band = _band(s["bbox"][1] + s["bbox"][3] / 2) if s.get("bbox") else None@@ -1368,8 +1388,8 @@ def merge_vlm(pack: dict, whole: dict | None) -> None:if any(min(b, o["t1"]) - max(a, o["t0"]) > 0 for o in pack.get("stickers", []) if not o.get("in_picture")):continuepack.setdefault("stickers", []).append({"id": f"sticker_vlm_{len(pack['stickers']) + 1:02d}", "kind": "animated_sticker"- if "gif" in str(s.get("what", "")).lower() or "动" in str(s.get("what", "")) else "static_sticker",- "kind_zh": str(s.get("what") or "贴纸"), "t0": round(a, 2), "t1": round(b, 2),+ if any(w in str(s.get("what", "")).lower() for w in ("gif", "anim")) or "动" in str(s.get("what", "")) else "static_sticker",+ "kind_zh": str(s.get("what") or T("贴纸", "sticker")), "t0": round(a, 2), "t1": round(b, 2),"where": s.get("where", ""), "bbox": None, "confidence": "vlm", "source": "vlm"})pack["vlm_text_effects"] = [e for e in (whole.get("text_effects") or []) if isinstance(e, dict)][:60]@@ -1396,7 +1416,7 @@ def apply_review(pack: dict) -> None:st["what"] = a["what"]else:st["in_picture"] = True- st["in_picture_why"] = f"{rv.get('by', 'agent')} 看图:画面本身的东西"+ st["in_picture_why"] = T("{by} 看图:画面本身的东西", "{by} looked at the frames: part of the picture itself", by=rv.get('by', 'agent'))ids = {st["id"] for st in pack.get("stickers", [])}for k, m in enumerate(rv.get("missed", []), 1):sid = f"sticker_agent_{k:02d}"@@ -1407,8 +1427,8 @@ def apply_review(pack: dict) -> None:t1 = float(m.get("t1", t0 + 1.0))except (TypeError, ValueError):continue- what = str(m.get("what") or "贴纸")- pack.setdefault("stickers", []).append({"id": sid, "kind": "animated_sticker" if ("gif" in what.lower() or "动" in what) else "static_sticker",+ what = str(m.get("what") or T("贴纸", "sticker"))+ pack.setdefault("stickers", []).append({"id": sid, "kind": "animated_sticker" if (any(w in what.lower() for w in ("gif", "anim")) or "动" in what) else "static_sticker","kind_zh": what, "t0": round(t0, 2), "t1": round(max(t1, t0 + 0.2), 2), "bbox": None,"where": str(m.get("where", "")), "confidence": "confirmed", "source": "agent"})diff --git a/rea_video/pipeline.py b/rea_video/pipeline.pyindex 320d27f..138a460 100644--- a/rea_video/pipeline.py+++ b/rea_video/pipeline.py@@ -12,7 +12,7 @@ from . import SCHEMA, __version__from .assets import detect_embedded, material_summaryfrom .audio import analyze_audio, merge_audio_with_vlmfrom .sound_source import MUSIC_ZH, classify_sound_sources, per_clip_audio-from .classify import LABEL_ZH, RULES, UNMEASURED, decide, deterministic, drop_scene_text, fuse, group_of, image_source_guess, overlay_layers, top, verdict_text, video_context+from .classify import LABEL_ZH, OVERLAY_KIND_ZH, RULES, UNMEASURED, decide, deterministic, drop_scene_text, fuse, group_of, image_source_guess, overlay_layers, top, verdict_text, video_contextfrom .features import collect_samples, shot_featuresfrom .media import cut_clip, extract_frame, require_tools, video_infofrom .overlay import ocr_frames, persistent_template, static_overlays, summarize_text@@ -23,7 +23,8 @@ from .util import LOG, fmt_time, round_floats, write_jsonfrom . import aspectsfrom .faces import shot_facesfrom .visual import LABEL_SHORT, shot_sheet, storyboard-from .vlm import SHOT_PROMPT, WHOLE_PROMPT, VLMClient, VLMConfig, normalize_shot_result, shot_hints, vlm_note+from .i18n import T, join, semi, set_lang+from .vlm import SHOT_PROMPT, WHOLE_PROMPT, VLMClient, VLMConfig, normalize_shot_result, prompt_lang_note, shot_hints, vlm_notedef _sha256_head(path: Path, limit: int = 64 << 20) -> str:@@ -35,7 +36,9 @@ def _sha256_head(path: Path, limit: int = 64 << 20) -> str:def decompose(video: str | Path, out_dir: str | Path, *, use_vlm: bool = False, whole_vlm: bool = True,ocr: bool = True, workers: int = 3, engine: str = "seedance2.0", max_shots_vlm: int = 60,- platform_meta: dict | None = None, stems: bool = True, memory: bool = True, packaging: bool = True) -> dict:+ platform_meta: dict | None = None, stems: bool = True, memory: bool = True, packaging: bool = True,+ lang: str = "zh") -> dict:+ lang = set_lang(lang)require_tools()t0 = time.time()video = Path(video).expanduser().resolve()@@ -139,7 +142,7 @@ def decompose(video: str | Path, out_dir: str | Path, *, use_vlm: bool = False,media += [(out / rec["assets"]["first_frame"], "image/jpeg"), (out / rec["assets"]["sheet"], "image/jpeg"),(out / rec["assets"]["last_frame"], "image/jpeg")]dl, dp = top(rec["deterministic"]["probs"])- prompt = SHOT_PROMPT.format(hints=shot_hints(rec["features"], rec["deterministic"]["facts"], dl, dp))+ prompt = SHOT_PROMPT.format(hints=shot_hints(rec["features"], rec["deterministic"]["facts"], dl, dp)) + prompt_lang_note()try:rec["vlm"] = normalize_shot_result(client.ask_json(prompt, media))except Exception as exc: # keep going; deterministic result stands@@ -159,7 +162,7 @@ def decompose(video: str | Path, out_dir: str | Path, *, use_vlm: bool = False,try:low = cut_clip(video, 0, info.duration, out / "clips" / "whole_480p.mp4", width=480, audio=True, crf=30)cuts = ", ".join(f"{r['start']:.2f}" for r in shot_records)- whole = client.ask_json(WHOLE_PROMPT.format(shots=cuts), [(low, "video/mp4")], max_tokens=6000)+ whole = client.ask_json(WHOLE_PROMPT.format(shots=cuts) + prompt_lang_note(), [(low, "video/mp4")], max_tokens=6000)except Exception as exc:vlm_info["errors"].append(f"whole: {str(exc)[:160]}")asked = shot_records[:max_shots_vlm]@@ -173,7 +176,7 @@ def decompose(video: str | Path, out_dir: str | Path, *, use_vlm: bool = False,LOG.warning("VLM: every call failed (%s); result is deterministic only", (vlm_info["errors"] or ["?"])[0])breakdown = {- "schema": SCHEMA, "tool": {"name": "rea-video", "version": __version__},+ "schema": SCHEMA, "tool": {"name": "rea-video", "version": __version__}, "lang": lang,"source": {"path": str(video), "filename": video.name, "sha256_head": _sha256_head(video), "width": info.width,"height": info.height, "fps": round(info.fps, 3), "duration": round(info.duration, 3), "vcodec": info.vcodec,"aspect_ratio": info.aspect_ratio, "has_audio": info.has_audio, "rotation": info.rotation},@@ -217,33 +220,37 @@ def _ai_or_live_doubt(label: str, facts: dict, prov: dict, vctx: dict, seen_live# a cinema / mirrorless camera shooting 24p and exported at 30 fps leaves the same cadence as a generator:# measured on a phone clip converted 30 -> 24 -> 30, the tools call it AI at 89% (eval/RESULTS.md 2026-11-01)if seen_live >= 0.5:- return "AI 还是 24p 相机实拍待确认:帧率痕迹只说明素材是 24fps 源,看图的一方认为是实拍,又没有 AIGC 标识"+ return T("AI 还是 24p 相机实拍待确认:帧率痕迹只说明素材是 24fps 源,看图的一方认为是实拍,又没有 AIGC 标识",+ "AI or 24p camera footage, to confirm: the frame-rate marks only say the source was 24fps, the image reader calls it live action, and there is no AIGC label")if not seen:- return "AI 还是 24p 相机实拍待确认:只有帧率证据(24fps 源)、没有 AIGC 标识,需要看图确认"+ return T("AI 还是 24p 相机实拍待确认:只有帧率证据(24fps 源)、没有 AIGC 标识,需要看图确认",+ "AI or 24p camera footage, to confirm: only frame-rate evidence (24fps source) and no AIGC label, needs an image reader")if not facts.get("transcode_degraded"):return Noneif label == "live_action" and vctx.get("native30") and not facts.get("pulldown"):return Noneif label == "ai_video":- return "实拍 / 定格还是 AI 待确认:没有 AIGC 标识;24fps 源痕迹在 AI、定格动画、电影机拍摄里都会出现"- return "实拍还是 AI 待确认:画面源自 24fps 素材且没有 AIGC 标识,不是手机原生 30fps 的特征"+ return T("实拍 / 定格还是 AI 待确认:没有 AIGC 标识;24fps 源痕迹在 AI、定格动画、电影机拍摄里都会出现",+ "Live action / stop motion or AI, to confirm: no AIGC label; 24fps-source marks appear in AI video, stop motion and cinema-camera footage alike")+ return T("实拍还是 AI 待确认:画面源自 24fps 素材且没有 AIGC 标识,不是手机原生 30fps 的特征",+ "Live action or AI, to confirm: the picture comes from 24fps material with no AIGC label, not the signature of native 30fps phone footage")def _user_real(material: dict, real: bool) -> None:"""Apply the user's answer to "does this shot use real (user-supplied) material?"."""if real and not material["has_real_material"]:- material["items"].append({"kind": "user_marked", "kind_zh": "用户标注的真实素材", "region": "unknown", "real_material": True,- "source": "user"})+ material["items"].append({"kind": "user_marked", "kind_zh": T("用户标注的真实素材", "real material marked by the user"), "region": "unknown",+ "real_material": True, "source": "user"})if not real:for it in material["items"]:if it.get("real_material"):it["real_material"] = False- it["note"] = "用户纠正:不是真实素材"+ it["note"] = T("用户纠正:不是真实素材", "User correction: not real material")material["has_real_material"] = realif real and material["origin"] in ("ai_generated", "rendered", "unknown"):- material["origin"], material["origin_zh"] = "mixed", "混合(含真实素材)"+ material["origin"], material["origin_zh"] = "mixed", T("混合(含真实素材)", "mixed (includes real material)")if not real and material["origin"] in ("real", "mixed"):- material["origin"], material["origin_zh"] = "unknown", "待确认(用户说不是真实素材)"+ material["origin"], material["origin_zh"] = "unknown", T("待确认(用户说不是真实素材)", "to confirm (user says it is not real material)")material["user_corrected"] = True@@ -339,8 +346,9 @@ def _agent_review_dispute(dt: str, vt: dict | None, rv: dict | None, reviewed: bif decided == "user" or vt or not rv or sum(rv.values()) == 0 or reviewed:return Noneif (group_of(_top_group_label(rv)) == "live_action") != (group_of(dt) == "live_action"):- return (f"工具判{LABEL_ZH[dt]}、看图复核判{LABEL_ZH[_top_group_label(rv)]},融合规则在 AI/实拍轴上"- "跟了工具(评测校准):请对照截图核实复核证据是否真的看得见")+ return T("工具判{d}、看图复核判{r},融合规则在 AI/实拍轴上跟了工具(评测校准):请对照截图核实复核证据是否真的看得见",+ "Tools say {d}, the image review says {r}; on the AI / live-action axis the fusion follows the tools (eval-calibrated): check the frames to see whether the review's evidence is really visible",+ d=LABEL_ZH[dt], r=LABEL_ZH[_top_group_label(rv)])return None@@ -349,6 +357,7 @@ def finalize(breakdown: dict, out: Path, engine: str = "seedance2.0") -> dict:summarise and write breakdown.json / reports. Safe to call again after theclassifier changes (no re-decoding)."""out = Path(out)+ set_lang(breakdown.get("lang", "zh"))shot_records = breakdown["shots"]audio = breakdown.get("audio", {})prov = breakdown.get("provenance", {})@@ -385,19 +394,21 @@ def finalize(breakdown: dict, out: Path, engine: str = "seedance2.0") -> dict:src = seen.get("image_source")img_src = src if src and src != "unknown" else image_source_guess(rec["features"], rec["deterministic"]["facts"])evidence = (list(rec["deterministic"]["evidence"]) + [f"[VLM] {e}" for e in (rec.get("vlm") or {}).get("evidence", [])[:6]]- + [f"[{(rec.get('review') or {}).get('_by', 'agent')} 看图] {e}" for e in (rec.get("review") or {}).get("evidence", [])[:6]])+ + [T("[{by} 看图] {e}", "[{by} review] {e}", by=(rec.get('review') or {}).get('_by', 'agent'), e=e)+ for e in (rec.get("review") or {}).get("evidence", [])[:6]])split = (rec.get("review") or {}).get("split_suggestion")if split and split.get("cuts"):by = (rec.get("review") or {}).get("_by", "agent")seq = "→".join(LABEL_ZH.get(x, x) for x in split.get("labels") or [])- evidence.append(f"[{by} 看图] 本镜头疑为多刀合并,建议在 " + "、".join(fmt_time(c) for c in split["cuts"][:6])- + " 处拆分" + (f"({seq})" if seq else "") + (f":{split['note']}" if split.get("note") else ""))+ evidence.append(T("[{by} 看图] 本镜头疑为多刀合并,建议在 {at} 处拆分", "[{by} review] This shot looks like several cuts merged; suggest splitting at {at}",+ by=by, at=join(fmt_time(c) for c in split["cuts"][:6]))+ + (T("({seq})", " ({seq})", seq=seq) if seq else "") + (T(":", ": ") + split['note'] if split.get("note") else ""))decided = "fused" if rec.get("vlm") else ("fused_agent" if rec.get("review") else "deterministic")user = rec.get("user") or {}if user.get("label") in LABEL_ZH: # the user said what this shot is: that is the answerlabel, conf, decided = user["label"], 1.0, "user"probs = {k: (1.0 if k == label else 0.0) for k in LABEL_ZH}- evidence = [f"[用户纠正] 改为{LABEL_ZH[label]}" + (f":{user['note']}" if user.get("note") else "")] + evidence+ evidence = [T("[用户纠正] 改为{l}", "[User correction] Changed to {l}", l=LABEL_ZH[label]) + (T(":", ": ") + user['note'] if user.get("note") else "")] + evidencerec["base"] = {"label": label, "label_zh": LABEL_ZH[label], "confidence": round(conf, 3), "probs": round_floats(probs),"image_source": img_src if label in ("static_hold", "still_motion") else None,"generator_guess": seen.get("generator_guess"),@@ -410,9 +421,10 @@ def finalize(breakdown: dict, out: Path, engine: str = "seedance2.0") -> dict:and (_top_group(vt) == "live_action") != (group_of(dt) == "live_action")):# the tools and the VLM disagree on whether the picture was filmed: the VLM is sometimes confidently wrong# (it has invented "garbled clock digits" on live footage), so ask for a look at its evidence- follow = "VLM" if group_of(label) == group_of(_top_group_label(vt)) else "工具"- rec["base"]["disputed"] = (f"工具判{LABEL_ZH[dt]}、VLM 判{LABEL_ZH[_top_group_label(vt)]},结论跟了{follow}:"- "请对照截图核实 VLM 的证据是否真的看得见")+ follow = "VLM" if group_of(label) == group_of(_top_group_label(vt)) else T("工具", "the tools")+ rec["base"]["disputed"] = T("工具判{d}、VLM 判{v},结论跟了{f}:请对照截图核实 VLM 的证据是否真的看得见",+ "Tools say {d}, the VLM says {v}; the verdict follows {f}: check the frames to see whether the VLM's evidence is really visible",+ d=LABEL_ZH[dt], v=LABEL_ZH[_top_group_label(vt)], f=follow)agent_dispute = _agent_review_dispute(dt, vt, rv, reviewed, decided)if agent_dispute:rec["base"]["disputed"] = agent_dispute@@ -420,8 +432,9 @@ def finalize(breakdown: dict, out: Path, engine: str = "seedance2.0") -> dict:doubt = None if decided == "user" else _ai_or_live_doubt(label, rec["deterministic"]["facts"], prov, vctx, seen_live,seen=bool(seen.get("label_probs")))if not doubt and decided != "user" and label in UNMEASURED and not (rec.get("vlm") and rec.get("review")):- doubt = (f"{LABEL_ZH[label]}只有一方看图判断(工具测不出这一类):" +- ("定格动画和 AI 视频、实拍容易混" if label == "stop_motion" else "2D 动画和代码动效、AI 视频容易混") + ",请再看一眼")+ doubt = (T("{l}只有一方看图判断(工具测不出这一类):", "{l} rests on a single image reader (the tools cannot measure this class): ", l=LABEL_ZH[label]) ++ (T("定格动画和 AI 视频、实拍容易混", "stop motion is easily confused with AI video and live action") if label == "stop_motion"+ else T("2D 动画和代码动效、AI 视频容易混", "2D animation is easily confused with code-driven motion graphics and AI video")) + T(",请再看一眼", ", take another look"))if doubt:rec["base"]["confidence"] = round(min(conf, DOUBT_CAP), 3)rec["base"]["uncertain"] = doubt@@ -442,7 +455,8 @@ def finalize(breakdown: dict, out: Path, engine: str = "seedance2.0") -> dict:rec["layers"] = [l for l in rec["layers"] if not (l.get("texts") and l["kind"] in ("label", "title")and any(_same_words(t, h) for t in l["texts"] for h in huazi))] + extraif (rec.get("features") or {}).get("measured_region"):- rec["base"]["evidence"].append("画面统计只在贴纸/动图之外的区域测量(x{:.0%} y{:.0%} 宽{:.0%} 高{:.0%})".format(*rec["features"]["measured_region"]))+ rec["base"]["evidence"].append(T("画面统计只在贴纸/动图之外的区域测量(x{:.0%} y{:.0%} 宽{:.0%} 高{:.0%})",+ "Picture statistics measured only outside the sticker / GIF region (x{:.0%} y{:.0%} w{:.0%} h{:.0%})").format(*rec["features"]["measured_region"]))# imported real material: full-frame from the base label, embedded regions only where# the frame is a rendered layout (photographic bases would trip the region detector)rendered_frame = label in ("code_render", "screen_capture", "cg_3d") or (label in ("static_hold", "still_motion") and img_src in ("graphic", "screenshot"))@@ -463,13 +477,13 @@ def finalize(breakdown: dict, out: Path, engine: str = "seedance2.0") -> dict:steps = planner.edit_steps(raw)if steps:rec["ai_edits"] = steps- rec["verdict"] += ";拍完后经 AI 加工(" + "、".join(e["kind_zh"] for e in steps) + ")"+ rec["verdict"] += semi() + T("拍完后经 AI 加工({k})", "AI-processed after filming ({k})", k=join(e["kind_zh"] for e in steps))if rec["material"]["has_real_material"]:kinds = []for it in rec["material"]["items"]:if it.get("real_material") and it["kind_zh"] not in kinds:kinds.append(it["kind_zh"])- rec["verdict"] += ";引入真实素材(" + "、".join(kinds) + ")"+ rec["verdict"] += semi() + T("引入真实素材({k})", "brings in real material ({k})", k=join(kinds))rec["replication"] = planner.plan_shot(label, rec, video_meta, engine=engine)# ---------------- summary --------------------------------------------------------@@ -481,40 +495,40 @@ def finalize(breakdown: dict, out: Path, engine: str = "seedance2.0") -> dict:overlay_kinds = sorted({l["kind"] for r in shot_records for l in r["layers"]})conf = sum(r["base"]["confidence"] * r["duration"] for r in shot_records) / totalparts = [f"{LABEL_ZH[k]} {v / total:.0%}" for k, v in mix_sorted]- kind_zh = {"subtitle": "字幕", "title": "标题", "label": "文字标注", "static_graphic": "图形贴片", "layout_template": "版式模板",- "huazi": "花字", "animated_sticker": "动态贴纸/GIF", "static_sticker": "静态贴纸", "pip": "画中画"}- verdict = ("混合制作:" if len(mix) > 1 or overlay_kinds else "") + " + ".join(parts)+ verdict = (T("混合制作:", "Mixed production: ") if len(mix) > 1 or overlay_kinds else "") + " + ".join(parts)unsure = sum(r["duration"] for r in shot_records if r["base"]["label"] in ("ai_video", "live_action")and r["base"]["confidence"] < 0.65and (r.get("deterministic") or {}).get("facts", {}).get("transcode_degraded"))if unsure / total > 0.3 and not any(visual_opinion(r) for r in shot_records):- verdict += f"(其中 {unsure / total:.0%} 时长实拍还是 AI 待确认:平台转码抹掉了噪声证据,需开 VLM 或人工看画面)"+ verdict += T("(其中 {r:.0%} 时长实拍还是 AI 待确认:平台转码抹掉了噪声证据,需开 VLM 或人工看画面)",+ " ({r:.0%} of the duration is live action or AI, to confirm: the platform transcode erased the noise evidence, needs a VLM pass or a human look at the frames)",+ r=unsure / total)doubtful = sum(r["duration"] for r in shot_records if r["base"].get("uncertain"))if doubtful / total > 0.3 and not (unsure / total > 0.3 and not any(visual_opinion(r) for r in shot_records)):- verdict += f"(其中 {doubtful / total:.0%} 时长实拍还是 AI 证据不足,待确认)"+ verdict += T("(其中 {r:.0%} 时长实拍还是 AI 证据不足,待确认)", " ({r:.0%} of the duration lacks evidence for live action vs AI, to confirm)", r=doubtful / total)if overlay_kinds:- verdict += ";叠加层:" + "、".join(kind_zh.get(k, k) for k in overlay_kinds) + "(代码/剪辑软件合成)"+ verdict += semi() + T("叠加层:{k}(代码/剪辑软件合成)", "overlays: {k} (composited in code / an editor)", k=join(OVERLAY_KIND_ZH.get(k, k) for k in overlay_kinds))real_shots = [r for r in shot_records if r.get("material", {}).get("has_real_material")]real_kinds: dict[str, float] = {}for r in real_shots:for k in {it["kind_zh"] for it in r["material"]["items"] if it.get("real_material")}:real_kinds[k] = real_kinds.get(k, 0.0) + r["duration"]if real_shots:- verdict += ";用到真实素材:" + "、".join(f"{k}({v:.1f}s)" for k, v in sorted(real_kinds.items(), key=lambda kv: -kv[1]))+ verdict += semi() + T("用到真实素材:", "real material used: ") + join(T("{k}({v:.1f}s)", "{k} ({v:.1f}s)", k=k, v=v) for k, v in sorted(real_kinds.items(), key=lambda kv: -kv[1]))edited: dict[str, int] = {}for r in shot_records:for e in r.get("ai_edits") or []:edited[e["kind_zh"]] = edited.get(e["kind_zh"], 0) + 1if edited:- verdict += ";实拍经 AI 二次加工:" + "、".join(f"{k} {v} 镜" for k, v in edited.items())+ verdict += semi() + T("实拍经 AI 二次加工:", "live action AI-processed afterwards: ") + join(T("{k} {v} 镜", "{k} ({v} shots)", k=k, v=v) for k, v in edited.items())refs: dict[str, list[int]] = {}for r in shot_records:for k in dict.fromkeys(x["kind_zh"] for x in (r.get("material") or {}).get("references", [])):refs.setdefault(k, []).append(r["index"])if refs:- verdict += ";复刻需准备参考:" + "、".join(f"{k}({len(v)} 镜)" for k, v in sorted(refs.items(), key=lambda kv: -len(kv[1])))+ verdict += semi() + T("复刻需准备参考:", "references to prepare for the remake: ") + join(T("{k}({n} 镜)", "{k} ({n} shots)", k=k, n=len(v)) for k, v in sorted(refs.items(), key=lambda kv: -len(kv[1])))if audio.get("beat_synced_edit"):- verdict += ";剪辑卡在音乐节拍上"+ verdict += semi() + T("剪辑卡在音乐节拍上", "cuts land on the music beat")summary = {"duration": breakdown["source"]["duration"], "shots": len(shot_records), "verdict": verdict,"production_mix": [{"label": k, "label_zh": LABEL_ZH[k], "seconds": round(v, 2), "ratio": round(v / total, 3)} for k, v in mix_sorted],@@ -566,13 +580,17 @@ def finalize(breakdown: dict, out: Path, engine: str = "seedance2.0") -> dict:if t["track"] == "music" and srcs.get("music"):lean = srcs["music"]["leaning"]t["source"] = srcs["music"]["source_zh"]- t["how"] = {"ai_generated": "原曲倾向 AI 生成:用 Suno 等(capsule-cinema UniversalMusicGenerationTool)按风格/BPM/调性重新生成,MV 类连歌词一起按新内容写",- "existing_library": "原曲倾向现成曲库配乐:按 BPM/情绪/调性在曲库检索同类曲,或用 AI 生成相近风格的免版权曲",- "popular_song": "原曲倾向现成知名歌曲:直接使用有版权风险,需要授权或换成相近风格的曲库/AI 曲"}[lean]+ t["how"] = {"ai_generated": T("原曲倾向 AI 生成:用 Suno 等(capsule-cinema UniversalMusicGenerationTool)按风格/BPM/调性重新生成,MV 类连歌词一起按新内容写",+ "The original track leans AI-generated: regenerate with Suno or similar (capsule-cinema UniversalMusicGenerationTool) matching style / BPM / key; for an MV, rewrite the lyrics for the new content too"),+ "existing_library": T("原曲倾向现成曲库配乐:按 BPM/情绪/调性在曲库检索同类曲,或用 AI 生成相近风格的免版权曲",+ "The original track leans stock library music: search a library by BPM / mood / key for a similar track, or generate a royalty-free track in a similar style with AI"),+ "popular_song": T("原曲倾向现成知名歌曲:直接使用有版权风险,需要授权或换成相近风格的曲库/AI 曲",+ "The original track leans a well-known song: using it as-is carries copyright risk; license it or swap in a library / AI track in a similar style")}[lean]if t["track"] == "sfx" and srcs.get("sfx"):t["source"] = srcs["sfx"]["source_zh"]if srcs["sfx"]["leaning"] == "ai_native":- t["how"] = "原片音效随 AI 视频片段一起生成:复刻时用支持原生音频的视频模型(Seedance 2.x / Veo 3.1 / Kling)直接出声,或视频生音效(HunyuanVideo-Foley)"+ t["how"] = T("原片音效随 AI 视频片段一起生成:复刻时用支持原生音频的视频模型(Seedance 2.x / Veo 3.1 / Kling)直接出声,或视频生音效(HunyuanVideo-Foley)",+ "The original sound effects were generated together with the AI video clips: for the remake, use a video model with native audio (Seedance 2.x / Veo 3.1 / Kling), or video-to-SFX (HunyuanVideo-Foley)")if t["track"] == "voice" and srcs.get("voice"):t["source"] = srcs["voice"]["source_zh"]from .visual import audio_timeline@@ -583,35 +601,35 @@ def finalize(breakdown: dict, out: Path, engine: str = "seedance2.0") -> dict:breakdown["assets"]["audio_timeline"] = "audio.png"a_parts = []if audio.get("voice", {}).get("present"):- a_parts.append("人声")+ a_parts.append(T("人声", "voice"))if audio.get("music", {}).get("present"):ms = srcs.get("music") or {}- a_parts.append(f"BGM {audio['music'].get('tempo_bpm', '?')}BPM({ms.get('source_zh', '来源待确认')}"- + (f",倾向{MUSIC_ZH[ms['leaning']]}" if ms.get("source") == "unknown" else "") + ")")+ a_parts.append(T("BGM {bpm}BPM({src}", "music {bpm}BPM ({src}", bpm=audio['music'].get('tempo_bpm', '?'), src=ms.get('source_zh', T('来源待确认', 'source to confirm')))+ + (T(",倾向{m}", ", leaning {m}", m=MUSIC_ZH[ms['leaning']]) if ms.get("source") == "unknown" else "") + T(")", ")"))n_sfx = len(breakdown["audio_plan"].get("sfx_merged", []))if n_sfx:- a_parts.append(f"音效 {n_sfx} 处")+ a_parts.append(T("音效 {n} 处", "{n} sound effects", n=n_sfx))if a_parts:- summary["verdict"] += ";声音:" + " + ".join(a_parts)+ summary["verdict"] += semi() + T("声音:", "audio: ") + " + ".join(a_parts)if pack:cues = [c for c in pack.get("text_cues", []) if not c.get("part_of_picture")]p_parts = []n_sub = sum(1 for c in cues if c["kind"] == "subtitle")if n_sub:- p_parts.append(f"字幕 {n_sub} 句")- for k, zh in (("huazi", "花字"), ("title", "标题"), ("label", "文字标注")):+ p_parts.append(T("字幕 {n} 句", "{n} subtitle lines", n=n_sub))+ for k in ("huazi", "title", "label"):n = sum(1 for c in cues if c["kind"] == k)if n:- p_parts.append(f"{zh} {n} 处")+ p_parts.append(T("{k} {n} 处", "{k} ×{n}", k=OVERLAY_KIND_ZH[k], n=n))n_st = sum(1 for st in pack.get("stickers", []) if not st.get("in_picture") and st.get("confidence") != "low")if n_st:- p_parts.append(f"贴纸/动图 {n_st} 处")+ p_parts.append(T("贴纸/动图 {n} 处", "stickers / GIFs ×{n}", n=n_st))on = (pack.get("sfx_alignment") or {}).get("sfx_on", {})n_on = sum(v for k, v in on.items() if k != "cut")if n_on:- p_parts.append(f"{n_on} 个音效卡在文字/贴纸出现上")+ p_parts.append(T("{n} 个音效卡在文字/贴纸出现上", "{n} sound effects land on text / sticker pops", n=n_on))if p_parts:- summary["verdict"] += ";剪辑包装:" + "、".join(p_parts)+ summary["verdict"] += semi() + T("剪辑包装:", "packaging: ") + join(p_parts)summary["packaging"] = pack.get("summary_zh", [])from .production import production_plandiff --git a/rea_video/plan.py b/rea_video/plan.pyindex 0656bd2..1120460 100644--- a/rea_video/plan.py+++ b/rea_video/plan.py@@ -6,6 +6,8 @@ from pathlib import Pathimport yaml+from .i18n import LangDict, T, join, semi+CAP = Path(__file__).resolve().parent / "capabilities"# base label -> (routing rule, executor, capsule generation type)@@ -21,7 +23,7 @@ LABEL_ROUTE = {"anim_2d": ("R19-2d-animation", "capsule_cinema", "first_last_frame"),"stop_motion": ("R20-stop-motion", "capsule_cinema", "image_to_video"),}-NOTE = {+NOTE = LangDict({"ai_video": "原片为 AI 生成:取原镜头首尾帧做首尾帧生成,可高度还原构图与动作;换主体时先用图像模型改首帧","live_action": "原片为实拍:按拍摄方案(景别/机位/打光)重新拍摄;没有拍摄条件时才用 AI 图生视频近似(以首帧为参考)","avatar": "数字人口播:先克隆/合成配音,再用数字人模型由人像 + 音频驱动",@@ -32,7 +34,18 @@ NOTE = {"static_hold": "静帧:一张图定格即可","anim_2d": "2D 动画:先出角色设定图定画风,再首尾帧生成;要精确口型和动作时做 AE / Live2D / Spine 工程","stop_motion": "定格动画:首选真的拍(手机固定 + 定格 App,每秒约 12 张);AI 生成只能近似顿挫感",-}+}, en={+ "ai_video": "Source is AI-generated: use the shot's first and last frames for first/last-frame generation to closely match composition and motion; to change the subject, edit the first frame with an image model first",+ "live_action": "Source is live action: reshoot per the shooting plan (shot size / camera setup / lighting); only fall back to AI image-to-video (first frame as reference) when a shoot is not possible",+ "avatar": "Digital-avatar talking head: clone or synthesize the voice first, then drive an avatar model from a portrait + the audio",+ "cg_3d": "3D render: AI first/last-frame generation gives an approximation; for precise multiple angles, model in 3D and render in Blender",+ "code_render": "Code render: rebuild in Remotion / HTML from the text tracks and layout, 100% controllable, no generative model needed",+ "screen_capture": "Screen recording / screenshot: rebuild from a real screen recording or web screenshot",+ "still_motion": "Still-image move: one image + the measured zoom / pan parameters, reproduced exactly with local ffmpeg",+ "static_hold": "Static frame: one held image is enough",+ "anim_2d": "2D animation: make a character sheet to lock the style, then first/last-frame generation; for precise lip sync and motion, build an AE / Live2D / Spine project",+ "stop_motion": "Stop motion: shooting for real is the first choice (phone locked off + a stop-motion app, about 12 frames per second); AI generation only approximates the stepped feel",+})# AI edits on filmed footage: what was done, which routing rule rebuilds it, how in one lineAI_EDITS = {"face_swap": ("换脸", "R12-owned-footage-edit", "拍好后用视频编辑模型换人,保留动作"),@@ -43,6 +56,15 @@ AI_EDITS = {"object_edit": ("加/删/换物体", "R12-owned-footage-edit", "拍好后用视频编辑模型改画面里的物体"),"beautify": ("美颜/瘦脸", None, "剪映、美颜相机等的美颜功能即可,不需要生成模型"),}+AI_EDITS_EN = { # (what was done, how) in English, same keys as AI_EDITS+ "face_swap": ("face swap", "after the shoot, swap the person with a video-editing model, keeping the motion"),+ "lip_sync": ("lip sync / new lines", "after the shoot, record the new lines, then redo the mouth with a lip-sync model"),+ "restyle": ("full stylized repaint", "after the shoot, repaint with a video-editing model in the reference style, keeping motion and composition"),+ "outfit_swap": ("AI outfit swap", "make a try-on still to approve first, then swap the outfit with a video or editing model"),+ "bg_replace": ("keyed background replacement", "shoot on green screen and key / composite; without a green screen, replace the background with a video-editing model"),+ "object_edit": ("object added / removed / replaced", "after the shoot, change the object in frame with a video-editing model"),+ "beautify": ("beauty filter / face slimming", "the beauty tools in CapCut, beauty camera apps etc. are enough, no generative model needed"),+}CAPSULE_ENGINES = {"seedance2.0": (4, 15), "minimax-h3": (4, 15)}@@ -75,10 +97,11 @@ class Planner:if not isinstance(e, dict) or e.get("kind") not in AI_EDITS or any(x["kind"] == e["kind"] for x in out):continuezh, rule_id, how = AI_EDITS[e["kind"]]+ zh_en, how_en = AI_EDITS_EN[e["kind"]]names = [self.models[m]["name"] for m in (self.rules.get(rule_id) or {}).get("prefer", [])if m in self.models and self.models[m]["status"] != "shutdown"][:3]- out.append({"kind": e["kind"], "kind_zh": zh, "evidence": str(e.get("evidence", ""))[:120], "rule": rule_id,- "how": how + (f"({' / '.join(names)})" if names else "")})+ out.append({"kind": e["kind"], "kind_zh": T(zh, zh_en), "evidence": str(e.get("evidence", ""))[:120], "rule": rule_id,+ "how": T(how, how_en) + (T("({n})", " ({n})", n=" / ".join(names)) if names else "")})return outdef plan_shot(self, label: str, shot: dict, video: dict, engine: str = "seedance2.0") -> dict:@@ -93,17 +116,19 @@ class Planner:user_assets = []for it in mat.get("items", []):if it.get("real_material"):- where = "整个画面" if it.get("region") == "full" else (- "画面局部 x{:.0%} y{:.0%} 宽{:.0%} 高{:.0%}".format(*it["bbox"]) if it.get("bbox") else "画面局部")+ where = T("整个画面", "whole frame") if it.get("region") == "full" else (+ T("画面局部 x{:.0%} y{:.0%} 宽{:.0%} 高{:.0%}", "part of the frame x{:.0%} y{:.0%} w{:.0%} h{:.0%}").format(*it["bbox"])+ if it.get("bbox") else T("画面局部", "part of the frame"))user_assets.append({"kind": it["kind"], "kind_zh": it.get("kind_zh", it["kind"]), "where": where,"description": it.get("description", ""), "reference": shot.get("assets", {}).get("first_frame")})if user_assets:plan["user_assets"] = user_assets- plan["note"] += ";需要用户提供真实素材:" + "、".join(f"{a['kind_zh']}({a['where']})" for a in user_assets)+ plan["note"] += semi() + T("需要用户提供真实素材:", "real material the user must supply: ") \+ + join(T("{k}({w})", "{k} ({w})", k=a["kind_zh"], w=a["where"]) for a in user_assets)refs = mat.get("references") or []if refs:plan["references"] = refs- plan["note"] += ";生成时作参考:" + "、".join(dict.fromkeys(r["kind_zh"] for r in refs))+ plan["note"] += semi() + T("生成时作参考:", "references for generation: ") + join(dict.fromkeys(r["kind_zh"] for r in refs))if executor == "capsule_cinema":lo, hi = CAPSULE_ENGINES.get(engine, (4, 15))gen_dur = int(min(hi, max(lo, round(dur + 0.49))))@@ -116,7 +141,8 @@ class Planner:"needs_split": dur > hi,}if not prompt:- plan["capsule"]["prompt_missing"] = "未运行 VLM,缺少视频提示词;请用 --vlm 重新拆解或手动补写"+ plan["capsule"]["prompt_missing"] = T("未运行 VLM,缺少视频提示词;请用 --vlm 重新拆解或手动补写",+ "VLM was not run, so there is no video prompt; re-run the breakdown with --vlm or write one by hand")if executor == "local_ffmpeg":m = shot.get("features", {})plan["local"] = {"zoom_per_s": m.get("zoom_per_s", 0.0), "pan_px_per_s": m.get("pan_px_per_s", 0.0),diff --git a/rea_video/probe.py b/rea_video/probe.pyindex 5ee62a1..423b2c6 100644--- a/rea_video/probe.py+++ b/rea_video/probe.py@@ -5,6 +5,8 @@ entered the pipeline; an AIGC label means a generator declared itself) but it isstripped by social platforms, so absence proves nothing."""from __future__ import annotations+from .i18n import LangDict, T, join+import jsonimport refrom pathlib import Path@@ -70,7 +72,8 @@ def _scan_bytes(path: Path, limit: int = 4 << 20) -> bytes:return head + tail-AIGC_LABEL_ZH = {"1": "属于 AI 生成合成内容", "2": "可能为 AI 生成合成内容", "3": "疑似 AI 生成合成内容"}+AIGC_LABEL_ZH = LangDict({"1": "属于 AI 生成合成内容", "2": "可能为 AI 生成合成内容", "3": "疑似 AI 生成合成内容"},+ en={"1": "labelled as AI-generated synthetic content", "2": "possibly AI-generated synthetic content", "3": "suspected AI-generated synthetic content"})def parse_aigc(value: str) -> dict | None:@@ -88,7 +91,7 @@ def parse_aigc(value: str) -> dict | None:if not isinstance(data, dict):return Nonelabel = str(data.get("Label", data.get("label", ""))).strip()- return {"label": label, "meaning": AIGC_LABEL_ZH.get(label, "未知取值"),+ return {"label": label, "meaning": AIGC_LABEL_ZH.get(label, T("未知取值", "unknown value")),"content_producer": data.get("ContentProducer", ""), "produce_id": data.get("ProduceID", ""),"content_propagator": data.get("ContentPropagator", ""), "propagate_id": data.get("PropagateID", "")}@@ -110,12 +113,14 @@ def provenance(info: VideoInfo) -> dict:if short in CAMERA_KEYS:hints["camera"].append(f"{short}={value}")if any(a in short for a in AIGC_KEYS) or re.search(r"\baigc\b", value, re.I):- aigc = parse_aigc(value) or {"label": "", "meaning": "无法解析", "raw": value[:200]}+ aigc = parse_aigc(value) or {"label": "", "meaning": T("无法解析", "could not be parsed"), "raw": value[:200]}strong = aigc.get("label") in ("1", "2", "3")- evidence.append({"kind": "aigc_label", "detail": f"AIGC 隐式标识 Label={aigc.get('label')}({aigc.get('meaning')}),"- f"生成服务方编码 {aigc.get('content_producer') or '—'}", "weight": "strong" if strong else "weak"})+ evidence.append({"kind": "aigc_label", "detail": T("AIGC 隐式标识 Label={l}({m}),生成服务方编码 {p}",+ "Implicit AIGC label Label={l} ({m}), content producer code {p}",+ l=aigc.get('label'), m=aigc.get('meaning'), p=aigc.get('content_producer') or '—'),+ "weight": "strong" if strong else "weak"})if aigc.get("label") == "1":- hints["generator"].append(f"AIGC 标识({aigc.get('meaning')})")+ hints["generator"].append(T("AIGC 标识({m})", "AIGC label ({m})", m=aigc.get('meaning')))blob = " ".join(f"{k}={v}" for k, v in tags.items() if "aigc" not in k.lower())raw_bytes = _scan_bytes(path)@@ -123,15 +128,15 @@ def provenance(info: VideoInfo) -> dict:for pattern, cat, label in SIGNATURES:if re.search(pattern, blob, re.I):hints[cat].append(label)- evidence.append({"kind": f"{cat}_signature", "detail": f"元数据包含 {label}", "weight": "medium"})+ evidence.append({"kind": f"{cat}_signature", "detail": T("元数据包含 {l}", "Metadata contains {l}", l=label), "weight": "medium"})elif cat in ("generator", "renderer", "editor") and re.search(rf"\b(?:{pattern})\b", strings, re.I):# weaker: readable string inside container boxes (udta/uuid/xmp)hints[cat].append(f"{label}?")- evidence.append({"kind": f"{cat}_bytes", "detail": f"容器内可读字符串出现 {label}", "weight": "weak"})+ evidence.append({"kind": f"{cat}_bytes", "detail": T("容器内可读字符串出现 {l}", "Readable string {l} found inside the container", l=label), "weight": "weak"})if b"c2pa" in raw_bytes or b"jumb" in raw_bytes:- evidence.append({"kind": "c2pa", "detail": "发现 C2PA/JUMBF 内容凭证盒", "weight": "strong"})- hints["generator"].append("C2PA 凭证")+ evidence.append({"kind": "c2pa", "detail": T("发现 C2PA/JUMBF 内容凭证盒", "C2PA / JUMBF content-credential box found"), "weight": "strong"})+ hints["generator"].append(T("C2PA 凭证", "C2PA credential"))if hints["camera"]:evidence.append({"kind": "camera_tags", "detail": "; ".join(hints["camera"][:4]), "weight": "strong"})diff --git a/rea_video/production.py b/rea_video/production.pyindex 373837a..c59e9f1 100644--- a/rea_video/production.py+++ b/rea_video/production.py@@ -10,6 +10,8 @@ Edit shots (cut detection) are the facts; making them is organised differently:"""from __future__ import annotations+from .i18n import LangDict, T, join, semi+from pathlib import Pathimport cv2@@ -20,10 +22,11 @@ from .plan import Planner, shot_promptsGEN_LABELS = ("ai_video", "cg_3d", "anim_2d")SHOOT_LABELS = ("live_action", "stop_motion")-GEN_ZH = {"ai_video": "AI 视频", "cg_3d": "3D 渲染", "anim_2d": "2D 动画"}+GEN_ZH = LangDict({"ai_video": "AI 视频", "cg_3d": "3D 渲染", "anim_2d": "2D 动画"}, en={"ai_video": "AI video", "cg_3d": "3D render", "anim_2d": "2D animation"})CODE_LABELS = ("code_render", "screen_capture")LOCAL_LABELS = ("still_motion", "static_hold")-SIZE_ORDER = {"远景": 0, "全景": 1, "中景": 2, "近景": 3, "特写": 4}+SIZE_ORDER = {"远景": 0, "全景": 1, "中景": 2, "近景": 3, "特写": 4, # zh / en shot-size words (aspects.framing.SIZES);+ "wide shot": 0, "full shot": 1, "medium shot": 2, "medium close-up": 3, "close-up": 4, "extreme close-up": 5} # full names: no prefix clashesPRODUCT_KINDS = ("product_photo", "logo")@@ -141,7 +144,8 @@ def _split_run(run: list[dict], lim: dict, hard: dict, unit_min: float) -> list[def _style_line(shots: list[dict], aspect_ratio: str) -> str:"""One style sentence for every unit (most common lighting reading across the generated shots, by duration),so separately generated units still look like one video."""- orient = {"9:16": "竖屏 9:16", "16:9": "横屏 16:9", "1:1": "方形 1:1", "3:4": "竖屏 3:4", "4:3": "横屏 4:3"}.get(aspect_ratio, aspect_ratio)+ orient = {"9:16": T("竖屏 9:16", "Vertical 9:16"), "16:9": T("横屏 16:9", "Horizontal 16:9"), "1:1": T("方形 1:1", "Square 1:1"),+ "3:4": T("竖屏 3:4", "Vertical 3:4"), "4:3": T("横屏 4:3", "Horizontal 4:3")}.get(aspect_ratio, aspect_ratio)bits = [orient]picks = []for key in ("setup_name", "quality", "color_temp", "depth"):@@ -153,8 +157,8 @@ def _style_line(shots: list[dict], aspect_ratio: str) -> str:if votes:picks.append(max(votes.items(), key=lambda kv: kv[1])[0])if picks:- bits.append(",".join(picks))- return ";".join(bits)+ bits.append(T(",", ", ").join(picks))+ return semi().join(bits)def _unit(seg: list[dict], k: int, lim: dict, model: dict | None, style: str, cast: dict, prev_unit: dict | None,@@ -176,29 +180,34 @@ def _unit(seg: list[dict], k: int, lim: dict, model: dict | None, style: str, carefs, tags = [], {}if product:tags["product"] = "@图片1"- refs.append({"tag": "@图片1", "what": "产品实拍图(正面 + 带 Logo 面),用户提供", "user": True})+ refs.append({"tag": "@图片1", "what": T("产品实拍图(正面 + 带 Logo 面),用户提供",+ "product photos (front + the side with the logo), supplied by the user"), "user": True})if people:tags["person"] = f"@图片{len(refs) + 1}"- refs.append({"tag": tags["person"], "what": "人物参考图(每个角色一张正脸 + 半身),保证跨镜头长相一致", "user": True})+ refs.append({"tag": tags["person"], "what": T("人物参考图(每个角色一张正脸 + 半身),保证跨镜头长相一致",+ "character reference images (one frontal face + one half-body per character) so the look stays consistent across shots"), "user": True})if lim["ref_video"]:tags["video"] = "@视频1"- span = "、".join(f"{a:.1f}–{z:.1f}s" for a, z in ranges)- refs.append({"tag": "@视频1", "what": f"原片 {span} 片段" + ("(剪掉中间插入的画面后拼成一段)" if not contiguous else "")- + ":参考动作、运镜和剪辑节奏(只作参考,不复制画面)", "user": False})+ span = join(f"{a:.1f}–{z:.1f}s" for a, z in ranges)+ refs.append({"tag": "@视频1", "what": T("原片 {span} 片段", "source clip {span}", span=span)+ + (T("(剪掉中间插入的画面后拼成一段)", " (inserted shots removed, pieces joined)") if not contiguous else "")+ + T(":参考动作、运镜和剪辑节奏(只作参考,不复制画面)",+ ": reference for action, camera movement and cutting rhythm (reference only, do not copy the picture)"), "user": False})cont = Noneif prev_unit and same_scene_prev and seg[0].get("transition_in") == "cut" and abs(prev_unit["ranges"][-1][1] - t0) < 1e-3:- cont = f"首帧用 {prev_unit['id']} 的尾帧,接上动作(S05)"+ cont = T("首帧用 {p} 的尾帧,接上动作(S05)", "first frame = last frame of {p}, continue the action (S05)", p=prev_unit["id"])elif lim["first_frame"]:- cont = f"首帧:参照原片第 {seg[0]['index']} 镜首帧({seg[0]['assets']['first_frame']})的构图出图" + (",产品换成 @图片1" if product else "")+ cont = T("首帧:参照原片第 {i} 镜首帧({f})的构图出图", "first frame: generate an image matching the composition of source shot {i}'s first frame ({f})",+ i=seg[0]["index"], f=seg[0]["assets"]["first_frame"]) + (T(",产品换成 @图片1", ", with the product replaced by @图片1") if product else "")head = [style]if product:- head.append("产品外观以 @图片1 为准,Logo 和细节保持一致")+ head.append(T("产品外观以 @图片1 为准,Logo 和细节保持一致", "Product appearance follows @图片1, keep the logo and details consistent"))if people:- head.append(f"人物以 {tags['person']} 为准")+ head.append(T("人物以 {t} 为准", "Characters follow {t}", t=tags["person"]))if "video" in tags:- head.append("参考 @视频1 的动作、运镜和剪辑节奏")+ head.append(T("参考 @视频1 的动作、运镜和剪辑节奏", "Follow the action, camera movement and cutting rhythm of @视频1"))if len(seg) > 1:- head.append("镜头之间硬切")+ head.append(T("镜头之间硬切", "Hard cuts between shots"))lines, lines_en, missing = [], [], []acc = 0.0for i, r in enumerate(seg, 1):@@ -206,10 +215,10 @@ def _unit(seg: list[dict], k: int, lim: dict, model: dict | None, style: str, catext = p.get("video_prompt") or (r.get("vlm") or r.get("review") or {}).get("description") or ""if not text:missing.append(r["index"])- text = "(缺提示词:开 --vlm 或 agent 看图补写)"+ text = T("(缺提示词:开 --vlm 或 agent 看图补写)", "(prompt missing: run --vlm or have the agent write one from the frames)")a, z = acc, acc + r["duration"]acc = z- lines.append(f"镜头{i}({a:.1f}–{z:.1f}s):{text}" if len(seg) > 1 else text)+ lines.append(T("镜头{i}({a:.1f}–{z:.1f}s):{text}", "Shot {i} ({a:.1f}–{z:.1f}s): {text}", i=i, a=a, z=z, text=text) if len(seg) > 1 else text)if p.get("video_prompt_en"):lines_en.append(f"Shot {i} ({a:.1f}-{z:.1f}s): {p['video_prompt_en']}" if len(seg) > 1 else p["video_prompt_en"])parts = 1@@ -221,24 +230,34 @@ def _unit(seg: list[dict], k: int, lim: dict, model: dict | None, style: str, ca"ranges": [[round(a, 3), round(z, 3)] for a, z in ranges],"mode": mode, "calls": parts, "model": (model or {}).get("id"), "model_name": (model or {}).get("name"),"generate_s": max(dur, lim["min"], unit_min if len(seg) == 1 else 0), "refs": refs, "continuity": cont,- "prompt": "。".join(head) + "。\n" + "\n".join(lines),+ "prompt": T("。", ". ").join(head) + T("。\n", ".\n") + "\n".join(lines),"prompt_en": "\n".join(lines_en) if len(lines_en) == len(seg) else "","image_prompt": shot_prompts(seg[0]).get("image_prompt", "")}if missing:unit["prompt_missing"] = missingif parts > 1:- unit["note"] = f"单镜 {dur:.1f}s 超过 {unit['model_name']} 单次上限 {lim['max']:.0f}s:在动作停顿处切成 {parts} 段,后一段用前一段尾帧作首帧(S02)"+ unit["note"] = T("单镜 {d:.1f}s 超过 {m} 单次上限 {mx:.0f}s:在动作停顿处切成 {p} 段,后一段用前一段尾帧作首帧(S02)",+ "Single shot of {d:.1f}s exceeds the {m} per-call limit of {mx:.0f}s: split into {p} parts at pauses in the action, "+ "each part starting from the previous part's last frame (S02)", d=dur, m=unit["model_name"], mx=lim["max"], p=parts)if unit["generate_s"] > dur + 0.5:- unit["note"] = f"生成 {unit['generate_s']:.0f}s 后剪到 {dur:.1f}s(太短的镜头单独生成不稳定)"+ unit["note"] = T("生成 {g:.0f}s 后剪到 {d:.1f}s(太短的镜头单独生成不稳定)",+ "Generate {g:.0f}s and trim to {d:.1f}s (very short shots are unstable when generated on their own)", g=unit["generate_s"], d=dur)if not contiguous:- unit["note"] = (unit.get("note", "") + ";" if unit.get("note") else "") + \- "这几镜在成片里被插入画面隔开:生成时连着出,剪辑时再把插入画面放回去"+ unit["note"] = (unit.get("note", "") + semi() if unit.get("note") else "") + \+ T("这几镜在成片里被插入画面隔开:生成时连着出,剪辑时再把插入画面放回去",+ "In the final cut these shots are separated by inserts: generate them back to back and put the inserts back in the edit")if label == "anim_2d" or "anim_2d" in votes:- unit["alt"] = ("另一条路:2D 动画工程。角色拆层做 Live2D / Spine 骨骼动画,或在 AE 里做;简单的扁平风格动画也可以让 LLM 写 "- "Lottie / Canvas 代码。口型、动作要逐帧精确时比视频模型可控(R19)")+ unit["alt"] = T("另一条路:2D 动画工程。角色拆层做 Live2D / Spine 骨骼动画,或在 AE 里做;简单的扁平风格动画也可以让 LLM 写 "+ "Lottie / Canvas 代码。口型、动作要逐帧精确时比视频模型可控(R19)",+ "Alternative: a 2D animation project. Split the character into layers and rig it in Live2D / Spine, or animate in After Effects; "+ "simple flat-style animation can also be Lottie / Canvas code written by an LLM. More controllable than a video model when "+ "lip sync and motion must be frame-accurate (R19)")if label == "cg_3d" or "cg_3d" in votes:- unit["alt"] = ("另一条路:3D 工程。让 LLM 写 Blender 脚本或 Three.js 场景,角色/道具建模一次、按镜头设机位渲染,"- "多角度和角色一致性最好,改文案和镜头也只是改代码(R08)")+ unit["alt"] = T("另一条路:3D 工程。让 LLM 写 Blender 脚本或 Three.js 场景,角色/道具建模一次、按镜头设机位渲染,"+ "多角度和角色一致性最好,改文案和镜头也只是改代码(R08)",+ "Alternative: a 3D project. Have an LLM write a Blender script or a Three.js scene; model the characters / props once and "+ "render each shot from its own camera. Best for multiple angles and character consistency, and changing copy or shots is "+ "just a code change (R08)")return unit@@ -271,12 +290,12 @@ def _setups(shots: list[dict], sig: dict, thr: float, b: dict) -> list[dict]:setups.append({"shot_size": size, "support": support, "shots": [r["index"] for r in rs],"screen_s": round(sum(r["duration"] for r in rs), 2),"take_s": round(sum(r["duration"] for r in rs) + 2.0 * len(rs), 1),- "moves": sorted({((r.get("aspects") or {}).get("camera") or {}).get("result", {}).get("move") or "固定" for r in rs})})+ "moves": sorted({((r.get("aspects") or {}).get("camera") or {}).get("result", {}).get("move") or T("固定", "static") for r in rs})})post = [dict(e, shot=r["index"]) for r in sc for e in (r.get("ai_edits") or [])]out.append({"id": f"S{si}", "kind": "shoot", "shots": [r["index"] for r in sc], "post": post,"stop_motion": [r["index"] for r in sc if r["base"]["label"] == "stop_motion"],"screen_s": round(sum(r["duration"] for r in sc), 2), "description": desc,- "lighting": ",".join(x for x in (light.get("setup_name"), light.get("key_direction"), light.get("ratio"), light.get("color_temp")) if x),+ "lighting": T(",", ", ").join(x for x in (light.get("setup_name"), light.get("key_direction"), light.get("ratio"), light.get("color_temp")) if x),"setups": setups})return out@@ -319,11 +338,14 @@ def production_plan(b: dict, out: Path, engine: str = "seedance2.0") -> dict:plan["calls"] = callsplan["gen_shots"] = gen_shotsif eng and model and eng["id"] != model["id"]:- plan["engine_note"] = (f"默认引擎 {eng['name']} 不支持一次多镜头,用它要逐镜生成 {gen_shots} 次;"- f"这里按 {model['name']} 规划(单次 ≤{lim['max']:.0f}s、可一次出多镜头),共 {calls} 次")+ plan["engine_note"] = T("默认引擎 {e} 不支持一次多镜头,用它要逐镜生成 {n} 次;这里按 {m} 规划(单次 ≤{mx:.0f}s、可一次出多镜头),共 {c} 次",+ "The default engine {e} cannot generate several shots in one call; with it you would generate shot by shot, {n} times. "+ "This plan is for {m} (≤{mx:.0f}s per call, multi-shot in one call), {c} call{cs} in total",+ e=eng["name"], n=gen_shots, m=model["name"], mx=lim["max"], c=calls, cs=_s(calls))voice = ((b.get("audio") or {}).get("voice") or {}).get("present")if lim["native_audio"]:- plan["audio_note"] = "模型可以同时生成动作音效和环境声" + (";口播建议单独 TTS 再混进去,方便改文案和卡时间" if voice else "")+ plan["audio_note"] = T("模型可以同时生成动作音效和环境声", "the model can generate action sound effects and ambience along with the picture") + \+ (semi() + T("口播建议单独 TTS 再混进去,方便改文案和卡时间", "voice-over is better done as separate TTS and mixed in, so copy and timing stay editable") if voice else "")plan["shoot"] = _setups(shots, sig, thr, b)code, cur = [], []for r in shots + [None]:@@ -331,7 +353,7 @@ def production_plan(b: dict, out: Path, engine: str = "seedance2.0") -> dict:cur.append(r)continueif cur:- code.append({"id": f"段{len(code) + 1}", "kind": "code", "shots": [x["index"] for x in cur],+ code.append({"id": T("段{n}", "Part {n}", n=len(code) + 1), "kind": "code", "shots": [x["index"] for x in cur],"start": cur[0]["start"], "end": cur[-1]["end"], "duration": round(cur[-1]["end"] - cur[0]["start"], 3),"screen_capture": [x["index"] for x in cur if x["base"]["label"] == "screen_capture"],"text_tracks": sum(len((x.get("text") or {}).get("tracks", [])) for x in cur)})@@ -346,6 +368,11 @@ def production_plan(b: dict, out: Path, engine: str = "seedance2.0") -> dict:return plan+def _s(n: int) -> str:+ """English plural suffix (unused in Chinese)."""+ return "" if n == 1 else "s"++def summary_line(plan: dict, b: dict) -> str:bits = []if plan["units"]:@@ -354,86 +381,111 @@ def summary_line(plan: dict, b: dict) -> str:for i in u["shots"]:lab = plan["_labels"][i]kinds[lab] = kinds.get(lab, 0) + 1- what = " + ".join(f"{GEN_ZH.get(k, k)} {v} 镜" for k, v in kinds.items())- bits.append(f"{what} → {len(plan['units'])} 个生成单元、{plan['calls']} 次 {plan['model_name']} 调用")+ what = " + ".join(T("{g} {v} 镜", "{v} {g} shot{s}", g=GEN_ZH.get(k, k), v=v, s=_s(v)) for k, v in kinds.items())+ nu = len(plan["units"])+ bits.append(T("{what} → {u} 个生成单元、{c} 次 {m} 调用", "{what} → {u} generation unit{us}, {c} {m} call{cs}",+ what=what, u=nu, us=_s(nu), c=plan["calls"], cs=_s(plan["calls"]), m=plan["model_name"]))if plan["shoot"]:n_set = sum(len(s["setups"]) for s in plan["shoot"])n_shot = sum(len(s["shots"]) for s in plan["shoot"])n_stop = sum(len(s.get("stop_motion", [])) for s in plan["shoot"])- what = "实拍" if not n_stop else ("定格动画" if n_stop == n_shot else "实拍 / 定格")- bits.append(f"{what} {n_shot} 镜 → {len(plan['shoot'])} 个场景、{n_set} 个机位")+ what = T("实拍", "live action") if not n_stop else (T("定格动画", "stop motion") if n_stop == n_shot else T("实拍 / 定格", "live action / stop motion"))+ n_sc = len(plan["shoot"])+ bits.append(T("{what} {n} 镜 → {sc} 个场景、{st} 个机位", "{what} {n} shot{s1} → {sc} scene{s2}, {st} camera setup{s3}",+ what=what, n=n_shot, s1=_s(n_shot), sc=n_sc, s2=_s(n_sc), st=n_set, s3=_s(n_set)))n_post = len({e["shot"] for s in plan["shoot"] for e in s.get("post", [])})if n_post:- bits.append(f"其中 {n_post} 镜拍完还要 AI 加工(" + "、".join(dict.fromkeys(e["kind_zh"] for s in plan["shoot"] for e in s["post"])) + ")")+ bits.append(T("其中 {n} 镜拍完还要 AI 加工({k})", "{n} of them need{v} AI processing after the shoot ({k})",+ n=n_post, v="s" if n_post == 1 else "", k=join(dict.fromkeys(e["kind_zh"] for s in plan["shoot"] for e in s["post"]))))if plan["code"]:n = sum(len(c["shots"]) for c in plan["code"])- bits.append(f"代码渲染/录屏 {n} 镜 → 1 个代码工程" + (f"({len(plan['code'])} 段)" if len(plan["code"]) > 1 else ""))+ bits.append(T("代码渲染/录屏 {n} 镜 → 1 个代码工程", "code render / screen capture {n} shot{s} → 1 code project", n=n, s=_s(n))+ + (T("({n} 段)", " ({n} parts)", n=len(plan["code"])) if len(plan["code"]) > 1 else ""))if plan["local"]:- bits.append(f"静图推拉/静帧 {len(plan['local'])} 镜 → 本地重建")+ n = len(plan["local"])+ bits.append(T("静图推拉/静帧 {n} 镜 → 本地重建", "still-image move / static frame {n} shot{s} → rebuilt locally", n=n, s=_s(n)))if plan["avatar"]:- bits.append(f"数字人 {len(plan['avatar'])} 镜 → TTS + 数字人驱动")- return ";".join(bits)+ n = len(plan["avatar"])+ bits.append(T("数字人 {n} 镜 → TTS + 数字人驱动", "digital avatar {n} shot{s} → TTS + avatar driver", n=n, s=_s(n)))+ return semi().join(bits)def report_md(plan: dict) -> list[str]:if not plan:return []- L = ["", "## 复刻方案", "", f"**{plan['summary']}**", ""]+ L = ["", T("## 复刻方案", "## Remake plan"), "", f"**{plan['summary']}**", ""]if plan.get("engine_note"):L += [f"- {plan['engine_note']}"]if plan["units"]:lim = plan["model_limits"]- L += [f"- 分组规则:同场景、硬切相连的 AI 镜头合并为一次生成(S01);单次 ≤{lim['max']:.0f}s;"- f"单元内连续硬切尽量 ≤{plan['rules']['hardcut_s']['prefer']}s、最多 {plan['rules']['hardcut_s']['max']}s(S06);"- "在叠化/淡入淡出和换场景处切开(S03)"]+ L += [T("- 分组规则:同场景、硬切相连的 AI 镜头合并为一次生成(S01);单次 ≤{mx:.0f}s;单元内连续硬切尽量 ≤{p}s、最多 {m}s(S06);在叠化/淡入淡出和换场景处切开(S03)",+ "- Grouping: AI shots in the same scene joined by hard cuts are generated in one call (S01); ≤{mx:.0f}s per call; "+ "consecutive hard cuts inside a unit preferably ≤{p}s, at most {m}s (S06); split at dissolves / fades and scene changes (S03)",+ mx=lim["max"], p=plan["rules"]["hardcut_s"]["prefer"], m=plan["rules"]["hardcut_s"]["max"])]if plan.get("audio_note"):- L.append(f"- 声音:{plan['audio_note']}")- L += ["", "### 生成单元", "", "| 单元 | 镜头 | 时间 | 时长 | 方式 | 衔接 |", "|---|---|---|---|---|---|"]- mode_zh = {"multi_shot": "一次多镜头", "single": "单镜", "split": "超长切段"}+ L.append(T("- 声音:{a}", "- Audio: {a}", a=plan["audio_note"]))+ L += ["", T("### 生成单元", "### Generation units"), "",+ T("| 单元 | 镜头 | 时间 | 时长 | 方式 | 衔接 |", "| Unit | Shots | Time | Duration | Mode | Continuity |"), "|---|---|---|---|---|---|"]+ mode_zh = LangDict({"multi_shot": "一次多镜头", "single": "单镜", "split": "超长切段"},+ en={"multi_shot": "multi-shot", "single": "single shot", "split": "long shot, split"})for u in plan["units"]:sh = f"#{u['shots'][0]}" + (f"–#{u['shots'][-1]}" if len(u["shots"]) > 1 else "")- sh = "、".join(f"#{i}" for i in u["shots"]) if len(u["ranges"]) > 1 else sh- when = "、".join(f"{a:.1f}–{z:.1f}s" for a, z in u["ranges"])+ sh = join(f"#{i}" for i in u["shots"]) if len(u["ranges"]) > 1 else sh+ when = join(f"{a:.1f}–{z:.1f}s" for a, z in u["ranges"])L.append(f"| {u['id']} | {sh} | {when} | {u['duration']:.1f}s | {mode_zh[u['mode']]}"- f"{'(' + str(u['calls']) + ' 次)' if u['calls'] > 1 else ''} | {u['continuity'] or '—'} |")+ f"{T('({c} 次)', ' ({c} calls)', c=u['calls']) if u['calls'] > 1 else ''} | {u['continuity'] or '—'} |")for u in plan["units"]:- L += ["", f"**{u['id']} · {u['label_zh']} · 镜头 {'、'.join('#' + str(i) for i in u['shots'])} · {u['duration']:.1f}s**", ""]+ L += ["", T("**{id} · {lab} · 镜头 {sh} · {d:.1f}s**", "**{id} · {lab} · shots {sh} · {d:.1f}s**",+ id=u["id"], lab=u["label_zh"], sh=join("#" + str(i) for i in u["shots"]), d=u["duration"]), ""]if u["refs"]:- L.append("- 参考素材:" + ";".join(f"`{r['tag']}` {r['what']}" for r in u["refs"]))+ L.append(T("- 参考素材:", "- References: ") + semi().join(f"`{r['tag']}` {r['what']}" for r in u["refs"]))if u.get("image_prompt"):- L.append(f"- 首帧图像提示词:{u['image_prompt']}")+ L.append(T("- 首帧图像提示词:{p}", "- First-frame image prompt: {p}", p=u["image_prompt"]))for k in ("note", "alt"):if u.get(k):L.append(f"- {u[k]}")if u.get("prompt_missing"):- L.append(f"- 镜头 {'、'.join('#' + str(i) for i in u['prompt_missing'])} 缺提示词")+ L.append(T("- 镜头 {sh} 缺提示词", "- Shots {sh} have no prompt", sh=join("#" + str(i) for i in u["prompt_missing"])))L += ["", "```text", u["prompt"], "```"]if u.get("prompt_en"):L += ["", "<details><summary>English prompt</summary>", "", "```text", u["prompt_en"], "```", "", "</details>"]if plan["shoot"]:- L += ["", "### 拍摄场次", "", "同一场景的镜头集中拍完再换场景;场景内先拍大景别再拍特写,不用重新布光。每条前后多留约 1s 余量。", ""]+ L += ["", T("### 拍摄场次", "### Shooting scenes"), "",+ T("同一场景的镜头集中拍完再换场景;场景内先拍大景别再拍特写,不用重新布光。每条前后多留约 1s 余量。",+ "Shoot every shot of one scene before moving to the next; within a scene, shoot the wider sizes first and the close-ups last "+ "so the lighting is set only once. Leave about 1s of handle at both ends of every take."), ""]for s in plan["shoot"]:- L.append(f"**{s['id']}**:镜头 {'、'.join('#' + str(i) for i in s['shots'])}(成片 {s['screen_s']}s)"- + (f";{s['description']}" if s.get("description") else ""))+ L.append(T("**{id}**:镜头 {sh}(成片 {scr}s)", "**{id}**: shots {sh} ({scr}s on screen)",+ id=s["id"], sh=join("#" + str(i) for i in s["shots"]), scr=s["screen_s"])+ + (semi() + s["description"] if s.get("description") else ""))if s.get("lighting"):- L.append(f"- 布光:{s['lighting']}")+ L.append(T("- 布光:{l}", "- Lighting: {l}", l=s["lighting"]))for st in s["setups"]:- L.append(f"- 机位 {st['shot_size']} · {st['support']} · {'/'.join(st['moves'])}:镜头 {'、'.join('#' + str(i) for i in st['shots'])},"- f"成片 {st['screen_s']}s,建议拍 {st['take_s']}s")+ L.append(T("- 机位 {size} · {sup} · {mv}:镜头 {sh},成片 {scr}s,建议拍 {take}s",+ "- Setup {size} · {sup} · {mv}: shots {sh}, {scr}s on screen, shoot about {take}s",+ size=st["shot_size"], sup=st["support"], mv="/".join(st["moves"]), sh=join("#" + str(i) for i in st["shots"]),+ scr=st["screen_s"], take=st["take_s"]))if s.get("stop_motion"):- L.append(f"- 定格动画({'、'.join('#' + str(i) for i in s['stop_motion'])}):相机固定,每秒约 12 张逐帧拍;用定格 App 的洋葱皮对位,"- "灯光全程不动(避免闪烁)")+ L.append(T("- 定格动画({sh}):相机固定,每秒约 12 张逐帧拍;用定格 App 的洋葱皮对位,灯光全程不动(避免闪烁)",+ "- Stop motion ({sh}): camera locked off, about 12 frames per second shot one at a time; line up frames with a "+ "stop-motion app's onion skin and keep the lighting fixed throughout (avoids flicker)",+ sh=join("#" + str(i) for i in s["stop_motion"])))for e in s.get("post", []):- L.append(f"- 拍完后 #{e['shot']} 要 AI 加工:{e['kind_zh']}" + (f"({e['evidence']})" if e.get("evidence") else "")+ L.append(T("- 拍完后 #{s} 要 AI 加工:{k}", "- After the shoot, #{s} needs AI processing: {k}", s=e["shot"], k=e["kind_zh"])+ + (T("({e})", " ({e})", e=e["evidence"]) if e.get("evidence") else "")+ (f" → {e['how']}" if e.get("how") else ""))L.append("")if plan["code"]:- L += ["", "### 代码合成", "", "一个 Remotion/HTML 工程,按文字轨和版式重建(文字、界面 100% 可控,改文案只改数据);"- "可以让 LLM 直接写这个工程。", ""]+ L += ["", T("### 代码合成", "### Code composition"), "",+ T("一个 Remotion/HTML 工程,按文字轨和版式重建(文字、界面 100% 可控,改文案只改数据);可以让 LLM 直接写这个工程。",+ "One Remotion / HTML project rebuilt from the text tracks and layout (text and UI are 100% controllable; changing copy is a data "+ "change). An LLM can write this project directly."), ""]for c in plan["code"]:- L.append(f"- {c['id']}:镜头 {'、'.join('#' + str(i) for i in c['shots'])}({c['start']:.1f}–{c['end']:.1f}s)"- + (f";其中 {'、'.join('#' + str(i) for i in c['screen_capture'])} 用真实界面录屏" if c["screen_capture"] else ""))+ L.append(T("- {id}:镜头 {sh}({a:.1f}–{z:.1f}s)", "- {id}: shots {sh} ({a:.1f}–{z:.1f}s)",+ id=c["id"], sh=join("#" + str(i) for i in c["shots"]), a=c["start"], z=c["end"])+ + (semi() + T("其中 {sh} 用真实界面录屏", "{sh} use real screen recordings", sh=join("#" + str(i) for i in c["screen_capture"]))+ if c["screen_capture"] else ""))if plan["local"]:- L += ["", "### 本地重建", "", "- " + ";".join(f"#{x['shot']} {x['label_zh']} {x['duration']:.1f}s" for x in plan["local"])- + ":一张图 + 测得的缩放/平移参数,ffmpeg 直接出"]+ L += ["", T("### 本地重建", "### Local rebuild"), "", "- " + semi().join(f"#{x['shot']} {x['label_zh']} {x['duration']:.1f}s" for x in plan["local"])+ + T(":一张图 + 测得的缩放/平移参数,ffmpeg 直接出", ": one image + the measured zoom / pan parameters, rendered straight from ffmpeg")]return Ldiff --git a/rea_video/report.py b/rea_video/report.pyindex fd7d394..2ec61e6 100644--- a/rea_video/report.py+++ b/rea_video/report.py@@ -1,4 +1,4 @@-"""Human-readable reports (Markdown + standalone HTML) from a breakdown."""+"""Human-readable reports (Markdown + standalone HTML) from a breakdown. Language: see i18n (breakdown["lang"])."""from __future__ import annotationsimport html@@ -6,15 +6,27 @@ from pathlib import Pathfrom . import aspectsfrom .classify import LABEL_ZH+from .i18n import LangDict, T, join, lang, semifrom .util import fmt_timefrom .visual import LABEL_COLORfrom .production import report_md as production_mdfrom .vlm import vlm_note-KIND_ZH = {"subtitle": "字幕", "title": "标题", "label": "文字", "static_graphic": "图形贴片", "layout_template": "版式模板",- "huazi": "花字", "animated_sticker": "动态贴纸/GIF", "static_sticker": "静态贴纸", "pip": "画中画"}-CAMERA_ZH = {"static": "固定", "static_with_subject_motion": "固定(主体在动)", "planar_zoom_pan": "整图推拉/平移",- "handheld_like": "手持晃动", "smooth_move": "平滑运镜", "unknown": "—"}+KIND_ZH = LangDict({"subtitle": "字幕", "title": "标题", "label": "文字", "static_graphic": "图形贴片", "layout_template": "版式模板",+ "huazi": "花字", "animated_sticker": "动态贴纸/GIF", "static_sticker": "静态贴纸", "pip": "画中画"},+ en={"subtitle": "subtitle", "title": "title", "label": "text", "static_graphic": "graphic", "layout_template": "layout template",+ "huazi": "styled text", "animated_sticker": "animated sticker / GIF", "static_sticker": "static sticker", "pip": "picture-in-picture"})+CAMERA_ZH = LangDict({"static": "固定", "static_with_subject_motion": "固定(主体在动)", "planar_zoom_pan": "整图推拉/平移",+ "handheld_like": "手持晃动", "smooth_move": "平滑运镜", "unknown": "—"},+ en={"static": "static", "static_with_subject_motion": "static (subject moves)", "planar_zoom_pan": "whole-frame zoom / pan",+ "handheld_like": "handheld shake", "smooth_move": "smooth move", "unknown": "—"})+ANIM_ZH = LangDict({"cut": "直接出现", "pop": "弹出", "fade": "淡入", "slide": "滑入", "reveal": "逐字", "cut_out": "直接消失",+ "pop_out": "缩小消失", "fade_out": "淡出", "slide_out": "滑出"},+ en={"cut": "hard in", "pop": "pop", "fade": "fade in", "slide": "slide in", "reveal": "type-on", "cut_out": "hard out",+ "pop_out": "shrink out", "fade_out": "fade out", "slide_out": "slide out"})+GENDER_ZH = LangDict({"male": "偏男声", "female": "偏女声"}, en={"male": "male-leaning", "female": "female-leaning"})+CONF_ZH = LangDict({"medium": "中", "low": "低", "vlm": "VLM 看到"}, en={"medium": "medium", "low": "low", "vlm": "seen by VLM"})+MODE_ZH = LangDict({"music": "背景音乐", "voice": "人声", "sfx": "音效"}, en={"music": "Music", "voice": "Voice", "sfx": "Sound effects"})def _layers(rec: dict) -> str:@@ -23,7 +35,7 @@ def _layers(rec: dict) -> str:k = KIND_ZH.get(l["kind"], l["kind"])if k not in ks:ks.append(k)- return "、".join(ks) or "—"+ return join(ks) or "—"def _origin(rec: dict) -> str:@@ -36,172 +48,201 @@ def _origin(rec: dict) -> str:kinds.append(it["kind_zh"])unsure = sorted({it["kind_zh"] for it in m.get("items", []) if it.get("real_material") is None})refs = list(dict.fromkeys(x["kind_zh"] for x in m.get("references", [])))- return (m.get("origin_zh", "—") + (f":{'、'.join(kinds)}" if kinds else "")- + (f";待确认是否真实:{'、'.join(unsure)}" if unsure else "")- + (f";复刻参考:{'、'.join(refs)}" if refs else ""))+ colon = T(":", ": ")+ return (m.get("origin_zh", "—") + (f"{colon}{join(kinds)}" if kinds else "")+ + (semi() + T("待确认是否真实:", "real or not, to confirm: ") + join(unsure) if unsure else "")+ + (semi() + T("复刻参考:", "references for the remake: ") + join(refs) if refs else ""))+++def _decided_by(b: dict) -> str:+ if b["analysis"]["vlm"].get("used"):+ return T("确定性取证 + VLM 融合", "deterministic forensics + VLM")+ if (b["analysis"].get("review") or {}).get("shots"):+ return T("确定性取证 + agent 看图融合", "deterministic forensics + agent image review")+ return T("仅确定性取证", "deterministic forensics only")def markdown(b: dict) -> str:s = b["summary"]src = b["source"]- L = [f"# 视频拆解报告:{src['filename']}", "",- f"**结论**:{s['verdict']}", "",- f"- 时长 {src['duration']}s · {src['width']}×{src['height']} · {src['fps']}fps · {src['aspect_ratio']}",- f"- 镜头 {s['shots']} 个,平均 {s['avg_shot_s']}s;转场:" + "、".join(f"{k}×{v}" for k, v in s["transitions"].items()),- f"- 判断置信度(按时长加权):{s['confidence']:.0%};判定方式:" + ("确定性取证 + VLM 融合" if b["analysis"]["vlm"].get("used") else ("确定性取证 + agent 看图融合" if (b["analysis"].get("review") or {}).get("shots") else "仅确定性取证")),+ L = [T("# 视频拆解报告:{f}", "# Video breakdown: {f}", f=src["filename"]), "",+ T("**结论**:{v}", "**Verdict**: {v}", v=s["verdict"]), "",+ T("- 时长 {d}s · {w}×{h} · {fps}fps · {ar}", "- {d}s · {w}×{h} · {fps}fps · {ar}",+ d=src["duration"], w=src["width"], h=src["height"], fps=src["fps"], ar=src["aspect_ratio"]),+ T("- 镜头 {n} 个,平均 {avg}s;转场:", "- {n} shots, {avg}s average; transitions: ", n=s["shots"], avg=s["avg_shot_s"])+ + join(f"{k}×{v}" for k, v in s["transitions"].items()),+ T("- 判断置信度(按时长加权):{c:.0%};判定方式:{by}", "- Confidence (duration-weighted): {c:.0%}; decided by: {by}", c=s["confidence"], by=_decided_by(b)),f"- {s.get('vlm') or vlm_note(b['analysis']['vlm'], b['analysis'].get('review'))}",- "", "", "", "## 制作方式占比", "", "| 底层画面 | 时长 | 占比 |", "|---|---|---|"]+ "", "", "", T("## 制作方式占比", "## Production mix"), "",+ T("| 底层画面 | 时长 | 占比 |", "| Base picture | Duration | Share |"), "|---|---|---|"]for m in s["production_mix"]:L.append(f"| {m['label_zh']} | {m['seconds']}s | {m['ratio']:.0%} |")L += production_md(b.get("production_plan") or {})L += aspects.report_md(b)prov = b.get("provenance", {})if prov.get("hints") or prov.get("encoder"):- L += ["", "## 元数据线索", ""]+ L += ["", T("## 元数据线索", "## Metadata clues"), ""]if prov.get("encoder"):- L.append(f"- 编码器:`{prov['encoder']}`")+ L.append(T("- 编码器:`{e}`", "- Encoder: `{e}`", e=prov["encoder"]))for k, v in (prov.get("hints") or {}).items():- L.append(f"- {k}:{', '.join(v)}")+ L.append(f"- {k}{T(':', ': ')}{', '.join(v)}")a = b.get("audio", {})if a.get("has_audio"):- L += ["", "## 声音拆解", "", "", "",- f"- 整体响度 {a.get('rms_dbfs')} dBFS,峰值 {a.get('peak_dbfs')} dBFS"]+ L += ["", T("## 声音拆解", "## Audio breakdown"), "", "", "",+ T("- 整体响度 {r} dBFS,峰值 {p} dBFS", "- Loudness {r} dBFS, peak {p} dBFS", r=a.get("rms_dbfs"), p=a.get("peak_dbfs"))]v = a.get("voice", {})- L.append(f"- **人声**:{'有' if v.get('present') else '无/很少'},占 {v.get('ratio', 0):.0%} 时长"- + (f",基频约 {v.get('f0_median_hz')}Hz({ {'male': '偏男声', 'female': '偏女声'}.get(v.get('gender_hint'), '性别不确定') })" if v.get("f0_median_hz") else ""))+ L.append(T("- **人声**:{p},占 {r:.0%} 时长", "- **Voice**: {p}, {r:.0%} of the duration",+ p=(T("有", "present") if v.get("present") else T("无/很少", "none / very little")), r=v.get("ratio", 0))+ + (T(",基频约 {f}Hz({g})", ", pitch about {f}Hz ({g})", f=v.get("f0_median_hz"),+ g=GENDER_ZH.get(v.get("gender_hint"), T("性别不确定", "gender unclear"))) if v.get("f0_median_hz") else ""))mu = a.get("music", {})if mu.get("present"):key = mu.get("key") or {}- L.append(f"- **背景音乐**:占 {mu.get('ratio', 0):.0%} 时长({mu.get('start')}–{mu.get('end')}s),约 {mu.get('tempo_bpm')} BPM"- f"(也可能是 {'/'.join(str(t) for t in mu.get('tempo_alternatives', []))})"- + (f",调性 {key.get('tonic')} {key.get('mode')}(置信 {key.get('confidence')})" if key else "")- + (f",段落变化点 {', '.join(str(t) + 's' for t in mu.get('section_changes', [])[:8])}" if mu.get("section_changes") else ""))+ L.append(T("- **背景音乐**:占 {r:.0%} 时长({s}–{e}s),约 {bpm} BPM(也可能是 {alt})",+ "- **Music**: {r:.0%} of the duration ({s}–{e}s), about {bpm} BPM (or {alt})",+ r=mu.get("ratio", 0), s=mu.get("start"), e=mu.get("end"), bpm=mu.get("tempo_bpm"),+ alt="/".join(str(t) for t in mu.get("tempo_alternatives", [])))+ + (T(",调性 {t} {m}(置信 {c})", ", key {t} {m} (confidence {c})", t=key.get("tonic"), m=key.get("mode"), c=key.get("confidence")) if key else "")+ + (T(",段落变化点 {p}", ", section changes at {p}", p=", ".join(str(t) + "s" for t in mu.get("section_changes", [])[:8])) if mu.get("section_changes") else ""))else:- L.append("- **背景音乐**:未检测到持续的音乐床")+ L.append(T("- **背景音乐**:未检测到持续的音乐床", "- **Music**: no sustained music bed detected"))if "cuts_on_beat_ratio" in a:- L.append(f"- **剪辑与节拍**:{a['cuts_on_beat_ratio']:.0%} 的切点落在节拍上(随机约 {a['cuts_on_beat_chance']:.0%})" + ("→ **卡点剪辑**" if a.get("beat_synced_edit") else ""))+ L.append(T("- **剪辑与节拍**:{r:.0%} 的切点落在节拍上(随机约 {c:.0%})", "- **Cuts vs beat**: {r:.0%} of cuts land on a beat (chance: about {c:.0%})",+ r=a["cuts_on_beat_ratio"], c=a["cuts_on_beat_chance"]) + (T("→ **卡点剪辑**", " → **beat-synced edit**") if a.get("beat_synced_edit") else ""))src = b.get("sound_sources") or {}if src:- L += ["", "**声音来源:AI 生成还是现成素材**", ""]+ L += ["", T("**声音来源:AI 生成还是现成素材**", "**Sound sources: AI-generated or existing material**"), ""]if src.get("summary_zh"):- L.append(f"- **结论**:{src['summary_zh']}")+ L.append(T("- **结论**:{s}", "- **Verdict**: {s}", s=src["summary_zh"]))st = b.get("stems") or {}if st.get("ok"):- L.append("- **剥离出的音轨**:`stems/original.wav`(原声)、`stems/vocals.wav`(人声干声,瞬态音效也会落在这里)、`stems/music.wav`(配乐 + 环境声)")+ L.append(T("- **剥离出的音轨**:`stems/original.wav`(原声)、`stems/vocals.wav`(人声干声,瞬态音效也会落在这里)、`stems/music.wav`(配乐 + 环境声)",+ "- **Separated stems**: `stems/original.wav` (original), `stems/vocals.wav` (dry voice; transient sound effects land here too), `stems/music.wav` (music + ambience)"))ctx = src.get("format_context", {})- L.append(f"- 视频形式:{'音乐 MV' if ctx.get('music_mv') else ('疑似带唱歌曲/MV' if ctx.get('music_mv_maybe') else (ctx.get('format') or '普通视频配乐'))}"- f";AI 画面占 {ctx.get('ai_picture_share', 0):.0%},实拍占 {ctx.get('live_picture_share', 0):.0%}")- names = {"music": "背景音乐", "voice": "人声", "sfx": "音效"}+ fmt_name = (T("音乐 MV", "music video") if ctx.get("music_mv") else+ (T("疑似带唱歌曲/MV", "possibly a sung song / music video") if ctx.get("music_mv_maybe") else (ctx.get("format") or T("普通视频配乐", "regular video with music"))))+ L.append(T("- 视频形式:{f};AI 画面占 {ai:.0%},实拍占 {live:.0%}", "- Format: {f}; AI picture {ai:.0%}, live footage {live:.0%}",+ f=fmt_name, ai=ctx.get("ai_picture_share", 0), live=ctx.get("live_picture_share", 0)))for k in ("music", "voice", "sfx"):v = src.get(k)if not v:continue- probs = ",".join(f"{kk} {vv:.0%}" for kk, vv in sorted(v["probs"].items(), key=lambda kv: -kv[1]))- L.append(f"- **{names[k]}**:{v['source_zh']}({probs})")+ probs = T(",", ", ").join(f"{kk} {vv:.0%}" for kk, vv in sorted(v["probs"].items(), key=lambda kv: -kv[1]))+ L.append(f"- **{MODE_ZH[k]}**{T(':', ': ')}{v['source_zh']}({probs})" if lang() == "zh" else f"- **{MODE_ZH[k]}**: {v['source_zh']} ({probs})")for e in v["evidence"]:L.append(f" - {e}")for h in v.get("how_to_confirm", []):- L.append(f" - 确认方法:{h}")+ L.append(T(" - 确认方法:{h}", " - How to confirm: {h}", h=h))pc = b.get("per_clip_audio") or {}if pc.get("ratio") is not None:- L.append(f"- 逐段原生音频检测:切点处背景声变化 {pc['at_cuts_db']}dB,镜头内 {pc['within_shots_db']}dB(比值 {pc['ratio']})"- + ("→ 每段画面自带声音" if pc.get("resets_at_cuts") else "→ 声音跨切点连续,是后期整体铺的"))+ L.append(T("- 逐段原生音频检测:切点处背景声变化 {a}dB,镜头内 {w}dB(比值 {r})",+ "- Per-clip native audio check: background changes {a}dB at cuts vs {w}dB within shots (ratio {r})",+ a=pc["at_cuts_db"], w=pc["within_shots_db"], r=pc["ratio"])+ + (T("→ 每段画面自带声音", " → each clip carries its own sound") if pc.get("resets_at_cuts")+ else T("→ 声音跨切点连续,是后期整体铺的", " → sound runs across cuts, laid in post as one bed")))plan = b.get("audio_plan", {})sfx = plan.get("sfx_merged", [])if sfx:- L += ["", f"**音效**({len(sfx)} 处;来源 vlm=大模型听出,deterministic=信号检测的候选,置信度低)", "",- "| 时间 | 类型 | 描述 | 对应画面 | 来源 |", "|---|---|---|---|---|"]+ L += ["", T("**音效**({n} 处;来源 vlm=大模型听出,deterministic=信号检测的候选,置信度低)",+ "**Sound effects** ({n}; source vlm = heard by the model, deterministic = signal-detected candidate, low confidence)", n=len(sfx)), "",+ T("| 时间 | 类型 | 描述 | 对应画面 | 来源 |", "| Time | Type | Description | On screen | Source |"), "|---|---|---|---|---|"]for e in sfx[:40]:- on = (e.get("on") or {}).get("what") or e.get("sync_with", "切点" if e.get("sync_with_visual") else "")+ on = (e.get("on") or {}).get("what") or e.get("sync_with", T("切点", "cut") if e.get("sync_with_visual") else "")L.append(f"| {float(e.get('t', 0)):.2f}s | {e.get('type', '')} | {e.get('description', '') or e.get('anchor', '')} | "f"{on} | {e.get('source', '')} |")else:- L.append("- **音效**:信号层面未检出显著音效(在人声和音乐下面的轻音效需要 VLM 判断,见 --vlm)")+ L.append(T("- **音效**:信号层面未检出显著音效(在人声和音乐下面的轻音效需要 VLM 判断,见 --vlm)",+ "- **Sound effects**: nothing prominent at the signal level (quiet effects under voice and music need the VLM, see --vlm)"))if plan.get("plan"):- L += ["", "**声音复刻方案**", ""]+ L += ["", T("**声音复刻方案**", "**Audio remake plan**"), ""]for t in plan["plan"]:- L.append(f"- {t['track']}({t['rule']}):{t['what']} → {t['how']}")+ L.append(f"- {t['track']}({t['rule']}):{t['what']} → {t['how']}" if lang() == "zh" else f"- {t['track']} ({t['rule']}): {t['what']} → {t['how']}")if plan.get("mix"):- L.append(f"- 混音:{plan['mix']}")+ L.append(T("- 混音:{m}", "- Mix: {m}", m=plan["mix"]))L += packaging_md(b)w = b.get("whole_video_vlm")if w:- L += ["", "## 结构与文案(VLM)", "", f"- 概括:{w.get('summary', '')}", f"- 形式:{w.get('format', '')};钩子:{w.get('hook', '')}"]+ L += ["", T("## 结构与文案(VLM)", "## Structure and copy (VLM)"), "", T("- 概括:{s}", "- Summary: {s}", s=w.get("summary", "")),+ T("- 形式:{f};钩子:{h}", "- Format: {f}; hook: {h}", f=w.get("format", ""), h=w.get("hook", ""))]n = w.get("narration") or {}- L.append(f"- 旁白:{n.get('type', '')} {n.get('voice', '')};音乐:{(w.get('music') or {}).get('style', '')};字幕:{(w.get('subtitles') or {}).get('style', '')}")- L.append(f"- 整体判断:{w.get('overall_production', '')}")+ L.append(T("- 旁白:{t} {v};音乐:{m};字幕:{s}", "- Narration: {t} {v}; music: {m}; subtitles: {s}",+ t=n.get("type", ""), v=n.get("voice", ""), m=(w.get("music") or {}).get("style", ""), s=(w.get("subtitles") or {}).get("style", "")))+ L.append(T("- 整体判断:{o}", "- Overall: {o}", o=w.get("overall_production", "")))for seg in w.get("segments", [])[:30]:L.append(f" - {seg.get('start')}–{seg.get('end')}s · {seg.get('beat', '')} · {seg.get('copy', '')}")rm = s.get("real_material") or {}if rm.get("shots"):- L += ["", "## 画面里的真实素材", "",- f"共 {len(rm['shots'])} 个镜头、{rm['seconds']}s({rm['ratio']:.0%})的画面里有真实素材(录屏、截图、照片、嵌入视频),"- "复刻时要拿到原文件,不能用模型生成替代:", ""]+ L += ["", T("## 画面里的真实素材", "## Real material in the picture"), "",+ T("共 {n} 个镜头、{s}s({r:.0%})的画面里有真实素材(录屏、截图、照片、嵌入视频),复刻时要拿到原文件,不能用模型生成替代:",+ "{n} shots, {s}s ({r:.0%}) contain real material (screen recordings, screenshots, photos, embedded video). The remake needs the original files; a model cannot stand in for them:",+ n=len(rm["shots"]), s=rm["seconds"], r=rm["ratio"]), ""]for r in b["shots"]:for a in r.get("replication", {}).get("user_assets", []):- L.append(f"- 镜头 #{r['index']}({fmt_time(r['start'])}):{a['kind_zh']},{a['where']}" + (f",{a['description']}" if a.get("description") else ""))+ L.append(T("- 镜头 #{i}({t}):{k},{w}", "- Shot #{i} ({t}): {k}, {w}", i=r["index"], t=fmt_time(r["start"]), k=a["kind_zh"], w=a["where"])+ + (f"{T(',', ', ')}{a['description']}" if a.get("description") else ""))if s.get("references"):- L += ["", "## 复刻要准备的参考素材", "",- "这些镜头的画面是生成或拍摄出来的,下面是画面里出现、复刻时应作为参考图 / 道具准备的东西(不是嵌入的真实像素):", ""]+ L += ["", T("## 复刻要准备的参考素材", "## Reference material to prepare for the remake"), "",+ T("这些镜头的画面是生成或拍摄出来的,下面是画面里出现、复刻时应作为参考图 / 道具准备的东西(不是嵌入的真实像素):",+ "These shots were generated or filmed; the items below appear in them and should be prepared as reference images / props for the remake (they are not embedded real pixels):"), ""]for r in b["shots"]:for a in (r.get("material") or {}).get("references", []):- L.append(f"- 镜头 #{r['index']}({fmt_time(r['start'])}):{a['kind_zh']}" + (f",{a['description']}" if a.get("description") else ""))- L += ["", "## 分镜表", "", "| # | 时间 | 时长 | 底层画面 | 置信度 | 素材来源 | 叠加层 | 运镜 | 复刻路线 |", "|---|---|---|---|---|---|---|---|---|"]+ L.append(T("- 镜头 #{i}({t}):{k}", "- Shot #{i} ({t}): {k}", i=r["index"], t=fmt_time(r["start"]), k=a["kind_zh"])+ + (f"{T(',', ', ')}{a['description']}" if a.get("description") else ""))+ L += ["", T("## 分镜表", "## Shot list"), "",+ T("| # | 时间 | 时长 | 底层画面 | 置信度 | 素材来源 | 叠加层 | 运镜 | 复刻路线 |", "| # | Time | Length | Base picture | Confidence | Material | Overlays | Camera | Remake route |"),+ "|---|---|---|---|---|---|---|---|---|"]for r in b["shots"]:base = r["base"]L.append(f"| {r['index']} | {fmt_time(r['start'])} | {r['duration']:.2f}s | {base['label_zh']} | {base['confidence']:.0%} | {_origin(r)} | {_layers(r)} | "f"{CAMERA_ZH.get(r['features'].get('camera', 'unknown'), '—')} | {r['replication']['rule']} → {r['replication']['executor']} |")- L += ["", "## 逐镜详情", ""]+ L += ["", T("## 逐镜详情", "## Shot by shot"), ""]for r in b["shots"]:base = r["base"]L += [f"### #{r['index']} {fmt_time(r['start'])}–{fmt_time(r['end'])} · {r['verdict']}", "",f"![{r['id']}]({r['assets']['sheet']})", ""]probs = sorted(base["probs"].items(), key=lambda kv: -kv[1])[:3]- L.append("- 概率:" + ",".join(f"{LABEL_ZH[k]} {v:.0%}" for k, v in probs) + f"({base['decided_by']})")- for key, name in (("uncertain", "待确认"), ("disputed", "有分歧")):+ L.append(T("- 概率:", "- Probabilities: ") + T(",", ", ").join(f"{LABEL_ZH[k]} {v:.0%}" for k, v in probs) + f"({base['decided_by']})")+ for key, name in (("uncertain", T("待确认", "To confirm")), ("disputed", T("有分歧", "Disputed"))):if base.get(key):- L.append(f"- ⚠️ {name}:{base[key]}")+ L.append(f"- ⚠️ {name}{T(':', ': ')}{base[key]}")if base.get("scene_text"):- L.append("- 画面里物体上的字(不是后期字幕):" + "、".join(base["scene_text"][:6]))+ L.append(T("- 画面里物体上的字(不是后期字幕):", "- Text on objects in the scene (not subtitles): ") + join(base["scene_text"][:6]))if base.get("image_source"):- L.append(f"- 静帧来源:{base['image_source']}")- L.append(f"- 素材来源:{_origin(r)}")+ L.append(T("- 静帧来源:{s}", "- Still source: {s}", s=base["image_source"]))+ L.append(T("- 素材来源:{o}", "- Material: {o}", o=_origin(r)))for it in (r.get("material") or {}).get("items", []):if it.get("real_material") and it.get("evidence"):- L.append(f" - {it['kind_zh']}:{it['evidence']}")+ L.append(f" - {it['kind_zh']}{T(':', ': ')}{it['evidence']}")if base.get("generator_guess") and base["generator_guess"] != "unknown":- L.append(f"- 可能的工具:{base['generator_guess']}")+ L.append(T("- 可能的工具:{g}", "- Likely tool: {g}", g=base["generator_guess"]))if r.get("beats"):- L.append("- 镜头内动效节拍:" + "、".join(f"{t:.2f}s" for t in r["beats"]))+ L.append(T("- 镜头内动效节拍:", "- Motion beats within the shot: ") + join(f"{t:.2f}s" for t in r["beats"]))for e in base["evidence"][:8]:L.append(f"- {e}")v = r.get("vlm") or r.get("review") or {}if v.get("description"):- L.append(f"- 画面:{v['description']}")+ L.append(T("- 画面:{d}", "- Picture: {d}", d=v["description"]))cl = aspects.shot_text(r) if r["base"]["label"] in aspects.PHOTOGRAPHIC else ""if cl:- L.append(f"- 拍法/打光:{cl}")+ L.append(T("- 拍法/打光:{c}", "- Camera / lighting: {c}", c=cl))intrinsic = base["label"] in ("code_render", "screen_capture")for tr in r.get("text", {}).get("tracks", [])[:4]:- kind = "画面内容文字" if intrinsic else KIND_ZH.get(tr["kind"], tr["kind"])- L.append(f"- 文字轨({kind}/{tr['band']}):" + " / ".join(t[:40] for t in tr["texts"][:4]))+ kind = T("画面内容文字", "text in the picture") if intrinsic else KIND_ZH.get(tr["kind"], tr["kind"])+ L.append(T("- 文字轨({k}/{b}):", "- Text track ({k}/{b}): ", k=kind, b=tr["band"]) + " / ".join(t[:40] for t in tr["texts"][:4]))rep = r["replication"]- L.append(f"- 复刻:{rep['note']}")+ L.append(T("- 复刻:{n}", "- Remake: {n}", n=rep["note"]))if rep.get("capsule", {}).get("image_prompt"):- L.append(f" - 首帧图像提示词:{rep['capsule']['image_prompt']}")+ L.append(T(" - 首帧图像提示词:{p}", " - First-frame image prompt: {p}", p=rep["capsule"]["image_prompt"]))if rep.get("capsule", {}).get("prompt"):- L.append(f" - 视频提示词:{rep['capsule']['prompt']}")+ L.append(T(" - 视频提示词:{p}", " - Video prompt: {p}", p=rep["capsule"]["prompt"]))L.append("")- L += ["## 说明", "",- "- 确定性取证对「是否在动、是否整图推拉、是否渲染纹理、是否 24→30 帧率转换」很可靠;对实拍 / AI / 3D 的区分要依赖 VLM 与人工复核。",- "- 元数据经平台转码常被清除,缺失不代表没有。", ""]+ L += [T("## 说明", "## Notes"), "",+ T("- 确定性取证对「是否在动、是否整图推拉、是否渲染纹理、是否 24→30 帧率转换」很可靠;对实拍 / AI / 3D 的区分要依赖 VLM 与人工复核。",+ "- Deterministic forensics is reliable on motion, whole-frame pan/zoom, rendered texture and 24→30 fps conversion; telling live action from AI from 3D relies on the VLM and human review."),+ T("- 元数据经平台转码常被清除,缺失不代表没有。", "- Platform transcoding usually strips metadata; missing metadata proves nothing."), ""]return "\n".join(L)-ANIM_ZH = {"cut": "直接出现", "pop": "弹出", "fade": "淡入", "slide": "滑入", "reveal": "逐字", "cut_out": "直接消失",- "pop_out": "缩小消失", "fade_out": "淡出", "slide_out": "滑出"}--def packaging_md(b: dict) -> list[str]:"""剪辑包装层: subtitles / 花字 / titles / labels / stickers and the sound effects that land on them."""pack = b.get("packaging")@@ -209,17 +250,19 @@ def packaging_md(b: dict) -> list[str]:return []cues = [c for c in pack.get("text_cues", []) if c["kind"] != "scene" and not c.get("part_of_picture")]stickers = [st for st in pack.get("stickers", []) if not st.get("in_picture")]- L = ["", "## 剪辑包装层(字幕 / 花字 / 贴纸 / 音效卡点)", ""]+ L = ["", T("## 剪辑包装层(字幕 / 花字 / 贴纸 / 音效卡点)", "## Packaging layer (subtitles / styled text / stickers / sound-effect hits)"), ""]for line in pack.get("summary_zh") or []:L.append(f"- {line}")if not cues and not stickers:- L.append("- 没有检出后期叠加的文字或贴纸" + ("(未开 OCR,文字层没有分析)" if not (b.get("analysis") or {}).get("ocr", True) else ""))+ L.append(T("- 没有检出后期叠加的文字或贴纸", "- No overlaid text or stickers detected")+ + (T("(未开 OCR,文字层没有分析)", " (OCR off, text layer not analysed)") if not (b.get("analysis") or {}).get("ocr", True) else ""))files = pack.get("files") or {}if files:- L.append("- 导出:" + "、".join(f"`{v}`" for v in files.values())- + "(SRT 是字幕时间轴;ASS 带颜色、描边、位置和入场动画,字体需要换成原片字体;timeline.json 是完整时间轴)")+ L.append(T("- 导出:", "- Exports: ") + join(f"`{v}`" for v in files.values())+ + T("(SRT 是字幕时间轴;ASS 带颜色、描边、位置和入场动画,字体需要换成原片字体;timeline.json 是完整时间轴)",+ " (SRT is the subtitle timeline; ASS carries colour, outline, position and entrance animation, swap in the original font; timeline.json is the full timeline)"))if cues:- L += ["", "| 时间 | 类型 | 文字 | 样式 | 入场 / 出场 | 音效 |", "|---|---|---|---|---|---|"]+ L += ["", T("| 时间 | 类型 | 文字 | 样式 | 入场 / 出场 | 音效 |", "| Time | Kind | Text | Style | In / out | SFX |"), "|---|---|---|---|---|---|"]sfx_by_ref: dict[str, list[str]] = {}for e in (b.get("audio_plan") or {}).get("sfx_merged", []):ref = (e.get("on") or {}).get("ref")@@ -228,32 +271,37 @@ def packaging_md(b: dict) -> list[str]:for c in sorted(cues, key=lambda c: c["t0"])[:120]:anim = " / ".join(x for x in (ANIM_ZH.get((c.get("anim_in") or {}).get("kind"), ""), ANIM_ZH.get((c.get("anim_out") or {}).get("kind"), "")) if x)if c.get("mid_motion"):- anim += "(中途有弹跳/变色)"- kind = c["kind_zh"] + ("·跟随物体" if c.get("follows") else "")+ anim += T("(中途有弹跳/变色)", " (bounces / changes colour midway)")+ kind = c["kind_zh"] + (T("·跟随物体", " · follows an object") if c.get("follows") else "")L.append(f"| {c['t0']:.2f}–{c['t1']:.2f}s | {kind} | {c['text'].replace('/', ' ⏎ ').replace('|', '|')[:40]} | "- f"{c.get('style_zh', '')} | {anim or '—'} | {'、'.join(sfx_by_ref.get(c['id'], [])) or '—'} |")+ f"{c.get('style_zh', '')} | {anim or '—'} | {join(sfx_by_ref.get(c['id'], [])) or '—'} |")if stickers:- L += ["", "**贴纸 / 动图 / 画中画**", "", "| 时间 | 类型 | 位置 | 动态 | 置信 | 截图 |", "|---|---|---|---|---|---|"]+ L += ["", T("**贴纸 / 动图 / 画中画**", "**Stickers / GIFs / picture-in-picture**"), "",+ T("| 时间 | 类型 | 位置 | 动态 | 置信 | 截图 |", "| Time | Kind | Position | Motion | Confidence | Crop |"), "|---|---|---|---|---|---|"]for st in stickers:- where = "x{:.0%} y{:.0%} 宽{:.0%} 高{:.0%}".format(*st["bbox"]) if st.get("bbox") else (st.get("where") or "—")- dyn = ("循环,周期 %.2fs" % st["loop_period_s"]) if st.get("looping") else ("在动" if st.get("animated") else "静止")+ where = (T("x{0:.0%} y{1:.0%} 宽{2:.0%} 高{3:.0%}", "x{0:.0%} y{1:.0%} w{2:.0%} h{3:.0%}").format(*st["bbox"]) if st.get("bbox") else (st.get("where") or "—"))+ dyn = (T("循环,周期 {p:.2f}s", "loops every {p:.2f}s", p=st["loop_period_s"]) if st.get("looping")+ else (T("在动", "animated") if st.get("animated") else T("静止", "static")))why = []if st.get("crosses_cut"):- why.append("跨切镜不变")+ why.append(T("跨切镜不变", "unchanged across a cut"))if st.get("disappears_mid_shot"):- why.append("镜头中途出现又消失")- conf = {"medium": "中", "low": "低", "vlm": "VLM 看到"}.get(st.get("confidence"), st.get("confidence", ""))- L.append(f"| {st['t0']:.2f}–{st['t1']:.2f}s | {st['kind_zh']} | {where} | {dyn} | {conf}{('(' + '、'.join(why) + ')') if why else ''} | "+ why.append(T("镜头中途出现又消失", "appears and disappears mid-shot"))+ conf = CONF_ZH.get(st.get("confidence"), st.get("confidence", ""))+ L.append(f"| {st['t0']:.2f}–{st['t1']:.2f}s | {st['kind_zh']} | {where} | {dyn} | {conf}{('(' + join(why) + ')') if why else ''} | "+ (f"![{st['id']}]({st['image']})" if st.get("image") else "—") + " |")dropped = [st for st in pack.get("stickers", []) if st.get("in_picture")]if dropped:- L.append(f"- 另有 {len(dropped)} 处画面里突然出现的东西没算作贴纸(3D/动画/版式画面里元素本来就会出现)")+ L.append(T("- 另有 {n} 处画面里突然出现的东西没算作贴纸(3D/动画/版式画面里元素本来就会出现)",+ "- {n} more things that pop up in the picture were not counted as stickers (elements appear on their own in 3D / animation / layout shots)", n=len(dropped)))if pack.get("vlm_text_effects"):- L += ["", "**VLM 看到的文字特效**", ""]+ L += ["", T("**VLM 看到的文字特效**", "**Text effects seen by the VLM**"), ""]for e in pack["vlm_text_effects"][:20]:L.append(f"- {e.get('t', '')}s {e.get('kind', '')}「{e.get('text', '')}」{e.get('style', '')} {e.get('animation', '')}")- L += ["", "复刻:字幕和花字用 `packaging/overlays.ass` 直接压制(ffmpeg -vf ass=overlays.ass),或按 timeline.json 在剪映 / Remotion 里重建;"- "贴纸和动图要找同款素材(表情包库 / GIF 库),截图在 packaging/ 下。"]+ L += ["", T("复刻:字幕和花字用 `packaging/overlays.ass` 直接压制(ffmpeg -vf ass=overlays.ass),或按 timeline.json 在剪映 / Remotion 里重建;"+ "贴纸和动图要找同款素材(表情包库 / GIF 库),截图在 packaging/ 下。",+ "Remake: burn subtitles and styled text in with `packaging/overlays.ass` (ffmpeg -vf ass=overlays.ass), or rebuild them from timeline.json in CapCut / Remotion; "+ "stickers and GIFs need matching assets (meme / GIF libraries), crops are under packaging/.")]return L@@ -262,7 +310,7 @@ def _packaging_html(b: dict) -> str:if not pack:return ""esc = html.escape- parts = ["<section class='shot'><h3 style='margin:4px 0'>剪辑包装层</h3>"]+ parts = [f"<section class='shot'><h3 style='margin:4px 0'>{T('剪辑包装层', 'Packaging layer')}</h3>"]parts += [f"<p>{esc(x)}</p>" for x in pack.get("summary_zh") or []]stickers = [st for st in pack.get("stickers", []) if not st.get("in_picture") and st.get("image")]if stickers:@@ -287,23 +335,31 @@ def html_report(b: dict) -> str:desc = esc((r.get("vlm") or r.get("review") or {}).get("description", ""))prompt = esc(r["replication"].get("capsule", {}).get("prompt", ""))intrinsic = base["label"] in ("code_render", "screen_capture")- texts = "".join(f"<li>{esc('画面内容文字' if intrinsic else KIND_ZH.get(t['kind'], t['kind']))}·{esc(t['band'])}:{esc(' / '.join(x[:40] for x in t['texts'][:4]))}</li>" for t in r.get("text", {}).get("tracks", [])[:4])+ texts = "".join(f"<li>{esc(T('画面内容文字', 'text in the picture') if intrinsic else KIND_ZH.get(t['kind'], t['kind']))}·{esc(t['band'])}{T(':', ': ')}"+ f"{esc(' / '.join(x[:40] for x in t['texts'][:4]))}</li>" for t in r.get("text", {}).get("tracks", [])[:4])rows.append(f"""<section class="shot"><div class="head"><span class="badge" style="background:{c}">{esc(base['label_zh'])} {base['confidence']:.0%}</span><b>#{r['index']}</b> {fmt_time(r['start'])}–{fmt_time(r['end'])} · {r['duration']:.2f}s · {esc(r['verdict'])}- {('<span class="real">真实素材</span>') if (r.get('material') or {}).get('has_real_material') else ''}</div>+ {('<span class="real">' + T('真实素材', 'real material') + '</span>') if (r.get('material') or {}).get('has_real_material') else ''}</div><img src="{esc(r['assets']['sheet'])}" loading="lazy">- <div class="cols"><div><h4>证据</h4><ul>{ev}</ul>{('<h4>文字轨</h4><ul>' + texts + '</ul>') if texts else ''}</div>- <div><h4>画面</h4><p>{desc or '—'}</p><h4>复刻</h4><p>{esc(r['replication']['rule'])} → {esc(r['replication']['executor'])}<br>{esc(r['replication']['note'])}</p>+ <div class="cols"><div><h4>{T('证据', 'Evidence')}</h4><ul>{ev}</ul>{('<h4>' + T('文字轨', 'Text tracks') + '</h4><ul>' + texts + '</ul>') if texts else ''}</div>+ <div><h4>{T('画面', 'Picture')}</h4><p>{desc or '—'}</p><h4>{T('复刻', 'Remake')}</h4><p>{esc(r['replication']['rule'])} → {esc(r['replication']['executor'])}<br>{esc(r['replication']['note'])}</p>{('<p class="prompt">' + prompt + '</p>') if prompt else ''}</div></div></section>""")+def _rgb(label: str) -> str:return "rgb(%d,%d,%d)" % LABEL_COLOR.get(label, (80, 80, 80))mix = "".join(f"<div class='bar' style='flex:{m['ratio']};background:{_rgb(m['label'])}' title='{esc(m['label_zh'])}'>{esc(m['label_zh'])} {m['ratio']:.0%}</div>" for m in s["production_mix"])- return f"""<!doctype html><html lang="zh"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">-<title>拆解:{esc(b['source']['filename'])}</title>+ rm = s.get("real_material") or {}+ real_line = ""+ if rm.get("shots"):+ real_line = ("<p><b>" + T("用户真实素材:", "Real material: ") + "</b>"+ + T("{n} 个镜头,{s}s({r:.0%})——画面里嵌入的真实素材,复刻时需要原文件", "{n} shots, {s}s ({r:.0%}) embed real material; the remake needs the original files",+ n=len(rm["shots"]), s=rm["seconds"], r=rm["ratio"]) + "</p>")+ return f"""<!doctype html><html lang="{lang()}"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">+<title>{T('拆解:', 'Breakdown: ')}{esc(b['source']['filename'])}</title><style>:root{{--bg:#fafaf9;--fg:#1c1917;--muted:#78716c;--card:#fff;--line:#e7e5e4}}@media (prefers-color-scheme:dark){{:root{{--bg:#1c1917;--fg:#f5f5f4;--muted:#a8a29e;--card:#292524;--line:#44403c}}}}@@ -316,10 +372,10 @@ main{{max-width:1100px;margin:auto}} h1{{font-size:22px}} .muted{{color:var(--muh4{{margin:6px 0 2px;font-size:13px;color:var(--muted)}} ul{{margin:0;padding-left:18px}} .prompt{{background:var(--bg);padding:8px;border-radius:6px;font-size:13px}}img.sb{{max-width:100%;border-radius:8px}} .real{{background:#0d9488;color:#fff;border-radius:4px;padding:2px 8px;margin-left:8px;font-size:12px}}</style></head><body><main>-<h1>视频拆解:{esc(b['source']['filename'])}</h1>-<p><b>结论:</b>{esc(s['verdict'])}</p>-{('<p><b>用户真实素材:</b>' + str(len(s['real_material']['shots'])) + ' 个镜头,' + str(s['real_material']['seconds']) + 's(' + format(s['real_material']['ratio'], '.0%') + ')——画面里嵌入的真实素材,复刻时需要原文件</p>') if (s.get('real_material') or {}).get('shots') else ''}-<p class="muted">{b['source']['duration']}s · {b['source']['width']}×{b['source']['height']} · {b['source']['fps']}fps · {s['shots']} 个镜头 · 置信度 {s['confidence']:.0%} ·+<h1>{T('视频拆解:', 'Video breakdown: ')}{esc(b['source']['filename'])}</h1>+<p><b>{T('结论:', 'Verdict: ')}</b>{esc(s['verdict'])}</p>+{real_line}+<p class="muted">{b['source']['duration']}s · {b['source']['width']}×{b['source']['height']} · {b['source']['fps']}fps · {T('{n} 个镜头', '{n} shots', n=s['shots'])} · {T('置信度', 'confidence')} {s['confidence']:.0%} ·{esc(s.get('vlm') or vlm_note(b['analysis']['vlm'], b['analysis'].get('review')))}</p><div class="mix">{mix}</div><img class="sb" src="storyboard.jpg">@@ -331,33 +387,38 @@ img.sb{{max-width:100%;border-radius:8px}} .real{{background:#0d9488;color:#fff;</main></body></html>"""+def _shots(ids) -> str:+ return join("#" + str(i) for i in ids)++def _production_html(plan: dict) -> str:if not plan:return ""esc = html.escape- P = [f"<section class='shot'><h3 style='margin:4px 0'>复刻方案</h3><p><b>{esc(plan['summary'])}</b></p>"]+ P = [f"<section class='shot'><h3 style='margin:4px 0'>{T('复刻方案', 'Remake plan')}</h3><p><b>{esc(plan['summary'])}</b></p>"]if plan.get("engine_note"):P.append(f"<p class='muted'>{esc(plan['engine_note'])}</p>")if plan.get("audio_note"):- P.append(f"<p class='muted'>声音:{esc(plan['audio_note'])}</p>")+ P.append(f"<p class='muted'>{T('声音:', 'Audio: ')}{esc(plan['audio_note'])}</p>")for u in plan.get("units", []):refs = "".join(f"<li><code>{esc(r['tag'])}</code> {esc(r['what'])}</li>" for r in u["refs"])- P.append(f"<h4>{esc(u['id'])} · {esc(u['label_zh'])} · 镜头 {esc('、'.join('#' + str(i) for i in u['shots']))} · "+ P.append(f"<h4>{esc(u['id'])} · {esc(u['label_zh'])} · {T('镜头', 'shots')} {esc(_shots(u['shots']))} · "f"{u['start']:.1f}–{u['end']:.1f}s({u['duration']:.1f}s)</h4>"+ (f"<ul>{refs}</ul>" if refs else "")+ (f"<p class='muted'>{esc(u['continuity'])}</p>" if u.get("continuity") else "")+ "".join(f"<p class='muted'>{esc(u[k])}</p>" for k in ("note", "alt") if u.get(k))+ f"<pre class='prompt' style='white-space:pre-wrap'>{esc(u['prompt'])}</pre>")for sc in plan.get("shoot", []):- rows = "".join(f"<li>机位 {esc(st['shot_size'])} · {esc(st['support'])}:镜头 {esc('、'.join('#' + str(i) for i in st['shots']))},"- f"成片 {st['screen_s']}s,建议拍 {st['take_s']}s</li>" for st in sc["setups"])- rows += "".join(f"<li>拍完后 #{e['shot']} 要 AI 加工:{esc(e['kind_zh'])}" + (f" → {esc(e['how'])}" if e.get("how") else "") + "</li>"- for e in sc.get("post", []))- P.append(f"<h4>场次 {esc(sc['id'])}:镜头 {esc('、'.join('#' + str(i) for i in sc['shots']))}({sc['screen_s']}s)</h4>"+ rows = "".join(T("<li>机位 {size} · {sup}:镜头 {shots},成片 {scr}s,建议拍 {take}s</li>",+ "<li>Setup {size} · {sup}: shots {shots}, {scr}s on screen, shoot about {take}s</li>",+ size=esc(st["shot_size"]), sup=esc(st["support"]), shots=esc(_shots(st["shots"])), scr=st["screen_s"], take=st["take_s"]) for st in sc["setups"])+ rows += "".join(T("<li>拍完后 #{s} 要 AI 加工:{k}", "<li>#{s} gets AI processing after the shoot: {k}", s=e["shot"], k=esc(e["kind_zh"]))+ + (f" → {esc(e['how'])}" if e.get("how") else "") + "</li>" for e in sc.get("post", []))+ P.append(T("<h4>场次 {id}:镜头 {shots}({scr}s)</h4>", "<h4>Scene {id}: shots {shots} ({scr}s)</h4>", id=esc(sc["id"]), shots=esc(_shots(sc["shots"])), scr=sc["screen_s"])+ (f"<p>{esc(sc['description'])}</p>" if sc.get("description") else "")- + (f"<p class='muted'>布光:{esc(sc['lighting'])}</p>" if sc.get("lighting") else "") + f"<ul>{rows}</ul>")+ + (f"<p class='muted'>{T('布光:', 'Lighting: ')}{esc(sc['lighting'])}</p>" if sc.get("lighting") else "") + f"<ul>{rows}</ul>")for c in plan.get("code", []):- P.append(f"<h4>{esc(c['id'])} 代码合成:镜头 {esc('、'.join('#' + str(i) for i in c['shots']))}({c['duration']:.1f}s)</h4>")+ P.append(T("<h4>{id} 代码合成:镜头 {shots}({d:.1f}s)</h4>", "<h4>{id} code render: shots {shots} ({d:.1f}s)</h4>", id=esc(c["id"]), shots=esc(_shots(c["shots"])), d=c["duration"]))P.append("</section>")return "".join(P)@@ -368,12 +429,12 @@ def _sound_html(b: dict) -> str:st = b.get("stems") or {}if not src and not st.get("ok"):return ""- parts = ["<section class='shot'><h3 style='margin:4px 0'>声音</h3>"]+ parts = [f"<section class='shot'><h3 style='margin:4px 0'>{T('声音', 'Audio')}</h3>"]if src.get("summary_zh"):parts.append(f"<p><b>{esc(src['summary_zh'])}</b></p>")if st.get("ok"):- for f, name in (("original.wav", "原声"), ("vocals.wav", "人声干声"), ("music.wav", "配乐 + 环境声")):- parts.append(f"<div>{name}:<audio controls preload='none' src='stems/{f}'></audio></div>")+ for f, name in (("original.wav", T("原声", "original")), ("vocals.wav", T("人声干声", "dry voice")), ("music.wav", T("配乐 + 环境声", "music + ambience"))):+ parts.append(f"<div>{name}{T(':', ': ')}<audio controls preload='none' src='stems/{f}'></audio></div>")if (b.get("assets") or {}).get("audio_timeline") or b.get("audio", {}).get("has_audio"):parts.append("<img class='sb' src='audio.png' onerror=\"this.remove()\">")parts.append("</section>")@@ -381,5 +442,8 @@ def _sound_html(b: dict) -> str:def write_reports(b: dict, out: Path) -> None:+ from .i18n import set_lang++ set_lang(b.get("lang", "zh"))(out / "report.md").write_text(markdown(b), encoding="utf-8")(out / "report.html").write_text(html_report(b), encoding="utf-8")diff --git a/rea_video/sound_source.py b/rea_video/sound_source.pyindex 50408eb..1ed656a 100644--- a/rea_video/sound_source.py+++ b/rea_video/sound_source.py@@ -15,14 +15,20 @@ the VLM's listening judgement. Every verdict carries probabilities, evidence andway to confirm it."""from __future__ import annotations+from .i18n import LangDict, T, join, semi+import numpy as npfrom .audio import SR, N_FFT, T_HOP, _stftfrom .media import extract_audio-MUSIC_ZH = {"ai_generated": "AI 生成音乐", "existing_library": "现成曲库配乐", "popular_song": "现成知名歌曲", "unknown": "待确认"}-SFX_ZH = {"library_editor": "音效库/剪辑软件后期添加", "ai_native": "AI 视频模型随画面生成(原生音频)", "live_sync": "实拍同期声", "unknown": "待确认"}-VOICE_ZH = {"tts": "TTS 配音", "ai_video_native": "AI 视频原生对白(随画面生成)", "human_recording": "真人录音", "unknown": "待确认"}+MUSIC_ZH = LangDict({"ai_generated": "AI 生成音乐", "existing_library": "现成曲库配乐", "popular_song": "现成知名歌曲", "unknown": "待确认"},+ en={"ai_generated": "AI-generated music", "existing_library": "stock library music", "popular_song": "well-known song", "unknown": "to confirm"})+SFX_ZH = LangDict({"library_editor": "音效库/剪辑软件后期添加", "ai_native": "AI 视频模型随画面生成(原生音频)", "live_sync": "实拍同期声", "unknown": "待确认"},+ en={"library_editor": "added in post from an SFX library / editor", "ai_native": "generated with the picture by the video model (native audio)",+ "live_sync": "location sound", "unknown": "to confirm"})+VOICE_ZH = LangDict({"tts": "TTS 配音", "ai_video_native": "AI 视频原生对白(随画面生成)", "human_recording": "真人录音", "unknown": "待确认"},+ en={"tts": "TTS voice-over", "ai_video_native": "native dialogue from the AI video model", "human_recording": "human recording", "unknown": "to confirm"})def _norm(d: dict) -> dict:@@ -119,35 +125,44 @@ def classify_sound_sources(b: dict, meta: dict | None = None) -> dict:p = {"ai_generated": 0.2, "existing_library": 0.6, "popular_song": 0.2}if is_mv:p = {"ai_generated": 0.6, "existing_library": 0.1, "popular_song": 0.3}- ev.append("视频形式是音乐 MV(整片是一首带人声的歌):这类内容的歌大概率是 AI 生成的(先验)")+ ev.append(T("视频形式是音乐 MV(整片是一首带人声的歌):这类内容的歌大概率是 AI 生成的(先验)",+ "The piece is a music video (one sung track over the whole thing): songs in this format are most likely AI-generated (prior)"))elif ctx["music_mv_maybe"]:p = {"ai_generated": 0.45, "existing_library": 0.25, "popular_song": 0.3}- ev.append(f"整片音乐不间断,人声是唱的(持续音高占比 {voice.get('sustained_note_ratio', 0):.2f}):像一首带人声的歌/音乐 MV,AI 歌概率高(未开 VLM,按 MV 先验但降权)")+ ev.append(T("整片音乐不间断,人声是唱的(持续音高占比 {r:.2f}):像一首带人声的歌/音乐 MV,AI 歌概率高(未开 VLM,按 MV 先验但降权)",+ "Music runs wall-to-wall and the voice is sung (sustained-pitch ratio {r:.2f}): looks like a song with vocals / music video, so an AI song is likely (no VLM; music-video prior, down-weighted)",+ r=voice.get('sustained_note_ratio', 0)))else:- ev.append("音乐是给画面垫底的配乐:普通视频的配乐大概率来自现成曲库(先验)")+ ev.append(T("音乐是给画面垫底的配乐:普通视频的配乐大概率来自现成曲库(先验)",+ "The music is a bed under the picture: in a regular video the bed usually comes from a stock library (prior)"))if voice.get("present") and style == "speech":- ev.append(f"人声是说话/旁白而不是唱歌(持续音高占比 {voice.get('sustained_note_ratio', 0):.2f}):属于「旁白 + BGM」的普通视频形式")+ ev.append(T("人声是说话/旁白而不是唱歌(持续音高占比 {r:.2f}):属于「旁白 + BGM」的普通视频形式",+ "The voice is speech / narration, not singing (sustained-pitch ratio {r:.2f}): a regular \"voice-over + music bed\" video",+ r=voice.get('sustained_note_ratio', 0)))if wm.get("lyrics_match_content") is True:p["ai_generated"] += 1.2- ev.append("歌词唱的正是这条视频的具体内容/角色/商品:为本片定制的歌,几乎只能是 AI 生成或专门创作")+ ev.append(T("歌词唱的正是这条视频的具体内容/角色/商品:为本片定制的歌,几乎只能是 AI 生成或专门创作",+ "The lyrics are about this very video's content / characters / product: a song written for this piece, almost certainly AI-generated or commissioned"))if wm.get("song_guess"):p["popular_song"] += 1.2- ev.append(f"VLM 认出了歌曲:{wm['song_guess']}")+ ev.append(T("VLM 认出了歌曲:{s}", "The VLM recognised the song: {s}", s=wm['song_guess']))sg = wm.get("source_guess")if sg in ("ai_generated", "popular_song", "stock_library"):key = {"stock_library": "existing_library"}.get(sg, sg)p[key] += 0.5- ev.append(f"VLM 听感判断:{ {'ai_generated': 'AI 生成', 'popular_song': '知名歌曲', 'stock_library': '曲库配乐'}[sg] }")+ ev.append(T("VLM 听感判断:{s}", "VLM listening judgement: {s}",+ s={'ai_generated': T('AI 生成', 'AI-generated'), 'popular_song': T('知名歌曲', 'well-known song'), 'stock_library': T('曲库配乐', 'stock library music')}[sg]))mt = (meta.get("music") or {}) if isinstance(meta.get("music"), dict) else {}if mt.get("title"):original = bool(mt.get("is_original")) or any(k in str(mt.get("title")) for k in ("原声", "original sound"))if original:p["ai_generated"] += 0.3 if (is_mv or ctx["music_mv_maybe"]) else 0.0- ev.append(f"平台音乐信息是作者原声「{mt.get('title')}」:不是平台曲库里的现成歌曲")+ ev.append(T("平台音乐信息是作者原声「{t}」:不是平台曲库里的现成歌曲", "Platform music tag is the creator's original sound \"{t}\": not a track from the platform library", t=mt.get('title')))p["popular_song"] *= 0.4else:p["popular_song" if mt.get("popular") else "existing_library"] += 1.5- ev.append(f"平台音乐信息:「{mt.get('title')}」{('— ' + str(mt.get('author'))) if mt.get('author') else ''}(现成曲目)")+ ev.append(T("平台音乐信息:「{t}」{a}(现成曲目)", "Platform music tag: \"{t}\"{a} (existing track)",+ t=mt.get('title'), a=('— ' + str(mt.get('author'))) if mt.get('author') else ''))ending = music_ending(audio, dur)if ending == "hard_cut":if is_mv or ctx["music_mv_maybe"]: # a sung song cut mid-phrase: a clip of a released song, or just a trimmed AI song@@ -156,14 +171,17 @@ def classify_sound_sources(b: dict, meta: dict | None = None) -> dict:else:p["existing_library"] += 0.35p["popular_song"] += 0.15- ev.append("片尾音乐被硬切断(还在满音量时视频就结束了):常见于截取现成曲目")+ ev.append(T("片尾音乐被硬切断(还在满音量时视频就结束了):常见于截取现成曲目",+ "The music is hard-cut at the end (still at full level when the video stops): typical of a trimmed existing track"))elif ending == "ends_with_video":p["ai_generated"] += 0.15- ev.append("音乐与视频同时收尾:按片长剪辑或定制过(两种来源都可能,弱证据)")+ ev.append(T("音乐与视频同时收尾:按片长剪辑或定制过(两种来源都可能,弱证据)",+ "Music and video end together: edited to length or custom-made (either source possible, weak evidence)"))prov = (b.get("provenance") or {}).get("aigc") or {}if prov.get("label") == "1":p["ai_generated"] += 0.15- ev.append("文件带 AIGC 隐式标识(整片声明含 AI 生成内容,音乐可能也在其中,弱证据)")+ ev.append(T("文件带 AIGC 隐式标识(整片声明含 AI 生成内容,音乐可能也在其中,弱证据)",+ "The file carries an implicit AIGC marker (the whole piece declares AI-generated content, which may include the music; weak evidence)"))probs = _norm(p)lab = max(probs, key=probs.get)conf = probs[lab]@@ -171,9 +189,12 @@ def classify_sound_sources(b: dict, meta: dict | None = None) -> dict:"source": lab if conf >= 0.45 else "unknown", "source_zh": MUSIC_ZH[lab if conf >= 0.45 else "unknown"],"leaning": lab, "probs": probs, "ending": ending, "evidence": ev,"how_to_confirm": [- "在抖音/小红书原视频页面看音乐标签:显示歌名 → 现成曲目;显示「@作者创作的原声」→ 作者自己上传(MV 类多为 AI 歌)",- "用汽水音乐/QQ 音乐「听歌识曲」或 ACRCloud 识别:识别得到就是现成歌曲",- "听:AI 歌常见咬字含糊、高频发虚带金属感、歌词紧扣画面内容;曲库配乐多为无人声、结构标准、片尾被截断或淡出",+ T("在抖音/小红书原视频页面看音乐标签:显示歌名 → 现成曲目;显示「@作者创作的原声」→ 作者自己上传(MV 类多为 AI 歌)",+ "Check the music tag on the original Douyin / Xiaohongshu / TikTok post: a song title → existing track; \"original sound - @creator\" → uploaded by the creator (for music videos, usually an AI song)"),+ T("用汽水音乐/QQ 音乐「听歌识曲」或 ACRCloud 识别:识别得到就是现成歌曲",+ "Run it through Shazam / ACRCloud or another song-ID service: a hit means an existing song"),+ T("听:AI 歌常见咬字含糊、高频发虚带金属感、歌词紧扣画面内容;曲库配乐多为无人声、结构标准、片尾被截断或淡出",+ "Listen: AI songs tend to have mushy diction, a thin metallic top end and lyrics that track the picture; library beds are mostly instrumental, standard in structure, and truncated or faded at the end"),],}@@ -184,22 +205,24 @@ def classify_sound_sources(b: dict, meta: dict | None = None) -> dict:nt = nar.get("type")if nt == "tts":p["tts"] += 1.0- ev.append("VLM 判断为 TTS 合成音")+ ev.append(T("VLM 判断为 TTS 合成音", "The VLM hears a TTS voice"))elif nt == "human":p["human_recording"] += 0.8- ev.append("VLM 判断为真人声音")+ ev.append(T("VLM 判断为真人声音", "The VLM hears a human voice"))if live_share > 0.5:p["human_recording"] += 0.8- ev.append(f"{live_share:.0%} 的画面是实拍:人声多为同期录音或真人配音")+ ev.append(T("{s:.0%} 的画面是实拍:人声多为同期录音或真人配音", "{s:.0%} of the picture is live footage: the voice is most likely location sound or a human voice-over", s=live_share))if ai_share > 0.4 and clip.get("resets_at_cuts"):p["ai_video_native"] += 1.0- ev.append("背景声在每个切点跳变、画面是 AI 视频:人声很可能是视频模型连同画面一起生成的(如 Seedance/Veo/H3 原生音频)")+ ev.append(T("背景声在每个切点跳变、画面是 AI 视频:人声很可能是视频模型连同画面一起生成的(如 Seedance/Veo/H3 原生音频)",+ "The background sound jumps at every cut and the picture is AI video: the voice was most likely generated with the picture by the video model (e.g. Seedance / Veo / H3 native audio)"))elif clip.get("ratio") is not None and not clip.get("resets_at_cuts") and live_share < 0.3:p["tts"] += 0.4- ev.append("人声和背景声跨切点连续:整条旁白是后期单独配上去的(TTS 或真人配音)")+ ev.append(T("人声和背景声跨切点连续:整条旁白是后期单独配上去的(TTS 或真人配音)",+ "Voice and background sound run across cuts: the voice-over was laid on separately in post (TTS or a human voice-over)"))if voice.get("f0_cv") is not None and voice["f0_cv"] < 0.12:p["tts"] += 0.2- ev.append(f"音高起伏偏平(变异系数 {voice['f0_cv']}),偏向 TTS(弱证据)")+ ev.append(T("音高起伏偏平(变异系数 {cv}),偏向 TTS(弱证据)", "Pitch contour is flat (coefficient of variation {cv}), leaning TTS (weak evidence)", cv=voice['f0_cv']))probs = _norm(p)lab = max(probs, key=probs.get)out["voice"] = {"source": lab if probs[lab] >= 0.45 else "unknown", "source_zh": VOICE_ZH[lab if probs[lab] >= 0.45 else "unknown"],@@ -213,15 +236,18 @@ def classify_sound_sources(b: dict, meta: dict | None = None) -> dict:synced = [e for e in sfx if e.get("sync_with") in ("cut", "text_pop", "transition") or e.get("sync_with_visual")]if sfx and len(synced) / len(sfx) >= 0.4:p["library_editor"] += 0.8- ev.append(f"{len(synced)}/{len(sfx)} 个音效踩在切镜/文字弹出/转场上:剪辑时从音效库添加")+ ev.append(T("{a}/{b} 个音效踩在切镜/文字弹出/转场上:剪辑时从音效库添加", "{a}/{b} sound effects land on cuts / text pops / transitions: added from an SFX library in the edit", a=len(synced), b=len(sfx)))if clip.get("resets_at_cuts") and ai_share > 0.4:p["ai_native"] += 1.0- ev.append(f"背景声/环境声在切点跳变(切点 {clip.get('at_cuts_db')}dB vs 镜头内 {clip.get('within_shots_db')}dB),且画面是 AI 视频:每段自带的音效/环境声是视频模型原生生成的")+ ev.append(T("背景声/环境声在切点跳变(切点 {a}dB vs 镜头内 {w}dB),且画面是 AI 视频:每段自带的音效/环境声是视频模型原生生成的",+ "Background / ambience jumps at cuts ({a}dB at cuts vs {w}dB within shots) and the picture is AI video: each clip's own SFX / ambience was generated natively by the video model",+ a=clip.get('at_cuts_db'), w=clip.get('within_shots_db')))if live_share > 0.5:p["live_sync"] += 1.0- ev.append("画面以实拍为主:环境声多为同期声")+ ev.append(T("画面以实拍为主:环境声多为同期声", "The picture is mostly live footage: the ambience is most likely location sound"))if b["source"]["path"] and any(l == "cg_3d" for l in labels) and sfx and not clip.get("resets_at_cuts"):- ev.append("3D/动画类视频的卡通音效也常由程序合成或音效库添加(例如 capsule-cinema plush 配方用程序合成)")+ ev.append(T("3D/动画类视频的卡通音效也常由程序合成或音效库添加(例如 capsule-cinema plush 配方用程序合成)",+ "Cartoon SFX in 3D / animated videos are also often procedurally synthesised or added from a library (e.g. the capsule-cinema plush recipe synthesises them)"))probs = _norm(p)lab = max(probs, key=probs.get)out["sfx"] = {"source": lab if probs[lab] >= 0.45 else "unknown", "source_zh": SFX_ZH[lab if probs[lab] >= 0.45 else "unknown"],@@ -231,17 +257,20 @@ def classify_sound_sources(b: dict, meta: dict | None = None) -> dict:vt = video_type(ctx, voice, music, clip, ai_share, live_share)ctx["video_type"], ctx["video_type_zh"] = vt, VIDEO_TYPE_ZH[vt]parts = []- for k, name in (("voice", "人声"), ("music", "音乐"), ("sfx", "音效")):+ for k, name in (("voice", T("人声", "voice")), ("music", T("音乐", "music")), ("sfx", T("音效", "SFX"))):v = out.get(k)if v:z = {"voice": VOICE_ZH, "music": MUSIC_ZH, "sfx": SFX_ZH}[k][v["leaning"]]- parts.append(f"{name}{z}" + ("" if v["source"] != "unknown" and v["probs"][v["leaning"]] >= 0.6 else "(倾向,待确认)"))- out["summary_zh"] = f"视频类型:{VIDEO_TYPE_ZH[vt]} → " + ";".join(parts)+ parts.append(T("{n}{z}", "{n}: {z}", n=name, z=z) + ("" if v["source"] != "unknown" and v["probs"][v["leaning"]] >= 0.6 else T("(倾向,待确认)", " (leaning, to confirm)")))+ out["summary_zh"] = T("视频类型:{t} → ", "Video type: {t} → ", t=VIDEO_TYPE_ZH[vt]) + semi().join(parts)return out-VIDEO_TYPE_ZH = {"music_mv": "音乐 MV / 歌曲类(整片是一首唱出来的歌)", "ai_native_audio": "AI 视频原生出声(每段画面自带声音)",- "live": "实拍(同期声 + 后期配乐)", "narrated": "旁白/口播 + 配乐", "music_bed": "纯配乐(无人声)", "other": "其他"}+VIDEO_TYPE_ZH = LangDict({"music_mv": "音乐 MV / 歌曲类(整片是一首唱出来的歌)", "ai_native_audio": "AI 视频原生出声(每段画面自带声音)",+ "live": "实拍(同期声 + 后期配乐)", "narrated": "旁白/口播 + 配乐", "music_bed": "纯配乐(无人声)", "other": "其他"},+ en={"music_mv": "music video / song (one sung track over the whole piece)", "ai_native_audio": "AI video with native audio (each clip carries its own sound)",+ "live": "live footage (location sound + music added in post)", "narrated": "voice-over / talking head + music",+ "music_bed": "music bed only (no voice)", "other": "other"})def video_type(ctx: dict, voice: dict, music: dict, clip: dict, ai_share: float, live_share: float) -> str:diff --git a/rea_video/vlm.py b/rea_video/vlm.pyindex 281620e..f0e184a 100644--- a/rea_video/vlm.py+++ b/rea_video/vlm.py@@ -57,31 +57,43 @@ class VLMConfig:SETUP_HINT = ("建议配置 VLM(任意 OpenAI 兼容的多模态模型,如 Gemini / GPT-4o / 豆包 / Qwen-VL):""设置 REA_VLM_BASE_URL、REA_VLM_API_KEY、REA_VLM_MODEL(可写多个模型逗号分隔做备选),再加 --vlm 重跑")+SETUP_HINT_EN = ("configure a VLM (any OpenAI-compatible multimodal model, e.g. Gemini / GPT-4o / Doubao / Qwen-VL): "+ "set REA_VLM_BASE_URL, REA_VLM_API_KEY and REA_VLM_MODEL (several models comma-separated as fallbacks), then rerun with --vlm")def vlm_note(info: dict, review: dict | None = None) -> str:"""One line for reports / summaries: did the VLM (or an agent's review) actually contribute, and what to do if not."""+ from .i18n import T, semi+base = _vlm_note(info)if review and review.get("shots"):- seen = f"由 {review.get('by', 'agent')} 看图复核 {review['shots']}/{review.get('of', '?')} 个镜头,已并入结论"- return seen if (info.get("status") or "off") == "off" else f"{base.split(';')[0]};{seen}"+ seen = T("由 {by} 看图复核 {n}/{of} 个镜头,已并入结论", "{by} reviewed {n}/{of} shots by eye; merged into the verdict",+ by=review.get("by", "agent"), n=review["shots"], of=review.get("of", "?"))+ return seen if (info.get("status") or "off") == "off" else f"{base.split(semi())[0]}{semi()}{seen}"return basedef _vlm_note(info: dict) -> str:+ from .i18n import T+status = info.get("status") or ("ok" if info.get("used") else "off")if status == "ok":- return f"VLM 已生效({info.get('model', '')})"+ return T("VLM 已生效({m})", "VLM active ({m})", m=info.get("model", ""))if status == "partial":- return (f"VLM 部分生效({info.get('model', '')}:{info.get('ok_shots', 0)}/{info.get('asked_shots', 0)} 个镜头有结果,"- f"整片分析{'有' if info.get('whole_ok') else '失败'});失败的镜头只靠确定性取证")- limited = "实拍/AI/3D 的区分只靠像素统计,可信度有限"+ return T("VLM 部分生效({m}:{ok}/{asked} 个镜头有结果,整片分析{w});失败的镜头只靠确定性取证",+ "VLM partly active ({m}: {ok}/{asked} shots answered, whole-video pass {w}); failed shots rely on deterministic forensics only",+ m=info.get("model", ""), ok=info.get("ok_shots", 0), asked=info.get("asked_shots", 0),+ w=(T("有", "succeeded") if info.get("whole_ok") else T("失败", "failed")))+ limited = T("实拍/AI/3D 的区分只靠像素统计,可信度有限", "live action / AI / 3D are told apart from pixel statistics only, so confidence is limited")if status == "failed":err = (info.get("errors") or [""])[0]- return f"VLM 已请求但全部调用失败({info.get('model', '')}:{err[:80]}),本次等同未开 VLM;{limited}。可稍后重试或换模型"+ return T("VLM 已请求但全部调用失败({m}:{e}),本次等同未开 VLM;{l}。可稍后重试或换模型",+ "VLM requested but every call failed ({m}: {e}), so this run is the same as no VLM; {l}. Retry later or switch models",+ m=info.get("model", ""), e=err[:80], l=limited)if status == "not_configured":- return f"VLM 已请求但没找到配置,本次未开 VLM;{limited}。{SETUP_HINT}"- return f"未开 VLM;{limited}。能看图的 agent:运行 rea-video review 逐镜看图并 apply-review 并入;否则{SETUP_HINT}"+ return T("VLM 已请求但没找到配置,本次未开 VLM;{l}。{h}", "VLM requested but no configuration found, so this run had no VLM; {l}. {h}", l=limited, h=T(SETUP_HINT, SETUP_HINT_EN))+ return T("未开 VLM;{l}。能看图的 agent:运行 rea-video review 逐镜看图并 apply-review 并入;否则{h}",+ "No VLM; {l}. An agent that can see images: run rea-video review, look at each shot and merge with apply-review; otherwise {h}", l=limited, h=T(SETUP_HINT, SETUP_HINT_EN))def _data_uri(path: Path, mime: str) -> str:@@ -276,3 +288,13 @@ def normalize_shot_result(raw: dict) -> dict:total = sum(clean.values()) or 1.0raw["label_probs"] = {k: v / total for k, v in clean.items()}return raw+++def prompt_lang_note() -> str:+ """Appended to SHOT_PROMPT / WHOLE_PROMPT: free-text answers follow the report language (enum values stay as given)."""+ from .i18n import lang++ if lang() == "en":+ return ("\n\nWrite every free-text value (evidence, description, style, summary, copy, prompts, aspects answers) in English. "+ "Keep enum values exactly as listed. `image_prompt` and `video_prompt` in English; `video_prompt_en` may repeat it.")+ return ""diff --git a/skills/rea-video/SKILL.md b/skills/rea-video/SKILL.mdindex 64edba5..d091e3e 100644--- a/skills/rea-video/SKILL.md+++ b/skills/rea-video/SKILL.md@@ -32,7 +32,7 @@ VLM(能看图的多模态模型)建议配,不强制,配置方法也在 `# ⓪ 先看记住了什么:用户偏好(默认引擎、是否开 VLM、给你的偏好说明)和常见纠正类型rea-video memory# ① 拆解(产出 out/<名>/breakdown.json、report.html、report.md、storyboard.jpg、audio.png、shots/、stems/)-rea-video --env-file <你的 .env> decompose ref.mp4 -o out/ref --vlm # 没有 VLM 配置就去掉 --env-file 和 --vlm;字幕/花字是日文就加 --ocr-lang ja+rea-video --env-file <你的 .env> decompose ref.mp4 -o out/ref --vlm --lang <zh|en> # --lang 按用户提问的语言选(见「交付给用户」);没有 VLM 配置就去掉 --env-file 和 --vlm;字幕/花字是日文就加 --ocr-lang ja# ② 看紧凑摘要:低置信镜头会被标出;先看 VLM: 那一行确认 VLM 是否生效rea-video summary out/ref/breakdown.json```@@ -76,7 +76,10 @@ rea-video summary out/ref/breakdown.json # 用并入后的结果写回复按 `references/output-template.md` 回复:先一句话结论,再复刻方案(按生成单元 / 拍摄场次组织),然后分镜表、剪辑包装、声音、真实素材清单、不确定点,最后给 `report.html` 路径。不要把 breakdown.json 整段贴进对话。-**用用户的语言回复。**工具生成的 `report.html` / `report.md` 目前是中文,用户用英文或其他语言提问时,回复里的结论、复刻方案、分镜表、声音和素材清单都用用户的语言写(提示词给中英两版),并说明报告文件本身是中文;用户要英文报告时,把 `report.md` 翻译成 `report_en.md` 放在同一目录。+**报告和回复都用用户的语言。**语言的判断顺序:用户明确指定的语言(「用英文出报告」「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 也用这个语言写。+- 用户用日语、韩语等工具不支持的语言提问时,跑 `--lang en`,回复用用户的语言写;用户要该语言的报告文件时,把 `report.md` 翻译成 `report_<语言>.md` 放在同一目录,并说明 `report.html` 是英文的。+- 用户设了长期偏好(「以后都出英文报告」)就 `rea-video prefs lang en` 记下来。## 3. 复刻(需要时)diff --git a/skills/rea-video/references/output-template.md b/skills/rea-video/references/output-template.mdindex 0e6e4de..7894fff 100644--- a/skills/rea-video/references/output-template.md+++ b/skills/rea-video/references/output-template.md@@ -11,6 +11,10 @@- 然后写剪辑包装(字幕样式和时间轴文件、花字 / 贴纸清单、音效卡点)、声音拆解、真实素材清单,最后写不确定点。- 报告文件路径(`report.html`)写给用户。不要把 breakdown.json 整段贴进对话。+## 语言++报告语言跟 `--lang` 走(zh / en),回复语言跟用户走;两者的判断顺序见 SKILL.md「交付给用户」。下面的模板是中文版,英文回复用同样的结构:one-line verdict → remake plan → shot list → packaging → audio → material you must supply → open questions → report path。+## 回复模板(中文)**一句话结论**:混合制作——底层画面 AI 生成视频 62%、代码模板 30%、实拍 8%;全片字幕由代码叠加;引入了 2 段真实截图;女声 TTS + 110 BPM 流行 BGM,切镜卡在节拍上。diff --git a/tests/test_i18n.py b/tests/test_i18n.pynew file mode 100644index 0000000..2932907--- /dev/null+++ b/tests/test_i18n.py@@ -0,0 +1,28 @@+from rea_video.i18n import LangDict, T, join, set_lang+from rea_video.classify import LABEL_ZH+++def test_T_and_langdict_follow_language():+ try:+ set_lang("zh")+ assert T("实拍", "live action") == "实拍"+ assert LABEL_ZH["ai_video"] == "AI 生成视频"+ assert join(["a", "b"]) == "a、b"+ set_lang("en")+ assert T("实拍", "live action") == "live action"+ assert T("{n} 个镜头", "{n} shots", n=3) == "3 shots"+ assert T("只有中文") == "只有中文" # no English yet: falls back+ assert LABEL_ZH["ai_video"] == "AI-generated video"+ assert dict(LABEL_ZH.items())["cg_3d"] == "3D render"+ assert join(["a", "b"]) == "a, b"+ d = LangDict({"x": "甲"}, en={})+ assert d["x"] == "甲" and "x" in d and len(d) == 1+ finally:+ set_lang("zh")+++def test_unknown_language_rejected():+ import pytest++ with pytest.raises(ValueError):+ set_lang("fr")diff --git a/tests/test_pipeline.py b/tests/test_pipeline.pyindex b53989d..2561ef4 100644--- a/tests/test_pipeline.py+++ b/tests/test_pipeline.py@@ -102,3 +102,24 @@ def test_remake_jobs_and_assemble(breakdown, tmp_path):assert Path(res["remake"]).is_file() and Path(res["compare"]).is_file()info = video_info(res["remake"])assert abs(info.duration - b["source"]["duration"]) < 0.2+++def test_english_report_has_no_chinese(media, tmp_path):+ import re++ from rea_video.i18n import set_lang++ try:+ b = decompose(media["edit"], tmp_path / "en", use_vlm=False, ocr=False, stems=False, lang="en")+ assert b["lang"] == "en"+ assert b["shots"][0]["base"]["label_zh"] == "static hold"+ cjk = re.compile(r"[一-鿿]")+ for name in ("report.md", "report.html"):+ bad = [l for l in (tmp_path / "en" / name).read_text().splitlines() if cjk.search(l)]+ assert not bad, f"{name} still has Chinese lines:\n" + "\n".join(bad[:20])+ # the same breakdown rendered again in Chinese+ b["lang"] = "zh"+ again = finalize(b, tmp_path / "en")+ assert again["shots"][0]["base"]["label_zh"] == "静帧停留"+ finally:+ set_lang("zh")