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
Tune remake planning and camera hints
june78160e053d37
diff --git a/rea_video/capabilities/models/video.yaml b/rea_video/capabilities/models/video.yamlindex 3b21ba1..45db048 100644--- a/rea_video/capabilities/models/video.yaml+++ b/rea_video/capabilities/models/video.yaml@@ -442,7 +442,7 @@ models:exclusive_inputs: [[video.i2v_first_frame, video.i2v_first_last], [video.multi_reference, video.reference_video, video.reference_audio]]audio: {native: true}# 复刻方案默认的排法,不改变上面的模型上限- planning: {strategy: keyframes}+ planning: {strategy: keyframes, images: 4}strengths:- 第三方榜单前三(H3 Max Elo 约 1227),且列价最低- 权重开放(H3-Base 可在本地跑 768p)@@ -507,7 +507,7 @@ models:resolutions: [480p, 768p]refs: {image: 9, video: 3, audio: 3, total: 12}audio: {native: true, voice_ref: true}- planning: {strategy: keyframes}+ planning: {strategy: keyframes, images: 4}strengths:- 便宜、快(6 步采样);可以单独导出声音分轨- 提示词指南写得很细,参考图、参考视频、参考音频都能用diff --git a/rea_video/cli.py b/rea_video/cli.pyindex e22b57c..f96f713 100644--- a/rea_video/cli.py+++ b/rea_video/cli.py@@ -543,17 +543,6 @@ def cmd_compare(args) -> int:for p in (args.ref, args.remake):if not Path(p).is_file():raise SystemExit(U(f"rea-video: 找不到 {p}", f"rea-video: not found: {p}"))- if getattr(args, "breakdown", None):- from .remake_qa import evaluate_remake-- bp = Path(args.breakdown)- if not bp.is_file():- raise SystemExit(U(f"rea-video: 找不到 {bp}", f"rea-video: not found: {bp}"))- b = read_json(bp)- b = {**b, "source": {**(b.get("source") or {}), "path": str(Path(args.ref).resolve())}}- qa = evaluate_remake(b, args.remake, out_dir=Path(args.out) if args.out else None, replaced_only=False)- print(json.dumps(qa, ensure_ascii=False, indent=1))- return 0from .layers import compareif args.every <= 0:@@ -1052,7 +1041,7 @@ def main(argv: list[str] | None = None) -> int:a.add_argument("--overlays", action="store_true",help="把测得的字幕 / 花字 / 标题按原样式叠回换掉的镜头(保留原片的镜头本来就有);贴纸只列出来,要自己找素材")a.add_argument("--retime", choices=["smooth", "warp"], default="smooth",- help="时间对齐方式:smooth 均匀连续帧混合重采样、零冻结帧(默认)/ warp 离散运动峰值动态时间规整")+ help="怎么把生成片段对到原镜头时长:smooth 均匀变速并补帧混合(默认)/ warp 按动作峰值对齐原片")a.set_defaults(func=cmd_assemble)t = sub.add_parser("tiles", help="按时间抽帧拼图,近距离检查某一段(agent 复核用)")@@ -1075,10 +1064,9 @@ def main(argv: list[str] | None = None) -> int:fr.add_argument("--all", action="store_true", help="所有镜头都做,不只是代码渲染镜头")fr.set_defaults(func=cmd_frames)- cp = sub.add_parser("compare", help="比较复刻成片与原片:默认比对代码图形层,传 --breakdown 时逐镜评测运镜、姿态动态、构图与流畅度")+ cp = sub.add_parser("compare", help="逐帧比较复刻和原片画上去的那一层(落在哪、形状重合度、多少),列出最差的时刻并拼对比图")cp.add_argument("ref", help="原片")cp.add_argument("remake", help="复刻成片")- cp.add_argument("--breakdown", help="breakdown.json:按镜头评测生成式复刻的运镜方向、主体姿态动态、构图轮廓与冻结帧")cp.add_argument("--every", type=float, default=0.5, help="采样间隔秒数(默认 0.5)")cp.add_argument("--scenes", help="frames/scenes.json:按场景汇总分数")cp.add_argument("--worst", type=int, default=8, help="对比图里放几个最差时刻(默认 8)")diff --git a/rea_video/cli_en.py b/rea_video/cli_en.pyindex b9f8a82..2bd1548 100644--- a/rea_video/cli_en.py+++ b/rea_video/cli_en.py@@ -69,7 +69,7 @@ HELP = {"capsule-draft.python": "capsule-cinema Python; same default as remake-run","assemble": "through Capsule Cinema: put remade shots back on the original timeline and output a comparison video","assemble.results": "results.json from remake-run (or your own file in the same format)",- "assemble.retime": "timing alignment: smooth frame-blended resampling with zero frozen frames (default) / warp discrete DTW peak matching",+ "assemble.retime": "timing: smooth evenly resamples with frame blending (default) / warp lines up motion peaks with the original","assemble.capsule_root": _CAPSULE_ROOT,"assemble.overlays": "put measured captions / styled text / titles back on replaced shots in their original style (kept shots already have them); stickers are only listed, so source them yourself",@@ -83,10 +83,9 @@ HELP = {"frames.points": "sample points per scene (default 4000)","frames.all": "process all shots, not only code-rendered ones",- "compare": "compare a remake against the original: drawn graphics layer by default, or per-shot camera/pose/layout/smoothness QA when --breakdown is given",+ "compare": "compare the drawn layer of a remake and the original frame by frame (position, shape overlap, amount), list the worst moments and tile them","compare.ref": "original video","compare.remake": "remade video",- "compare.breakdown": "breakdown.json: score generative remakes per shot on camera move, pose dynamics, layout and freeze frames","compare.every": "sampling interval in seconds (default 0.5)","compare.scenes": "frames/scenes.json: summarize scores per scene","compare.worst": "worst moments to show in the comparison image (default 8)",diff --git a/rea_video/features.py b/rea_video/features.pyindex dc9bfb8..ed100fd 100644--- a/rea_video/features.py+++ b/rea_video/features.py@@ -597,6 +597,11 @@ def kinematics_summary(frames: list[np.ndarray], frame_times: list[float], ms: dtraj = "push_in" if z_eff > 0 else "pull_out"else:traj = "static"+ # The rigid fit already found a still camera: what moved is the subject, which fills enough of the frame to pull the+ # quadrant flow. Only a large, clear push or pull overrides that.+ if cam_kind in ("static", "static_with_subject_motion") and kb <= 0.5 \+ and not (traj in ("push_in", "pull_out") and abs(net_zoom_pct) >= 8.0):+ traj = "static"# Subject-depth-adaptive central contour comparison: under 3D parallax, the central subject scales at its own depth# Z_subject (often faster than distant background). A held pose matches across start->end under some 2D scale + smalldiff --git a/rea_video/generation.py b/rea_video/generation.pyindex f756219..24898c7 100644--- a/rea_video/generation.py+++ b/rea_video/generation.py@@ -48,21 +48,21 @@ REDRAWN_DIR = Path("remake") / "redrawn"PROMPTS_FILE = Path("remake") / "prompts.json"STRATEGY_ZH = {- "edit": ("原视频动作锁定编辑(锁死切镜/运镜/姿态,仅做增量改观)", "motion-preserving video edit (locks cuts, camera & poses; delta look edit only)"),- "remix": ("多模态参考生视频(参考视频 + 参考图/音频)", "multimodal reference-to-video (reference video + images/audio)"),- "keyframes": ("多图关键帧参考生视频(一次多镜头)", "multi-shot keyframe reference-to-video"),- "frames": ("图生视频(首帧 / 首尾帧逐镜)", "image-to-video (first / last frame per shot)"),- "text": ("文生视频(纯文本提示词)", "text-to-video (prompt only)"),+ "edit": ("原片改画(动作和运镜照原片)", "edit the source (action and camera kept)"),+ "remix": ("参考原片生成", "generate from the source as reference video"),+ "keyframes": ("关键帧参考,一次出多个镜头", "multi-shot from key frames"),+ "frames": ("首帧 / 首尾帧逐镜生成", "first / last frame, shot by shot"),+ "text": ("文生视频", "text to video"),}VALID_MODES = ("match", "ai", "shoot")VALID_STRATEGIES = ("edit", "remix", "keyframes", "frames", "text")VALID_VIDEO_REFS = ("auto", "none", "source", "depth", "edge")VALID_IMAGE_REFS = ("auto", "none", "source", "depth", "edge")VIDEO_REF_ZH = {- "none": ("不传原视频(纯关键帧 / 提示词驱动)", "no reference video (keyframes / prompt only)"),- "source": ("原视频直接参考(RGB 擦除字幕)", "raw source video reference (subtitles erased)"),- "depth": ("深度视频参考(锁 3D 空间纵深与运镜、剥离原片外观)", "depth video reference (locks 3D depth & camera, strips source look)"),- "edge": ("边缘结构视频参考(锁轮廓构图与节奏、重绘材质光影)", "structural edge video reference (locks silhouettes & pacing, redraws look)"),+ "none": ("不传原片", "no source video"),+ "source": ("原片(擦掉字幕)", "source video (subtitles erased)"),+ "depth": ("原片的深度视频", "depth video of the source"),+ "edge": ("原片的轮廓线视频", "edge video of the source"),}@@ -173,13 +173,13 @@ def spec_of(model: dict | None, intent: dict | None = None) -> dict:return {"max": float(d.get("max") or 10), "min": float(d.get("min") or 0),"steps": [float(x) for x in d.get("steps") or []], "steps_with_refs": [float(x) for x in lim.get("duration_with_refs_s") or []],"multi_shot": "video.multi_shot" in prim, "shots": int(lim.get("shots_per_generation") or 0) or None,- "ref_video": "video.reference_video" in prim or bool(max_rv_ov), "ref_videos": int(refs.get("video") or 1),+ "ref_video": "video.reference_video" in prim, "ref_videos": int(refs.get("video") or 1),"control_video": "video.control_video" in prim,"edit_v2v": "video.edit_v2v" in prim,"pinned_keyframes": "video.keyframes" in prim,"ref_total": max_rv_ov if max_rv_ov else (float(rv) if rv else REF_CLIP_S * max(1, int(refs.get("video") or 1))),- "multi_ref": multi_ref or bool(max_img_ov), "images": max_img_ov if max_img_ov is not None else base_images,- "images_stated": bool(refs.get("image") or max_img_ov),+ "multi_ref": multi_ref, "images": (max_img_ov if max_img_ov is not None and multi_ref else base_images),+ "images_stated": bool(refs.get("image") or (max_img_ov and multi_ref)),"prefer": plan.get("strategy"), "plan_images": None if max_img_ov is not None else plan.get("images"),"no_real_faces": bool(plan.get("no_real_faces")),"no_audio_with_ref_video": bool(plan.get("no_audio_with_ref_video")),@@ -241,12 +241,13 @@ def is_discontinuous_montage(b: dict | None, gen_shot_ids: list[int], new_scene:def choose_strategy(spec: dict, n_own: int, override: str | None = None, video_ref: str | None = None,discontinuous: bool = False) -> str:vref = (video_ref or "").strip().lower()- if override == "edit" and vref not in ("none", "depth", "edge") and (spec.get("edit_v2v") or spec.get("ref_video")):+ if override == "edit" and vref not in ("none", "depth", "edge") and spec.get("edit_v2v"):return "edit"- if vref in ("depth", "edge") and (spec.get("control_video") or spec.get("ref_video")):+ can_remix = spec["ref_video"] and spec["ref_total"] >= REMIX_MIN_REF_S+ if vref in ("depth", "edge") and spec.get("control_video"):return "remix"if vref == "source":- if spec.get("ref_video"):+ if can_remix:return "remix"if spec.get("edit_v2v"):return "edit"@@ -254,7 +255,7 @@ def choose_strategy(spec: dict, n_own: int, override: str | None = None, video_rreturn "text"if override == "frames" and spec["first"]:return "frames"- if vref != "none" and override == "remix" and spec["ref_video"] and spec["ref_total"] >= REMIX_MIN_REF_S:+ if vref != "none" and override == "remix" and can_remix:return "remix"if override == "keyframes" and spec["multi_shot"] and (spec["multi_ref"] or spec.get("pinned_keyframes")) and planned_images(spec) >= n_own + 1:return "keyframes"@@ -263,11 +264,8 @@ def choose_strategy(spec: dict, n_own: int, override: str | None = None, video_rreturn "text"if pref == "frames" and spec["first"]:return "frames"- if vref != "none" and spec["ref_video"] and (spec["multi_shot"] or pref == "remix") and pref in (None, "remix") and spec["ref_total"] >= REMIX_MIN_REF_S:+ if vref != "none" and can_remix and (spec["multi_shot"] or pref == "remix") and pref in (None, "remix"):return "remix"- # S01: disjoint multi-character montages without timestamp-pinned `video.keyframes` route to per-shot `frames` I2V- if discontinuous and not spec.get("pinned_keyframes") and spec["first"]:- return "frames"if spec["multi_shot"] and (spec["multi_ref"] or spec.get("pinned_keyframes")) and (pref in (None, "keyframes") or vref == "none") and planned_images(spec) >= n_own + 2:return "keyframes"if spec["multi_shot"] and not spec["multi_ref"] and n_own == 0:@@ -909,17 +907,22 @@ def plan_generation(b: dict, model: dict | None, intent: dict, new_scene: set[ingen_shot_ids = [r["index"] for r in b["shots"] if r["base"]["label"] in labels and r["index"] not in skip]discont = is_discontinuous_montage(b, gen_shot_ids, new_scene, own)strategy = choose_strategy(spec, len(own), intent.get("strategy"), video_ref=req_vref, discontinuous=discont)- eff_vref = "source" if strategy == "edit" else ((req_vref if req_vref in ("source", "depth", "edge") else "source") if strategy == "remix" else "none")- # Respect the model's real per-call duration limit: only apply a hardcut cap when the model entry explicitly sets max_hardcut_s- cap_hardcut = spec.get("max_hardcut_s")+ eff_vref = "none"+ if strategy == "edit":+ eff_vref = "source"+ elif strategy == "remix":+ eff_vref = req_vref if req_vref in ("depth", "edge") and spec.get("control_video") else "source"+ cap_hardcut = spec.get("max_hardcut_s") or hardcut_max_sif strategy in ("remix", "edit"):max_s, max_shots = min(spec["max"], spec["ref_total"]), (spec["shots"] if (spec["multi_shot"] or strategy == "edit") else 1)elif strategy == "keyframes":+ # a swapped-in subject with no image is held only by its description: every extra call is another chance for it+ # to come out different, so keep calls whole and let some shots go without a source frame; otherwise apply S06text_only = any(not s.get("image") for s in intent.get("swaps") or [])- max_s = spec["max"] if (text_only or not cap_hardcut) else min(spec["max"], cap_hardcut)+ max_s = spec["max"] if text_only else min(spec["max"], cap_hardcut)max_shots = spec["shots"] if text_only else min(x for x in (spec["shots"], planned_images(spec) - len(own)) if x)elif strategy == "text" and spec["multi_shot"]:- max_s, max_shots = (min(spec["max"], cap_hardcut) if cap_hardcut else spec["max"]), spec["shots"]+ max_s, max_shots = min(spec["max"], cap_hardcut), spec["shots"]else:max_s, max_shots = spec["max"], 1units: list[dict] = []@@ -1089,13 +1092,13 @@ def checks(plan: dict, intent: dict, prompts: dict[str, str], notes: dict | Noneif plan.get("strategy") == "frames" elseT("当前模型不接收参考图:提示词里只保留文字描述,需要严格锁外观时请换支持参考图或首帧的模型","this model takes no reference images: only the text description is used; pick a model with reference images or first-frame input to lock appearance"))+ want_vref = str(intent.get("video_ref") or "")+ if want_vref in ("depth", "edge") and plan.get("video_ref") != want_vref:+ add("warn", T("要求用{v}视频当参考,但这个模型不吃控制视频(video.control_video),这次没用;要用就换声明了 video.control_video 的模型",+ "a {v} control video was asked for, but this model takes no control video (video.control_video), so it was not used; pick a model that declares video.control_video",+ v=T("深度", "depth") if want_vref == "depth" else T("轮廓线", "edge")))for u in units:n_img, n_vid = len(unit_images(u)), len({r["tag"] for r in u["refs"] if r["tag"].startswith("@视频")})- if u.get("video_ref") in ("depth", "edge") and not spec.get("control_video"):- m_name = u.get("model_name") or u.get("model") or "?"- add("error", T("{u} 选了 {v} 控制视频,但 {m} 仅声明语义参考视频(video.reference_video),不支持像素级空间控制(video.control_video),会导致姿态朝向丢失、跨镜串色或灰阶污染:请改用 --strategy edit(原片动作锁定编辑)、--strategy frames(逐镜首尾帧锁构图),或换支持 video.control_video 的模型(如 wan-vace)",- "{u} uses a {v} control video, but {m} only declares semantic reference video (video.reference_video), not pixel-aligned spatial control (video.control_video), causing pose drift, cross-shot bleed or grayscale wash: switch to --strategy edit, --strategy frames, or a video.control_video model (e.g. wan-vace)",- u=u["id"], v=u.get("video_ref"), m=m_name), u["id"])if u.get("strategy") == "keyframes" and len(u.get("shots") or []) > 1 and not spec.get("pinned_keyframes") and plan.get("discontinuous_montage"):m_name = u.get("model_name") or u.get("model") or "?"add("warn", T("{u} 把多个无共享角色、跨场景的独立镜头合进了 {m} 的无时间戳多图池(video.multi_reference),容易跨镜头串角色或丢失首帧朝向:建议改用 --strategy frames 逐镜锁首尾帧,或改用 --strategy edit 锁原片动作",@@ -1297,15 +1300,13 @@ def image_tasks_md(tasks: list[dict], strategy: str) -> list[str]:"""Markdown block for the upstream still-image layer (Text-to-Image vs Image-to-Image + reverse-engineered prompts + refs)."""if not tasks:return []- note = (T("当前视频模态为首帧/首尾帧图生视频:先按下表逐张生成画面帧,再喂入视频模型跑纯动态。",- "Video modality is first/last-frame I2V: generate the still frames below first, then feed them into the video model with motion-only prompts.")+ note = (T("先按下表做好每个镜头的画面,再拿去图生视频。", "Make each shot's frame below first, then run image-to-video from it.")if strategy == "frames" else- T("如果不直接喂原片画面、而是要做全新角色/换主体或改走逐镜图生视频,按下表准备每镜首帧图(已区分文生图与图生图,并给出反推生图提示词与参考图):",- "When generating fresh visuals, swapping subjects, or running shot-by-shot I2V instead of feeding raw source frames, prepare each shot's frame as below (T2I vs I2I, reverse-engineered image prompts and reference files):"))- L = ["", "<details><summary>" + T("前置图片准备与反推提示词(文生图 / 图生图,共 {n} 张)",- "Upstream image preparation and reverse-engineered prompts (T2I / I2I, {n} images)", n=len(tasks)) + "</summary>", "",+ T("要换人、换物或改成逐镜图生视频时,按下表准备每个镜头的首帧图:",+ "When swapping people or products, or switching to shot-by-shot image-to-video, prepare each shot's first frame as below:"))+ L = ["", "<details><summary>" + T("先做的图({n} 张)", "Frames to make first ({n})", n=len(tasks)) + "</summary>", "",note, "",- T("| 镜头 | 用途 | 生图方式 | 参考图输入 | 产出保存路径 |", "| Shot | Role | Image modality | Reference inputs | Save as |"),+ T("| 镜头 | 用途 | 怎么做 | 参考图 | 存成 |", "| Shot | Role | How | Reference images | Save as |"),"|---|---|---|---|---|"]for t in tasks:refs_s = semi().join(t.get("refs") or []) or "—"@@ -1329,37 +1330,33 @@ def report_md(plan: dict, prompts: dict[str, str]) -> list[str]:st = plan.get("strategy")vref = plan.get("video_ref") or rules.get("video_ref") or ("source" if st in ("remix", "edit") else "none")remix_how = {- "depth": T("把原片转为灰度深度控制视频(`depth.mp4`)传入,模型照它的三维空间纵深、运镜轨迹与切镜节奏生成,外观材质与色彩完全按参考图与提示词重绘(需模型支持 `video.control_video`;可用 `--video-ref none|source|edge` 切换)",- "feeds a grayscale depth control video (`depth.mp4`) so the model follows 3D spatial depth, camera and cut timing while redrawing full look and colour (requires `video.control_video`; switch with `--video-ref none|source|edge`)"),- "edge": T("把原片转为结构软边缘控制视频(`edge.mp4`)传入,模型照它的轮廓构图、运镜与节奏生成,外观材质与光影完全重绘(需模型支持 `video.control_video`;可用 `--video-ref none|source|depth` 切换)",- "feeds a structural edge control video (`edge.mp4`) so the model follows silhouette layout, camera and pacing while redrawing full look and lighting (requires `video.control_video`; switch with `--video-ref none|source|depth`)"),- "source": T("这段原片擦掉字幕后直接当参考视频,模型照它的分镜、运镜和节奏一次出完这段的镜头(可用 `--strategy edit` 切为极简增量动作锁定编辑,或 `--video-ref none` 不传原视频)",- "the source stretch, subtitles erased, is the reference video; the model follows its shots, camera and pacing in one go (pass `--strategy edit` for motion-locked delta editing, or `--video-ref none` for no reference video)"),+ "depth": T("原片转成深度视频当参考,模型照它的空间、运镜和切镜节奏出画面,外观和颜色按参考图和提示词重画",+ "a depth video of the source is the reference: the model follows its space, camera and cut timing, and redraws look and colour from the images and prompt"),+ "edge": T("原片转成轮廓线视频当参考,模型照它的构图、运镜和节奏出画面,外观和光影按参考图和提示词重画",+ "an edge video of the source is the reference: the model follows its framing, camera and pacing, and redraws look and lighting from the images and prompt"),+ "source": T("这段原片擦掉字幕后当参考视频,模型照它的分镜、运镜和节奏一次出完这段的镜头",+ "the source stretch, subtitles erased, is the reference video; the model follows its shots, camera and pacing in one go"),}.get(vref)- how = {"edit": T("把擦掉字幕的原片作为基准视频,配极简增量编辑提示词(仅声明要改的外观/属性,显式锁死原片切镜、运镜、主体朝向与动作姿态,避免模型推翻原动作重演)",- "feeds the subtitle-erased source clip with a delta-only edit prompt (states only visual attribute/subject changes while locking cuts, camera trajectory, orientation and poses)"),+ how = {"edit": T("擦掉字幕的原片当底片,提示词只写要改的地方,切镜、运镜和动作都照原片",+ "the subtitle-erased source is the base video; the prompt states only what changes, cuts, camera and action stay as in the source"),"remix": remix_how,- "keyframes": (T("这个模型也能吃参考视频,这里按不传原视频的多图关键帧排法(可用 `--strategy edit` 或 `--video-ref source` 切为原视频参考):",- "the model also takes reference video; using multi-shot keyframes without reference video here (pass `--strategy edit` or `--video-ref source` for video reference): ")+ "keyframes": (T("这个模型也能吃参考视频,这里用多张关键帧图:", "the model also takes reference video, but key frames are used here: ")if spec.get("ref_video") else T("这个模型不吃参考视频,", "the model takes no reference video: "))- + T("每个镜头给一张关键帧图定构图/外观,换进去的东西各给参考图",- "one keyframe image per shot fixes composition/look, swapped-in things get their own images"),- "frames": T("一次出一个镜头,先用文生图/图生图做好首帧(及尾帧),再配纯动态提示词图生视频",- "one shot per call: prepare the first (and last) frame via T2I/I2I, then run image-to-video with a motion-only prompt"),- "text": T("纯文字提示词直接文生视频", "text-to-video from prompt only")}[st]- notes_md = [T("- 视频生成模态:{m}(参考形式:{v})", "- Video modality: {m} (video reference: {v})", m=strategy_name(st), v=video_ref_name(vref)),- T("- 可选参考形式切换:`--video-ref none`(不传原视频)/ `source`(原视频直接参考)/ `depth`(深度视频参考)/ `edge`(边缘结构视频参考);前置生图可用 `--image-ref none|source|depth|edge` 控制",- "- Switch reference regime: `--video-ref none` (no source video) / `source` (raw source video) / `depth` (depth video) / `edge` (edge video); control still generation with `--image-ref none|source|depth|edge`"),- T("- 分组:按模型真实单次上限(≤{s:.0f} 秒", "- Grouping: packed up to the model's real per-call limit (≤{s:.0f}s", s=rules.get("max_s") or 0)+ + T("每个镜头给一张关键帧图定构图和外观,换进去的东西各给参考图",+ "one key frame per shot fixes composition and look, swapped-in things get their own images"),+ "frames": T("一次出一个镜头:先做好首帧(和尾帧),提示词只写动作和运镜",+ "one shot per call: make the first (and last) frame first, then a prompt with only motion and camera"),+ "text": T("只有文字提示词", "prompt only")}[st]+ notes_md = [T("- 分组:连着的镜头尽量放进同一次生成,单次 ≤{s:.0f} 秒", "- Grouping: consecutive shots share a call where they fit, ≤{s:.0f}s per call", s=rules.get("max_s") or 0)+ (T("、≤{n} 个镜头", ", ≤{n} shots", n=rules["max_shots"]) if rules.get("max_shots") else "")- + T(")合并,能一次生成的绝不拆碎;超长时优先在叙事段落或换景处切开", "), keeping stretches in one call whenever they fit; longer stretches cut at story seams or scene changes"),+ + T(";段太长时优先在换场景处切开", "; a long stretch is cut at a scene change first"),T("- 输入:{h}", "- Inputs: {h}", h=how)]if plan.get("audio_note"):notes_md.append(T("- 声音:{a}", "- Audio: {a}", a=plan["audio_note"]))if plan.get("overlay_note"):notes_md.append(T("- 包装层:{a}", "- Packaging: {a}", a=plan["overlay_note"]))- L = [T("- **视频生成方式**:{m}", "- **Video modality**: {m}", m=strategy_name(st)), "",- T("| 段 | 镜头 | 时间 | 时长 | 视频模型输入 |", "| Part | Shots | Time | Length | Video model inputs |"), "|---|---|---|---|---|"]+ L = [T("- **生成方式**:{m}", "- **How it is generated**: {m}", m=strategy_name(st)), "",+ T("| 段 | 镜头 | 时间 | 时长 | 要准备 |", "| Part | Shots | Time | Length | Prepare |"), "|---|---|---|---|---|"]for u in units:when = join(f"{a:.1f}–{z:.1f}s" for a, z in u["ranges"])call = u.get("call_s") or u["generate_s"]@@ -1367,7 +1364,7 @@ def report_md(plan: dict, prompts: dict[str, str]) -> list[str]:if call - u["generate_s"] >= 0.5 else f"{u['duration']:.1f}s")L.append(f"| {u['id']} | {shot_ids(u['shots'])} | {when} | {length}"f"{T('({c} 次)', ' ({c} calls)', c=u['calls']) if u['calls'] > 1 else ''} | {_fed(u) or T('纯文本提示词', 'text prompt')} |")- L += ["", '<details class="ref"><summary>' + T("模态选择与分段依据", "Modality choice and grouping basis") + "</summary>", ""] + notes_md + ["", "</details>"]+ L += ["", '<details class="ref"><summary>' + T("这样分段的原因", "Why it is split this way") + "</summary>", ""] + notes_md + ["", "</details>"]L += image_tasks_md(plan.get("image_tasks") or [], st)for u in units:L += ["", "<details><summary>" + T("{id} · 镜头 {sh} · {d:.1f}s", "{id} · shots {sh} · {d:.1f}s",diff --git a/rea_video/integrations/run_remake.py b/rea_video/integrations/run_remake.pyindex 4b21c4b..716d403 100644--- a/rea_video/integrations/run_remake.py+++ b/rea_video/integrations/run_remake.py@@ -93,159 +93,6 @@ def _adapt_unit_params(eng_tool, raw_params: dict, model_options: dict | None, jreturn p-def _frame_struct_vec(bgr) -> "np.ndarray":- import cv2- import numpy as np-- gray = cv2.cvtColor(bgr, cv2.COLOR_BGR2GRAY).astype(np.float32)- small = cv2.resize(cv2.GaussianBlur(gray, (0, 0), 2.0), (24, 42), interpolation=cv2.INTER_AREA)- gx = np.abs(cv2.Sobel(small, cv2.CV_32F, 1, 0, ksize=3)).ravel()- gy = np.abs(cv2.Sobel(small, cv2.CV_32F, 0, 1, ksize=3)).ravel()- hog = np.concatenate([gx, gy])- hog = hog / (float(np.linalg.norm(hog)) + 1e-5)- luma = small.ravel() - float(small.mean())- luma = luma / (float(np.linalg.norm(luma)) + 1e-5)- v = np.concatenate([0.70 * hog, 0.70 * luma])- n = float(np.linalg.norm(v))- return v / n if n > 1e-5 else np.zeros_like(v)---def _split_multishot_unit(video_file: Path, shot_ids: list[int], trim_to: float, out_dir: Path,- ref_shots: list[dict] | None = None, bdir: Path | None = None) -> dict[str, str]:- """Split a single-call multi-shot unit clip at its actual pixel hard cuts and align sub-clips to target shots.-- Multi-shot generators occasionally shift cut timing or insert an extra internal sub-cut inside one shot. Rather than- blindly taking top-(N-1) histogram jumps (which cascades an off-by-one shift across later shots when K > N), this- detects all true hard cuts (K >= N sub-clips) and runs monotonic DP alignment on normalized time + appearance-invariant- structural similarity so every target shot gets one clean, jump-free sub-clip.- """- import subprocess- import cv2- import numpy as np-- n_target = len(shot_ids)- if n_target < 2 or not video_file.is_file():- return {}- cap = cv2.VideoCapture(str(video_file))- fps = float(cap.get(cv2.CAP_PROP_FPS) or 0.0)- total_frames = int(cap.get(cv2.CAP_PROP_FRAME_COUNT) or 0)- if fps <= 0 or total_frames < n_target * 4:- cap.release()- return {}- end_frame = min(total_frames, max(n_target * 4, int(round(trim_to * fps)))) if trim_to > 0 else total_frames- small_frames: list = []- hists: list = []- while len(small_frames) < end_frame:- ok, fr = cap.read()- if not ok:- break- sm = cv2.resize(fr, (108, 192))- small_frames.append(sm)- hsv = cv2.cvtColor(sm, cv2.COLOR_BGR2HSV)- h = cv2.calcHist([hsv], [0, 1, 2], None, [12, 4, 4], [0, 180, 0, 256, 0, 256])- cv2.normalize(h, h)- hists.append(h)- cap.release()- end_frame = len(small_frames)- if end_frame < n_target * 4:- return {}-- # Combined cut strength: HSV Bhattacharyya jump + normalized pixel MAD spike above local neighbourhood- mads = np.array([float(np.mean(np.abs(small_frames[i].astype(np.int16) - small_frames[i - 1].astype(np.int16))))- for i in range(1, end_frame)], dtype=np.float32)- bhat = np.array([float(cv2.compareHist(hists[i - 1], hists[i], cv2.HISTCMP_BHATTACHARYYA))- for i in range(1, end_frame)], dtype=np.float32)- # Local contrast ratio on pixel MAD catches hard cuts even between two similarly coloured dark scenes- med_k = np.array([float(np.median(mads[max(0, i - 5):min(len(mads), i + 6)])) for i in range(len(mads))], dtype=np.float32)- spike_ratio = mads / (med_k + 2.5)- scores: list[tuple[int, float]] = []- for i in range(3, end_frame - 3):- sc = float(0.55 * bhat[i - 1] + 0.45 * min(1.0, mads[i - 1] / 60.0))- is_real_cut = (mads[i - 1] >= 28.0 and spike_ratio[i - 1] >= 2.6 and bhat[i - 1] >= 0.16) or bhat[i - 1] >= 0.36- scores.append((i, sc, is_real_cut))-- min_gap = max(6, int(round(0.35 * fps)))- # First collect all genuine hard cuts (up to n_target + 3 to absorb occasional extra sub-cuts)- strong_cuts: list[int] = []- for f_idx, sc, is_real in sorted(scores, key=lambda x: -x[1]):- if not is_real and len(strong_cuts) >= n_target - 1:- break- if sc < 0.22:- break- if all(abs(f_idx - p) >= min_gap for p in strong_cuts):- strong_cuts.append(f_idx)- if len(strong_cuts) >= n_target + 3:- break- if len(strong_cuts) < n_target - 1:- return {}-- cand_bounds = [0] + sorted(strong_cuts) + [end_frame]- subclips = [(a, b) for a, b in zip(cand_bounds[:-1], cand_bounds[1:]) if b - a >= 2]- k_sub = len(subclips)- if k_sub < n_target:- return {}-- if k_sub == n_target:- chosen = subclips- else:- # Monotonic DP: match each of the N target shots to its best clean sub-clip (by structural frame match + normalized time)- gen_vecs = [_frame_struct_vec(small_frames[(a + b) // 2]) for a, b in subclips]- gen_mids = [0.5 * (a + b) / float(end_frame) for a, b in subclips]- ref_vecs: list = [None] * n_target- ref_mids = [(i + 0.5) / float(n_target) for i in range(n_target)]- ref_durs = [1.0 / float(n_target)] * n_target- if ref_shots and len(ref_shots) == n_target:- u_t0 = float(ref_shots[0]["start"])- u_span = max(0.1, float(ref_shots[-1]["end"]) - u_t0)- ref_mids = [(0.5 * (float(s["start"]) + float(s["end"])) - u_t0) / u_span for s in ref_shots]- ref_durs = [max(0.02, (float(s["end"]) - float(s["start"])) / u_span) for s in ref_shots]- if bdir is not None:- for idx_i, s in enumerate(ref_shots):- ff = (s.get("assets") or {}).get("first_frame")- p_ff = (Path(bdir) / ff) if ff else None- if p_ff and p_ff.is_file():- im = cv2.imread(str(p_ff))- if im is not None:- ref_vecs[idx_i] = _frame_struct_vec(im)-- gen_durs = [max(0.02, (b - a) / float(end_frame)) for a, b in subclips]- dp = np.full((n_target, k_sub), -1e9, dtype=np.float64)- parent = np.full((n_target, k_sub), -1, dtype=np.int32)- for j in range(k_sub):- for i in range(n_target):- if j < i or (k_sub - 1 - j) < (n_target - 1 - i):- continue- sim = float(np.dot(ref_vecs[i], gen_vecs[j])) if ref_vecs[i] is not None else 0.5- t_pen = 0.65 * abs(gen_mids[j] - ref_mids[i])- dur_ratio = min(gen_durs[j], ref_durs[i]) / max(gen_durs[j], ref_durs[i])- node_sc = sim - t_pen + 0.35 * dur_ratio- if i == 0:- dp[i, j] = node_sc- else:- best_prev = int(np.argmax(dp[i - 1, :j]))- dp[i, j] = dp[i - 1, best_prev] + node_sc- parent[i, j] = best_prev- cur_j = int(np.argmax(dp[n_target - 1]))- pick_idx = []- for i in range(n_target - 1, -1, -1):- pick_idx.append(cur_j)- cur_j = int(parent[i, cur_j])- chosen = [subclips[j] for j in reversed(pick_idx)]-- out_dir.mkdir(parents=True, exist_ok=True)- clips: dict[str, str] = {}- for s_id, (a, b) in zip(shot_ids, chosen):- dst = out_dir / f"shot_{int(s_id):03d}.mp4"- subprocess.run(- ["ffmpeg", "-v", "error", "-y", "-i", str(video_file),- "-vf", f"trim=start_frame={a}:end_frame={b},setpts=PTS-STARTPTS",- "-an", "-c:v", "libx264", "-pix_fmt", "yuv420p", "-crf", "18", str(dst)],- check=True,- )- clips[str(s_id)] = str(dst)- return clips--def _video_path(res) -> str | None:"""Find the generated file in the various result shapes capsule-cinema tools return."""if isinstance(res, str):@@ -347,21 +194,6 @@ def main() -> None:results["results"][key] = {"id": j["id"], "video": video, "raw": res if not video else None,"seconds": round(time.time() - t0, 1), "trim_to": j["trim_to"],**({k: j[k] for k in ("unit", "part", "parts", "shots")} if j.get("unit") else {})}- if video and j.get("unit") and int(j.get("parts") or 1) == 1 and len(j.get("shots") or []) > 1:- try:- b_json = Path(spec["breakdown"]) if spec.get("breakdown") else None- b_data = json.loads(b_json.read_text(encoding="utf-8")) if b_json and b_json.is_file() else {}- by_idx = {int(s["index"]): s for s in (b_data.get("shots") or [])}- r_shots = [by_idx[int(i)] for i in j["shots"] if int(i) in by_idx]- per_shot = _split_multishot_unit(- Path(video), list(j["shots"]), float(j["trim_to"]), Path(video).parent / "shots",- ref_shots=r_shots if len(r_shots) == len(j["shots"]) else None,- bdir=b_json.parent if b_json else None,- )- for s_key, s_vid in per_shot.items():- results["results"][s_key] = {"id": f"shot_{int(s_key):03d}", "video": s_vid, "from_unit": j["unit"]}- except Exception:- passresults_path.write_text(json.dumps(results, ensure_ascii=False, indent=2, default=str), encoding="utf-8")print(f" -> {video or res}", flush=True)if not video:diff --git a/rea_video/pipeline.py b/rea_video/pipeline.pyindex 56bc6bb..48fd2eb 100644--- a/rea_video/pipeline.py+++ b/rea_video/pipeline.py@@ -65,7 +65,7 @@ def vlm_units(records: list[dict], max_calls: int) -> list[list[dict]]:# modules that only run in finalize(): a change there needs no new decode. Everything else measures the video._FINALIZE_ONLY = {"classify.py", "report.py", "plan.py", "production.py", "generation.py", "playbook.py","entities.py", "narrative.py", "review.py", "cli.py", "cli_en.py", "evaluate.py",- "remake.py", "remake_qa.py", "drive.py", "code_remake.py", "clean_paths.py", "videomd.py", "pdf.py",+ "remake.py", "drive.py", "code_remake.py", "clean_paths.py", "videomd.py", "pdf.py","memory.py", "i18n.py", "visual.py", "readings.py", "__init__.py"}_DECODE_FP: str | None = Nonediff --git a/rea_video/remake.py b/rea_video/remake.pyindex f220bff..293642c 100644--- a/rea_video/remake.py+++ b/rea_video/remake.py@@ -323,10 +323,10 @@ def unit_shots(b: dict, results: dict, udir: Path, size: tuple[int, int], fps: fshots_list = [i for i in (got[0].get("shots") or []) if i in by_index and i in bounds]# Single-call multi-shot unit: slice at actual pixel hard cuts first so cuts never drift into neighbouring shotsif len(got) == 1 and len(shots_list) > 1:- from .integrations.run_remake import _split_multishot_unit+ from .unit_split import split_unitr_shots = [by_index[i] for i in shots_list]- split_map = _split_multishot_unit(Path(got[0]["video"]), shots_list, float(got[0].get("trim_to") or 0),+ split_map = split_unit(Path(got[0]["video"]), shots_list, float(got[0].get("trim_to") or 0),udir / f"{uid}_cuts", ref_shots=r_shots, bdir=bdir)if len(split_map) == len(shots_list):for s_key, s_vid in split_map.items():@@ -457,18 +457,8 @@ def assemble(breakdown_path: Path, results_path: Path, out_dir: Path | None = Noexcept subprocess.CalledProcessError:if not with_text:raise- qa_summary: dict | None = None- if any(how == "generated" for _, how in legend):- try:- from .remake_qa import evaluate_remake-- qa_res = evaluate_remake({**b, "source": {**b["source"], "path": str(src)}}, final, out_dir=out_dir, legend=legend, replaced_only=True)- if qa_res.get("evaluated_shots"):- qa_summary = {k: qa_res.get(k) for k in ("evaluated_shots", "score", "camera_score", "motion_score", "layout_score", "smoothness", "issues")}- except Exception as exc: # noqa: BLE001 QA diagnostics must never abort assembly- LOG.warning("remake QA evaluation failed: %s", str(exc)[:120])log = {"legend": legend, "remake": str(final), "compare": str(compare), **({"timing": timing} if timing else {}),- **({"overlays": overlay_log} if overlays else {}), **({"qa": qa_summary} if qa_summary else {})}+ **({"overlays": overlay_log} if overlays else {})}(out_dir / "assemble_log.json").write_text(json.dumps(log, ensure_ascii=False, indent=2), encoding="utf-8")LOG.info("remake -> %s ; compare -> %s", final, compare)return json.dumps(log, ensure_ascii=False)@@ -627,15 +617,8 @@ def remake(out: Path, code: bool = False, overlays: bool = True) -> dict:T("| 镜头 | 时间 | 画面类型 | 现在 |", "| Shot | Time | Picture | Now |"), "|---|---|---|---|"]for r in rows:L.append(f"| #{r['shot']} | {r['start']:.1f}–{r['end']:.1f}s | {LABEL_ZH.get(r['label'], r['label'])} | {HOW[r['now']]} |")- qa_file = rdir / "qa.json"- if log.get("qa") and qa_file.is_file():- from .remake_qa import qa_markdown-- L += qa_markdown(read_json(qa_file))(rdir / "status.md").write_text("\n".join(L) + "\n", encoding="utf-8")- write_json(rdir / "status.json", {"replaced_share": round(done / total, 3), "shots": rows,- **({"qa": log["qa"]} if log.get("qa") else {})})+ write_json(rdir / "status.json", {"replaced_share": round(done / total, 3), "shots": rows})res.update({"remake": log["remake"], "compare": log["compare"], "status": str(rdir / "status.md"),- "replaced_share": round(done / total, 3), "to_do": todo,- **({"qa": log["qa"]} if log.get("qa") else {})})+ "replaced_share": round(done / total, 3), "to_do": todo})return resdiff --git a/rea_video/remake_qa.py b/rea_video/remake_qa.pydeleted file mode 100644index 8871210..0000000--- a/rea_video/remake_qa.py+++ /dev/null@@ -1,241 +0,0 @@-"""Generative remake fidelity QA: per-shot camera trajectory, subject pose dynamics, framing layout and smoothness.--`layers.compare()` scores flat code-rendered graphics by foreground colour masks. For generated / filmed / 3D shots-where characters, colours or outfits intentionally change (`swaps`), pixel colour diff is meaningless while motion and-framing drift are critical. This module measures four appearance-invariant axes per replaced shot:- 1. smoothness — absence of frozen duplicate frames (`step=0` warp stutter) when the source shot is moving- 2. camera_score — agreement of 3D-parallax-aware `camera_traj` (catches inverted push-in vs pull-out or lost pans)- 3. motion_score — agreement of global-motion-compensated `pose_change` & flow energy (catches hallucinated turns on- anchored shots or frozen stills on active action shots)- 4. layout_score — coarse gradient-envelope cosine similarity on start/end frames (invariant to colour/identity swaps,- sensitive to framing collapse such as wide profile -> centred close-up)-"""-from __future__ import annotations--from pathlib import Path--import cv2-import numpy as np--from .features import global_motion, kinematics_summary, motion_summary-from .i18n import T-from .media import iter_frames, video_info-from .util import write_json--QA_W = 160--_OPPOSITE_TRAJ = {- frozenset(("push_in", "pull_out")),- frozenset(("pan_left", "pan_right")),- frozenset(("tilt_up", "tilt_down")),-}---def _decode_by_shots(video_path: str | Path, shots: list[dict], width: int = QA_W) -> tuple[dict[int, list[np.ndarray]], dict[int, list[float]], float]:- info = video_info(str(video_path))- fps = float(info.fps) if info.fps and 0 < info.fps <= 60 else 30.0- ordered = sorted(shots, key=lambda s: float(s["start"]))- frames_by_shot: dict[int, list[np.ndarray]] = {int(s["index"]): [] for s in ordered}- times_by_shot: dict[int, list[float]] = {int(s["index"]): [] for s in ordered}- if not ordered:- return frames_by_shot, times_by_shot, fps- margin = 0.6 / fps # stay strictly inside shot boundaries so VFR / codec rounding never samples adjacent shots- k = 0- for fi, bgr in enumerate(iter_frames(str(video_path), info, width, fps=fps)):- t = fi / fps- while k < len(ordered) and t >= float(ordered[k]["end"]) - margin:- k += 1- if k >= len(ordered):- break- sh = ordered[k]- if t >= float(sh["start"]) + margin:- idx = int(sh["index"])- frames_by_shot[idx].append(bgr.copy())- times_by_shot[idx].append(t)- return frames_by_shot, times_by_shot, fps---def _shot_kinematics(frames: list[np.ndarray], times: list[float], fps: float) -> dict:- if len(frames) < 2:- return {"frozen_ratio": 0.0, "flow_p90": 0.0, "camera_traj": "static", "net_zoom_pct": 0.0,- "pose_change": 0.0, "motion_regime": "near_static"}- trim = 1 if len(frames) > 8 else 0- fr = frames[trim:len(frames) - trim] if trim else frames- ts = times[trim:len(times) - trim] if trim else times- if len(fr) < 2:- fr, ts = frames, times- grays = [cv2.cvtColor(f, cv2.COLOR_BGR2GRAY) for f in fr]- mads = [float(cv2.absdiff(grays[i], grays[i - 1]).mean()) for i in range(1, len(grays))]- frozen_ratio = float(np.mean([m < 0.15 for m in mads])) if mads else 0.0- step_idx = np.unique(np.linspace(1, len(grays) - 1, num=min(16, len(grays) - 1)).round().astype(int))- mot = []- for i in step_idx:- gm = global_motion(grays[i - 1], grays[i])- if gm is not None:- mot.append(gm)- ms = motion_summary(mot, fps)- keep_idx = np.unique(np.linspace(0, len(fr) - 1, num=min(12, len(fr))).round().astype(int))- sub_fr = [fr[i] for i in keep_idx]- sub_ts = [ts[i] for i in keep_idx]- kin = kinematics_summary(sub_fr, sub_ts, ms)- return {- "frozen_ratio": round(frozen_ratio, 3),- "flow_p90": round(float(ms.get("flow_p90") or 0.0), 3),- **kin,- }---def _coarse_layout_vec(bgr: np.ndarray) -> np.ndarray:- gray = cv2.cvtColor(bgr, cv2.COLOR_BGR2GRAY).astype(np.float32)- h, w = gray.shape- gh = max(16, int(round(24 * h / max(1, w))))- small = cv2.resize(cv2.GaussianBlur(gray, (0, 0), max(1.5, w / 40.0)), (24, gh), interpolation=cv2.INTER_AREA)- gx = np.abs(cv2.Sobel(small, cv2.CV_32F, 1, 0, ksize=3)).ravel()- gy = np.abs(cv2.Sobel(small, cv2.CV_32F, 0, 1, ksize=3)).ravel()- v = np.concatenate([gx, gy])- n = float(np.linalg.norm(v))- return v / n if n > 1e-5 else np.zeros_like(v)---def _layout_similarity(src_frames: list[np.ndarray], rem_frames: list[np.ndarray]) -> float:- if not src_frames or not rem_frames:- return 1.0- pairs = [(src_frames[0], rem_frames[0])]- if len(src_frames) >= 3 and len(rem_frames) >= 3:- pairs.append((src_frames[-1], rem_frames[-1]))- sims = []- for a, b in pairs:- va = _coarse_layout_vec(a)- vb = _coarse_layout_vec(cv2.resize(b, (a.shape[1], a.shape[0]), interpolation=cv2.INTER_AREA))- if va.any() and vb.any():- sims.append(float(np.clip(np.dot(va, vb), 0.0, 1.0)))- return round(float(np.mean(sims)), 3) if sims else 1.0---def evaluate_remake(breakdown: dict, remake_video: str | Path, out_dir: Path | None = None,- legend: list[tuple] | None = None, replaced_only: bool = True) -> dict:- """Compare a remake video shot-by-shot against the source breakdown on camera, pose kinematics, framing and smoothness."""- src_path = Path(breakdown["source"]["path"])- rem_path = Path(remake_video)- if not src_path.is_file() or not rem_path.is_file():- return {"ok": False, "reason": "missing_video", "shots": []}- how_map = {int(i): h for i, h in (legend or [])}- eval_shots = [s for s in breakdown.get("shots") or []- if not (replaced_only and how_map and how_map.get(int(s["index"])) == "original")]- if not eval_shots:- return {"ok": True, "evaluated_shots": 0, "score": None, "shots": [], "issues": []}-- src_fr, src_ts, src_fps = _decode_by_shots(src_path, eval_shots)- rem_fr, rem_ts, rem_fps = _decode_by_shots(rem_path, eval_shots)- rows: list[dict] = []- issues: list[str] = []- for sh in eval_shots:- idx = int(sh["index"])- sf, st = src_fr.get(idx) or [], src_ts.get(idx) or []- rf, rt = rem_fr.get(idx) or [], rem_ts.get(idx) or []- if len(sf) < 2 or len(rf) < 2:- continue- sk = _shot_kinematics(sf, st, src_fps)- rk = _shot_kinematics(rf, rt, rem_fps)- shot_issues: list[str] = []-- # 1. Smoothness (freeze-frame check)- if sk["frozen_ratio"] < 0.08 and rk["frozen_ratio"] > 0.18 and sk["motion_regime"] != "near_static":- smooth = float(np.clip(1.0 - (rk["frozen_ratio"] - 0.10) * 2.0, 0.0, 1.0))- shot_issues.append(T("冻结重复帧偏多({r:.0%})", "excess frozen duplicate frames ({r:.0%})", r=rk["frozen_ratio"]))- else:- smooth = 1.0-- # 2. Camera trajectory agreement- s_tr, r_tr = sk["camera_traj"], rk["camera_traj"]- if s_tr == r_tr:- cam_sc = 1.0- elif frozenset((s_tr, r_tr)) in _OPPOSITE_TRAJ:- cam_sc = 0.0- shot_issues.append(T("运镜方向相反(原片 {a},成片 {b})", "opposite camera move (source {a}, remake {b})", a=s_tr, b=r_tr))- elif "static" in (s_tr, r_tr):- strong = abs(sk["net_zoom_pct"]) >= 4.0 or abs(rk["net_zoom_pct"]) >= 4.0 or s_tr not in ("static", "handheld") or r_tr not in ("static", "handheld")- cam_sc = 0.45 if strong else 0.75- if strong:- shot_issues.append(T("运镜不一致(原片 {a},成片 {b})", "camera move mismatch (source {a}, remake {b})", a=s_tr, b=r_tr))- else:- cam_sc = 0.65-- # 3. Subject pose & motion-energy fidelity- sp, rp = sk["pose_change"], rk["pose_change"]- if sk["motion_regime"] in ("anchored_pose", "camera_only", "near_static") and sp < 0.25 and rp >= sp + 0.20:- mot_sc = float(np.clip(1.0 - 2.0 * (rp - sp), 0.1, 0.65))- shot_issues.append(T("主体姿态大幅偏离(原片稳姿 {a:.2f},成片转身/位移 {b:.2f})",- "unwanted pose/orientation jump (source anchored {a:.2f}, remake {b:.2f})", a=sp, b=rp))- elif sk["motion_regime"] == "articulated_action" and sp >= 0.30 and rp < 0.45 * sp:- mot_sc = 0.35- shot_issues.append(T("主体动作幅度不足(原片 {a:.2f},成片 {b:.2f})",- "under-animated subject action (source {a:.2f}, remake {b:.2f})", a=sp, b=rp))- else:- mot_sc = float(np.clip(1.0 - abs(rp - sp) * 1.1, 0.4, 1.0))- if sk["flow_p90"] > 0.65 and rk["flow_p90"] < 0.25 * sk["flow_p90"]:- mot_sc = min(mot_sc, 0.45)- shot_issues.append(T("物理动态偏弱(风动/粒子/运动量不足)", "weak secondary motion energy"))-- # 4. Appearance-invariant framing layout similarity- lay_sc = _layout_similarity(sf, rf)- if lay_sc < 0.52:- shot_issues.append(T("构图景别或主体朝向偏移(轮廓布局相似度 {s:.2f})",- "framing or silhouette layout drift (similarity {s:.2f})", s=lay_sc))-- total = round(0.30 * cam_sc + 0.35 * mot_sc + 0.25 * lay_sc + 0.10 * smooth, 3)- for msg in shot_issues:- issues.append(f"#{idx}: {msg}")- rows.append({- "shot": idx,- "start": sh["start"],- "end": sh["end"],- "score": total,- "camera_score": round(cam_sc, 3),- "motion_score": round(mot_sc, 3),- "layout_score": lay_sc,- "smoothness": round(smooth, 3),- "source": {"camera_traj": s_tr, "net_zoom_pct": sk["net_zoom_pct"], "motion_regime": sk["motion_regime"],- "pose_change": sp, "frozen_ratio": sk["frozen_ratio"]},- "remake": {"camera_traj": r_tr, "net_zoom_pct": rk["net_zoom_pct"], "motion_regime": rk["motion_regime"],- "pose_change": rp, "frozen_ratio": rk["frozen_ratio"]},- "issues": shot_issues,- })-- mean_sc = round(float(np.mean([r["score"] for r in rows])), 3) if rows else None- res = {- "ok": True,- "evaluated_shots": len(rows),- "score": mean_sc,- "camera_score": round(float(np.mean([r["camera_score"] for r in rows])), 3) if rows else None,- "motion_score": round(float(np.mean([r["motion_score"] for r in rows])), 3) if rows else None,- "layout_score": round(float(np.mean([r["layout_score"] for r in rows])), 3) if rows else None,- "smoothness": round(float(np.mean([r["smoothness"] for r in rows])), 3) if rows else None,- "issues": issues,- "shots": rows,- }- if out_dir is not None:- Path(out_dir).mkdir(parents=True, exist_ok=True)- write_json(Path(out_dir) / "qa.json", res)- return res---def qa_markdown(qa: dict) -> list[str]:- """Markdown section summarizing per-shot remake fidelity for `remake/status.md`."""- rows = qa.get("shots") or []- if not rows:- return []- L = ["", T("## 还原度质检(运镜 · 姿态 · 构图 · 流畅度)", "## Fidelity QA (camera · pose · layout · smoothness)"), "",- T("- 综合得分:**{s:.0%}**(运镜 {c:.0%} · 姿态动态 {m:.0%} · 构图轮廓 {l:.0%} · 流畅度 {f:.0%})",- "- Overall fidelity: **{s:.0%}** (camera {c:.0%} · pose/motion {m:.0%} · framing layout {l:.0%} · smoothness {f:.0%})",- s=qa.get("score") or 0, c=qa.get("camera_score") or 0, m=qa.get("motion_score") or 0,- l=qa.get("layout_score") or 0, f=qa.get("smoothness") or 0), ""]- L += [T("| 镜头 | 得分 | 原片运镜 / 姿态 | 成片运镜 / 姿态 | 构图相似 | 诊断 |",- "| Shot | Score | Source cam / pose | Remake cam / pose | Layout | Diagnosis |"),- "|---|---|---|---|---|---|"]- for r in rows:- s_info = f"`{r['source']['camera_traj']}` / `{r['source']['motion_regime']}` ({r['source']['pose_change']:.2f})"- r_info = f"`{r['remake']['camera_traj']}` / `{r['remake']['motion_regime']}` ({r['remake']['pose_change']:.2f})"- diag = ";".join(r["issues"]) if r.get("issues") else T("通过", "OK")- L.append(f"| #{r['shot']} | {r['score']:.0%} | {s_info} | {r_info} | {r['layout_score']:.2f} | {diag} |")- return Ldiff --git a/rea_video/report.py b/rea_video/report.pyindex 5c2ca8f..108d4e0 100644--- a/rea_video/report.py+++ b/rea_video/report.py@@ -364,12 +364,6 @@ def _layers_md(b: dict) -> list[str]:s="" if n_by.get(m["label_zh"]) == 1 else "s", p=_pct(m["ratio"]))for m in s["production_mix"] if n_by.get(m["label_zh"]))pic_how = _picture_how(b) or s.get("production") or "—"- if plan.get("strategy") and plan.get("units"):- from .generation import strategy_name-- img_n = len(plan.get("image_tasks") or [])- pic_how += T("(模态:{m}", " (modality: {m}", m=strategy_name(plan["strategy"])) + (- T(";含 {n} 张前置图片方案)", "; {n} upstream frame prompts)", n=img_n) if img_n else T(")", ")"))rm = s.get("real_material") or {}if rm.get("shots"):pic += T(";含真实素材 {n} 镜({r:.0%})", "; includes real material in {n} shot{s} ({r:.0%})",@@ -1079,9 +1073,9 @@ def _shot_detail_md(r: dict) -> list[str]:L += ["", T("- 复刻:{n}", "- Remake: {n}", n=rep["note"])]p = shot_prompts(r)if p.get("image_prompt"):- L.append(T(" - 反推首帧生图提示词:{p}", " - Reverse-engineered image prompt: {p}", p=p["image_prompt"]))+ L.append(T(" - 首帧生图提示词:{p}", " - First-frame image prompt: {p}", p=p["image_prompt"]))if p.get("motion_prompt"):- L.append(T(" - 图生视频纯动态提示词:{p}", " - Image-to-video motion prompt: {p}", p=p["motion_prompt"]))+ L.append(T(" - 图生视频动作提示词:{p}", " - Image-to-video motion prompt: {p}", p=p["motion_prompt"]))if p.get("video_prompt"):L.append(T(" - 完整视频提示词:{p}", " - Full video prompt: {p}", p=p["video_prompt"]))return Ldiff --git a/rea_video/review.py b/rea_video/review.pyindex 6cea979..fb150ef 100644--- a/rea_video/review.py+++ b/rea_video/review.py@@ -54,7 +54,7 @@ kind 取 {"|".join(ASSET_KINDS)},is_real_material 为 true/false)。同一段成片在片中出现不止一次(开头先放一段成片当预告、结尾完整放;或中途回放),在较短的那一处填 same_clip_as:另一处的镜头号(整数),复刻时只生成一次;不是就不要填。实拍或定格镜头被 AI 二次加工过时填 ai_edits:[{{"kind": "{"|".join(EDIT_KINDS)}", "evidence": "看到的破绽"}}](换脸、对口型、风格化、换装、换背景、加删物体、美颜);没有就留空。AI 生成 / 3D / 实拍镜头再填 replication:image_prompt(复刻首帧的<PROMPT_LANG>图像提示词:景别、机位高度和俯仰角、主体在画面里的位置和朝向、主体,以及四维质感——①渲染介质[严格区分无描边 3D CG 光追硬表面/次表面渲染、真机实拍光学、2.5D 厚涂插画、2D 线稿平涂,严禁把无描边 3D CG 泛化写成二次元/插画]②材质微观肌理[皮肤纹理、织物经纬、金属磨损、流体植被细节]③光影反差[高反差暗调逆光、柔光漫射、轮廓高光]④镜头光学特征[前景遮挡失焦、大光圈散景光斑 Bokeh、边缘辉光 Bloom];有人物时写首帧自然表情)、-video_prompt(复刻该镜头的<PROMPT_LANG>视频提示词:先对照每镜实测 `motion` 字段里的 `camera_traj`、`net_zoom_pct` 与 `motion_regime`,再看 sheet 关键帧首尾变化,写清景别、机位角度、主体位置、动作过程、环境次级物理动态、结束状态与运镜方向幅度;严禁写反推/拉方向;当 `motion_regime=anchored_pose` 时说明主体核心姿态与朝向保持锚定,动态来自 3D 视差运镜及风吹发丝衣摆/粒子流体/光影微动,足量写出真实次级物理张力但严禁凭空脑补转身、迈步或抬手等未发生的大幅肢体动作;当 `motion_regime=articulated_action` 时如实写清起止帧间的姿态变化轨迹与结束落幅;面部表情保持克制自然,只写想要的内容,不写否定句)、video_prompt_en(英文版)、+video_prompt(复刻该镜头的<PROMPT_LANG>视频提示词:先看 sheet 关键帧首尾变化,再参考每镜实测 `motion` 字段里的 `camera_traj`、`net_zoom_pct` 与 `motion_regime`(camera_traj 只是线索:人物前后移动、手持晃动和漏检的切镜都会让它误报,和画面对不上时以画面为准),写清景别、机位角度、主体位置、动作过程、环境次级物理动态、结束状态与运镜方向幅度;推和拉不要写反;当 `motion_regime=anchored_pose` 时说明主体核心姿态与朝向保持锚定,动态来自 3D 视差运镜及风吹发丝衣摆/粒子流体/光影微动,足量写出真实次级物理张力但严禁凭空脑补转身、迈步或抬手等未发生的大幅肢体动作;当 `motion_regime=articulated_action` 时如实写清起止帧间的姿态变化轨迹与结束落幅;面部表情保持克制自然,只写想要的内容,不写否定句)、video_prompt_en(英文版)、motion_prompt(首帧/首尾帧模式下的纯动态提示词:只写实测与可见的运动过程、次级物理动态、结束状态和运镜方向幅度,不重复描述首帧图里已有的外貌、场景和光线)、motion_prompt_en(英文纯动态版)。这些提示词会被合并进「生成单元」的多镜头提示词,所以每镜只写这一镜的内容,统一的风格和场景描述写在 description 里即可。diff --git a/rea_video/unit_split.py b/rea_video/unit_split.pynew file mode 100644index 0000000..c2d6567--- /dev/null+++ b/rea_video/unit_split.py@@ -0,0 +1,183 @@+"""Split one generated multi-shot clip back into its shots.++A multi-shot call returns one clip for several source shots. The model's cuts rarely land exactly where the plan put+them, and it sometimes adds an extra cut inside a shot. So the clip is cut where its own pixels cut, and the pieces are+grouped, in order, into as many shots as were planned, so a shot the model cut in two keeps both halves. Only a very+short glitch at a shot's edge is left out.+"""+from __future__ import annotations++import subprocess+from pathlib import Path++import cv2+import numpy as np++SHORT_SIDE = 108 # decode size for cut detection+++def _struct_vec(bgr: np.ndarray, size: tuple[int, int]) -> np.ndarray:+ """Colour-blind layout signature: blurred gradients + mean-removed luma, unit length."""+ gray = cv2.cvtColor(bgr, cv2.COLOR_BGR2GRAY).astype(np.float32)+ small = cv2.resize(cv2.GaussianBlur(gray, (0, 0), 2.0), size, interpolation=cv2.INTER_AREA)+ grad = np.concatenate([np.abs(cv2.Sobel(small, cv2.CV_32F, 1, 0, ksize=3)).ravel(),+ np.abs(cv2.Sobel(small, cv2.CV_32F, 0, 1, ksize=3)).ravel()])+ grad /= float(np.linalg.norm(grad)) + 1e-5+ luma = small.ravel() - float(small.mean())+ luma /= float(np.linalg.norm(luma)) + 1e-5+ v = np.concatenate([grad, luma])+ n = float(np.linalg.norm(v))+ return v / n if n > 1e-5 else np.zeros_like(v)+++def _read_small(video_file: Path, limit: int) -> tuple[list[np.ndarray], float]:+ cap = cv2.VideoCapture(str(video_file))+ fps = float(cap.get(cv2.CAP_PROP_FPS) or 0.0)+ frames: list[np.ndarray] = []+ while len(frames) < limit:+ ok, fr = cap.read()+ if not ok:+ break+ h, w = fr.shape[:2]+ s = SHORT_SIDE / float(min(h, w))+ frames.append(cv2.resize(fr, (max(2, int(round(w * s))), max(2, int(round(h * s)))), interpolation=cv2.INTER_AREA))+ cap.release()+ return frames, fps+++def find_cuts(frames: list[np.ndarray], fps: float, want: int) -> list[int]:+ """Frame indices where a new shot starts: real hard cuts first, then the strongest jumps until `want` are found."""+ n = len(frames)+ if n < 8:+ return []+ hists = []+ for f in frames:+ h = cv2.calcHist([cv2.cvtColor(f, cv2.COLOR_BGR2HSV)], [0, 1, 2], None, [12, 4, 4], [0, 180, 0, 256, 0, 256])+ cv2.normalize(h, h)+ hists.append(h)+ mads = np.array([float(np.mean(np.abs(frames[i].astype(np.int16) - frames[i - 1].astype(np.int16)))) for i in range(1, n)], np.float32)+ bhat = np.array([float(cv2.compareHist(hists[i - 1], hists[i], cv2.HISTCMP_BHATTACHARYYA)) for i in range(1, n)], np.float32)+ # a cut is a spike against its neighbourhood, which also catches cuts between two similar dark scenes+ med = np.array([float(np.median(mads[max(0, i - 5):i + 6])) for i in range(len(mads))], np.float32)+ spike = mads / (med + 2.5)+ cands = []+ for i in range(3, n - 3):+ d = i - 1+ score = 0.55 * float(bhat[d]) + 0.45 * min(1.0, float(mads[d]) / 60.0)+ real = (mads[d] >= 28.0 and spike[d] >= 2.6 and bhat[d] >= 0.16) or bhat[d] >= 0.36+ cands.append((score, real, i))+ min_gap = max(6, int(round(0.35 * (fps or 24.0))))+ cuts: list[int] = []+ for score, real, i in sorted(cands, reverse=True):+ if score < 0.22 or (not real and len(cuts) >= want):+ break+ if all(abs(i - c) >= min_gap for c in cuts):+ cuts.append(i)+ if len(cuts) >= want + 4:+ break+ return sorted(cuts)+++def group_pieces(pieces: list[tuple[int, int]], n_shots: int, ref_mid: list[float], ref_dur: list[float],+ ref_vecs: list[np.ndarray | None], piece_vecs: list[np.ndarray]) -> list[list[tuple[int, int]]] | None:+ """Group consecutive pieces into `n_shots` runs, best match on time position, length and layout. Every piece goes+ to exactly one shot, so nothing in the clip is lost."""+ k = len(pieces)+ if k < n_shots:+ return None+ total = float(pieces[-1][1] - pieces[0][0]) or 1.0+ t0 = pieces[0][0]++ def score(i: int, s: int, e: int) -> float:+ a, z = pieces[s][0], pieces[e][1]+ mid, dur = (0.5 * (a + z) - t0) / total, (z - a) / total+ longest = max(range(s, e + 1), key=lambda j: pieces[j][1] - pieces[j][0])+ sim = float(np.dot(ref_vecs[i], piece_vecs[longest])) if ref_vecs[i] is not None else 0.5+ return sim - 0.65 * abs(mid - ref_mid[i]) + 0.35 * min(dur, ref_dur[i]) / max(dur, ref_dur[i], 1e-6)++ neg = -1e18+ best = [[neg] * k for _ in range(n_shots)] # best[i][e]: shots 0..i placed, shot i ends at piece e+ back = [[-1] * k for _ in range(n_shots)]+ for e in range(k - n_shots + 1):+ best[0][e] = score(0, 0, e)+ for i in range(1, n_shots):+ for e in range(i, k - (n_shots - 1 - i)):+ for s in range(i, e + 1):+ prev = best[i - 1][s - 1]+ if prev <= neg:+ continue+ v = prev + score(i, s, e)+ if v > best[i][e]:+ best[i][e], back[i][e] = v, s+ if best[n_shots - 1][k - 1] <= neg:+ return None+ groups, e = [], k - 1+ for i in range(n_shots - 1, -1, -1):+ s = back[i][e] if i > 0 else 0+ groups.append(pieces[s:e + 1])+ e = s - 1+ return groups[::-1]+++def split_unit(video_file: Path, shot_ids: list[int], trim_to: float, out_dir: Path,+ ref_shots: list[dict] | None = None, bdir: Path | None = None) -> dict[str, str]:+ """{shot id: clip} cut from one multi-shot clip, or {} when its cuts can't be matched to the shots."""+ n = len(shot_ids)+ if n < 2 or not video_file.is_file():+ return {}+ cap = cv2.VideoCapture(str(video_file))+ fps = float(cap.get(cv2.CAP_PROP_FPS) or 0.0)+ total = int(cap.get(cv2.CAP_PROP_FRAME_COUNT) or 0)+ cap.release()+ if fps <= 0 or total < n * 4:+ return {}+ limit = min(total, max(n * 4, int(round(trim_to * fps)))) if trim_to > 0 else total+ frames, _ = _read_small(video_file, limit)+ if len(frames) < n * 4:+ return {}+ cuts = find_cuts(frames, fps, n - 1)+ if len(cuts) < n - 1:+ return {}+ bounds = [0] + cuts + [len(frames)]+ pieces = list(zip(bounds[:-1], bounds[1:]))++ h, w = frames[0].shape[:2]+ vec_size = (24, max(8, int(round(24 * h / float(w)))))+ piece_vecs = [_struct_vec(frames[(a + z) // 2], vec_size) for a, z in pieces]+ ref_mid = [(i + 0.5) / n for i in range(n)]+ ref_dur = [1.0 / n] * n+ ref_vecs: list[np.ndarray | None] = [None] * n+ if ref_shots and len(ref_shots) == n:+ u0 = float(ref_shots[0]["start"])+ span = max(0.1, float(ref_shots[-1]["end"]) - u0)+ ref_mid = [(0.5 * (float(s["start"]) + float(s["end"])) - u0) / span for s in ref_shots]+ ref_dur = [max(0.02, (float(s["end"]) - float(s["start"])) / span) for s in ref_shots]+ for i, s in enumerate(ref_shots):+ ff = (s.get("assets") or {}).get("first_frame")+ p = Path(bdir) / ff if (bdir and ff) else None+ im = cv2.imread(str(p)) if p and p.is_file() else None+ if im is not None:+ ref_vecs[i] = _struct_vec(im, vec_size)+ groups = [[pc] for pc in pieces] if len(pieces) == n else group_pieces(pieces, n, ref_mid, ref_dur, ref_vecs, piece_vecs)+ if not groups:+ return {}+ # a very short piece at the edge of a shot is a glitch the model put in (a flash, a stray frame run): leave it out+ glitch = max(3, int(round(0.4 * fps)))+ spans = []+ for g in groups:+ g = list(g)+ while len(g) > 1 and g[0][1] - g[0][0] < glitch and g[0][1] - g[0][0] < 0.35 * (g[-1][1] - g[0][0]):+ g.pop(0)+ while len(g) > 1 and g[-1][1] - g[-1][0] < glitch and g[-1][1] - g[-1][0] < 0.35 * (g[-1][1] - g[0][0]):+ g.pop()+ spans.append((g[0][0], g[-1][1]))++ out_dir.mkdir(parents=True, exist_ok=True)+ clips: dict[str, str] = {}+ for sid, (a, z) in zip(shot_ids, spans):+ dst = out_dir / f"shot_{int(sid):03d}.mp4"+ subprocess.run(["ffmpeg", "-v", "error", "-y", "-i", str(video_file),+ "-vf", f"trim=start_frame={a}:end_frame={z},setpts=PTS-STARTPTS",+ "-an", "-c:v", "libx264", "-pix_fmt", "yuv420p", "-crf", "18", str(dst)], check=True)+ clips[str(sid)] = str(dst)+ return clipsdiff --git a/rea_video/vlm.py b/rea_video/vlm.pyindex 4fd77f1..5bca169 100644--- a/rea_video/vlm.py+++ b/rea_video/vlm.py@@ -350,7 +350,7 @@ AI 仿定格风格(材质在帧间漂移)与真正的定格动画(同一"generator_guess": "可能的生成模型或工具(如 Seedance/Kling/Veo/Hailuo/Blender/Remotion/剪映 模板),无法判断写 unknown","description": "镜头内容:主体、动作、场景、景别、运镜、光线;代码渲染画面写清图形元素是什么(粒子/渐变/图表/卡片/文字/矢量图形)、拼成什么形状、颜色、怎么动(进场方式、流向、变形、镜头推/环绕)、文字和数字组件在哪","shot_size": "特写|近景|中景|全景|远景",- "camera_move": "固定|推|拉|摇|移|跟|环绕|手持(必须结合 hints 里的实测 camera_traj 与 net_zoom_pct 校验,不要把 3D 视差推进误判成拉远或固定)",+ "camera_move": "固定|推|拉|摇|移|跟|环绕|手持(参考 hints 里的实测 camera_traj 与 net_zoom_pct;camera_traj 只是线索:人物前后移动、手持晃动和漏检的切镜都会让它误报,和画面对不上时以画面为准)","style": "四维画风与质感关键词:①渲染介质(严格区分:无描边 3D CG 光追硬表面/次表面渲染、真机实拍光学、2.5D 厚涂插画、2D 线稿平涂,严禁把无描边 3D CG 泛化写成二次元插画)②材质微观肌理(如皮肤毛孔、织物经纬、拉丝/磨损金属、水体植被颗粒)③光影反差(如高反差暗调逆光、柔光漫射、硬朗轮廓光)④镜头光学特征(如前景失焦遮挡、大光圈散景光斑 Bokeh、高光辉光溢出 Bloom)","overlay_text": ["后期叠加在画面上的文字(字幕/标题),不含场景里的实物文字"],"aspects": <<SHOT_ASPECTS>>,@@ -360,8 +360,8 @@ AI 仿定格风格(材质在帧间漂移)与真正的定格动画(同一"performance": {{"who": "", "emotion": "", "intensity": "low|mid|high", "face": "", "body": "", "arc": [], "voice": "", "key": false, "move": "", "movers": 0, "full_body": null, "backdrop": "", "en": ""}},"replication": {{"image_prompt": "复刻首帧的中文图像提示词:写清景别、机位俯仰、主体在画面中的位置与朝向,以及四维质感(渲染介质、材质微观肌理、光影反差、前景虚化/散景 Bokeh/辉光 Bloom;无描边 3D CG 须写明无黑色描边线稿),具体可执行;有人物时写首帧自然神态",- "video_prompt": "复刻该镜头的中文视频提示词:严格对照实测运动信号(camera_traj 与 motion_regime)写清动作过程、环境次级物理动态、结束状态与运镜方向幅度;当 motion_regime=anchored_pose 时说明主体核心姿态与朝向保持锚定,动态主要来自运镜视差及风吹发丝衣摆/水流/光影粒子/微表情,足量写出这些次级动态但严禁脑补未发生的转身、迈步或抬手等大幅肢体动作;当 motion_regime=articulated_action 时按起止帧真实变化写清肢体动作轨迹与落幅;面部表情写克制可见肌肉变化,只写正向内容,不写否定句",- "video_prompt_en": "same video prompt in English (strictly aligned with measured camera_traj and motion_regime: preserve full secondary physics and 3D parallax without inventing unmeasured limb/torso actions)",+ "video_prompt": "复刻该镜头的中文视频提示词:参考实测运动信号(camera_traj 与 motion_regime;camera_traj 只是线索:人物前后移动、手持晃动和漏检的切镜都会让它误报,和画面对不上时以画面为准)写清动作过程、环境次级物理动态、结束状态与运镜方向幅度;当 motion_regime=anchored_pose 时说明主体核心姿态与朝向保持锚定,动态主要来自运镜视差及风吹发丝衣摆/水流/光影粒子/微表情,足量写出这些次级动态但严禁脑补未发生的转身、迈步或抬手等大幅肢体动作;当 motion_regime=articulated_action 时按起止帧真实变化写清肢体动作轨迹与落幅;面部表情写克制可见肌肉变化,只写正向内容,不写否定句",+ "video_prompt_en": "same video prompt in English (use measured camera_traj and motion_regime as hints, the frames win when they disagree; preserve full secondary physics and 3D parallax without inventing unmeasured limb/torso actions)","motion_prompt": "图生视频(首帧/首尾帧模式)的纯动态提示词:只写主体接下来的真实运动变化、环境物理动态(风动/流体/粒子/光影变化)、结束状态和运镜方向幅度,不重复描述首帧图里已有的静态外貌、服饰和布景","motion_prompt_en": "same motion-only prompt in English (verified action progression, secondary physics, end state and camera trajectory only, without repeating static look/scene)"}}diff --git a/skills/rea-video/SKILL.md b/skills/rea-video/SKILL.mdindex 45a45cc..107b99e 100644--- a/skills/rea-video/SKILL.md+++ b/skills/rea-video/SKILL.md@@ -120,13 +120,9 @@ rea-video summary out/ref/breakdown.json # 用并入后的结果写回复image: /绝对路径/product.jpg```2. 方案按这个模型的最新实际情况来:`rea-video models <id>` 看能力地图里的资料和核实日期,再上网核对它最新的官方文档和更新(有没有新版本,单次时长、参考视频 / 参考图的数量和时长、一次多镜头、首尾帧、原生音频、提示词写法有没有变)。能力地图里没有、或和最新资料不一致的,按能力地图的格式写进 `~/.rea-video/capabilities/models/<id>.yaml`(同 id 会覆盖自带的),写上来源和核实日期。-3. `rea-video plan out/ref`:按意图和模型出报告第二部分,并做方案检查。工具按模型真实能力原语选输入方式:- - **保留原片运镜与动作姿态、仅换外观/发色/服装/主体**:优先选 `--strategy edit`(`video.edit_v2v` 原视频动作锁定编辑,配极简增量编辑提示词,避免长篇分镜重演描述覆盖原动作)。- - **无共享角色的多角色异场景混剪(违背 S01 连续性)且不传原视频**:无时间戳锁帧(`video.keyframes`)的模型会自动走 `--strategy frames`(逐镜首帧/首尾帧像素级锁构图与起止姿态),不要强塞进无时间戳的 `multi_reference` 池导致跨镜头串色;注意首帧换人/换外观后若未重绘尾帧,不要传原片尾帧以免末尾变回原片角色。- - **深度/边缘控制视频(`--video-ref depth|edge`)**:仅用于声明了像素级空间控制 `video.control_video` 的模型(如 `wan-vace`),不要喂给仅支持语义参考视频(`video.reference_video`)的模型。- - 复核镜头提示词时,以每镜实测的 `motion`(`camera_traj` 推拉摇移轨迹与 `motion_regime` 姿态变化模式)为准:`anchored_pose`(核心姿态锚定 + 风动/粒子/视差微动)镜头严禁脑补未发生的转身或大幅肢体动作。+3. `rea-video plan out/ref`:按意图和模型出报告第二部分,并做方案检查。工具按模型能吃什么选输入方式(参考原片视频 / 每镜一张原片关键帧 / 首尾帧 / 纯文字),在单次时长和参考数量以内用最少的调用装下所有镜头,原片参考擦掉字幕后放在 `remake/refs/`。只换外观、动作和运镜照原片时,模型支持视频编辑可以加 `--strategy edit`;每个镜头角色都不一样的混剪,方案检查会提示考虑逐镜首帧。镜头运动以画面为准,实测的 `camera_traj` 只当线索。4. 写之前上网搜这个模型的提示词写法和同类镜头的优质提示词:先看口碑好的创作者的实测(X、YouTube、B站、小红书等),再看官方文档和示例;平台的教程页(CapCut、fal 这类)只当二手资料。参考结构和写法,不照抄内容;和能力地图不一致的按第 2 步记下来。报告里的草稿已按这个模型的分镜、参考标签、首帧纯运动精简和台词音效格式排好,再按它的写法(`rea-video models <id>`,或这个模型的提示词 skill)核对改写成最终提示词放进 `out/ref/remake/prompts.json`(`{"G1": "..."}`,图片编号按单元里参考图的顺序;单跑命令行时也可直接用 `rea-video plan out/ref --rewrite-prompts` 自动按模型指南重写并校验),再跑一次 `rea-video plan`,直到方案检查没有 ❌。-5. 把方案给用户看(调用次数、每次喂什么、检查结果),用户同意后再生成。生成并拼装后检查 `remake/qa.json` 与 `remake/status.md` 的「还原度质检」(或跑 `rea-video compare ref.mp4 out/ref/remake/remake.mp4 --breakdown out/ref/breakdown.json`),核验逐镜运镜方向、姿态变化量、构图轮廓与流畅度是否达标。+5. 把方案给用户看(调用次数、每次喂什么、检查结果),用户同意后再生成。用户要自己动手做时,先给报告第二部分「照着做」的步骤,不要先讲模型规则和输入表。