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
fix: 混剪视频里按镜头放行看图的实拍判断(issue #8)
june1646185a4068
diff --git a/eval/RESULTS.md b/eval/RESULTS.mdindex a083d30..66080ff 100644--- a/eval/RESULTS.md+++ b/eval/RESULTS.md@@ -367,3 +367,35 @@ rea-video --env-file $CAPSULE_CINEMA_ROOT/.env eval eval/labels.yaml -o out/eval- 两段即梦成片文件里没有 AIGC 标识,抖音接口的 `show_ai_corner` 也是 false;认出 AI 靠的是画面里的即梦水印和礼盒英文乱码。复现:`rea-video eval eval/daihuo.yaml -o out/eval_daihuo`(工具)、`--vlm -o out/eval_daihuo_vlm`(Gemini);agent 复核的结果是把 `rea-video apply-review` 后的输出目录复制到 `out/eval_daihuo_review/<id>/` 再 `eval --vlm` 复用。+++## 2026-11-04:混合结构视频里,看图复核的实拍判断按镜头放行(issue #8)++issue #8 的口红带货片(抖音转码,HEVC 1080x1920 30fps,98 秒 38 镜):AI 猫店员开场 23 秒(24→30 重复帧)+ 2 秒促销版式卡 + 75 秒真人试色素材(没有重复帧)。工具把真人部分全判成 AI 低置信,agent 看图复核判实拍后**一个都没改**:`_vlm_gate` 在转码视频上只认整片的 `native30`,而整片因为混了 AI 开场只有 64% 时长原生 30fps(阈值 70%),于是「转码 24fps 素材不改实拍」这条挡住了所有镜头,报告写成「AI 86%」、复刻方案给了 20 个生成单元。++改动:++- `classify.deterministic` 新增逐镜 `facts["native_cadence"]`:30fps 文件里这一镜 `dup_ratio < 0.02`、没有 pulldown(转码文件不看 GOP 清晰度周期)。只是事实,不参与打分。+- `pipeline._vlm_gate`:转码视频上看图判实拍时,整片 `native30` 或**这一镜** `native_cadence` 二者有一即放行;另外工具前三名都不到 0.4、且看图类别只比次选差 ≤0.08 时(唇部微距没有人脸,工具给 3D 0.35 / AI 0.27 / 实拍 0.22),看图结果也计入。+- `pipeline._ai_or_live_doubt`:实拍「待确认」文案按这一镜有没有重复帧区分,镜头有相机节奏且看图判实拍(≥0.5)时不再标待确认。+- 这条视频并入后:实拍 75% + AI 25%,改判 31 镜;残留 #4 促销卡(2 秒)仍判 AI(工具 0.46,看图的版式类不在前两名)。++回归(重新解码;labels / holdout2 只剩本机有文件的 7 / 3 条,capsule-cinema 的产出已不在):++| 集合 | 只用工具 | 说明 |+|---|---|---|+| labels(7 条) | 1.000 | 真实素材 0.958,与改前逐条一致 |+| holdout(7 条) | 0.995 | lulukong_b 0.962,与改前一致 |+| holdout2(3 条) | 0.995 | — |+| articles(10 条) | 0.886 | 与 11-02 一致 |+| koubo(2 条) | 0.755 | 0.51 / 0.99,与改前一致 |+| daihuo(2 条) | 0.464 | 与 11-04 一致 |++只用工具的分数不受影响(新事实不参与打分)。用缓存的看图答案重新融合 daihuo:++| 组合 | daihuo_unboxing | daihuo_ai_tutorial | 真实素材 |+|---|---|---|---|+| + Gemini VLM(改前 → 改后) | 96.9% → 96.9% | 22.9% → **37.2%** | 86.8% → **92.6%** |+| + agent 看图复核 | 97.4% → 97.4% | 97.7% → 97.7% | 97.5% → 97.5% |++教程片里「相机拍真实手机屏幕」的镜头有一部分因为镜头自身没有重复帧被 Gemini 的实拍判断纠回来了,剩下的仍是「工具判 3D、看图判实拍」跟了工具(待做)。issue #8 的视频作者未勾选公开,没有加进评测集。diff --git a/rea_video/classify.py b/rea_video/classify.pyindex b327da0..a99b2a0 100644--- a/rea_video/classify.py+++ b/rea_video/classify.py@@ -233,6 +233,11 @@ def deterministic(f: dict, overlay: dict | None = None, text: dict | None = None"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"] = pulldown+ # this shot's own cadence: a 30 fps file whose frames never repeat was captured at 30 fps (phones) rather than+ # generated at 24 and pulled up. Per shot, unlike ctx["native30"], so a mixed edit (AI opener + phone footage)+ # keeps the signature on the filmed shots. Platform re-encodes add a GOP sharpness rhythm, so that cue is skipped there.+ facts["native_cadence"] = bool(fps and 29 <= fps <= 31 and dup < 0.02 and not pulldown+ and (ctx.get("transcoded") or f.get("sharp_period_ac", 0) < 0.45))if pulldown: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",diff --git a/rea_video/pipeline.py b/rea_video/pipeline.pyindex 138a460..83db7fa 100644--- a/rea_video/pipeline.py+++ b/rea_video/pipeline.py@@ -227,8 +227,11 @@ def _ai_or_live_doubt(label: str, facts: dict, prov: dict, vctx: dict, seen_live"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 None- if label == "live_action" and vctx.get("native30") and not facts.get("pulldown"):- return None+ if label == "live_action" and not facts.get("pulldown"):+ if vctx.get("native30") or (facts.get("native_cadence") and seen_live >= 0.5):+ return None # camera cadence on the file, or on this shot plus an image reader that saw filmed footage+ return T("实拍还是 AI 待确认:平台转码抹掉了噪声证据,这一镜没有 24fps 源的重复帧,但整片不是原生 30fps,需要看图确认",+ "Live action or AI, to confirm: the platform transcode erased the noise cues; this shot carries no 24fps-source duplicate frames, but the file is not native 30fps throughout, needs an image reader")if label == "ai_video":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")@@ -290,14 +293,22 @@ def _vlm_gate(rec: dict, vprobs: dict | None, vctx: dict) -> dict | None:and bool(facts.get("big_face") or facts.get("lowlight") or facts.get("face_area", 0) >= RULES["big_face"]["area"]))if v in UNMEASURED: # 2D animation / stop motion: the tools cannot score them, so they cannot back them eitherreturn vprobs- if v not in (d, ranked[1][0]) and not person: # it must back one of the tools' two best guesses+ # the tools are undecided when no label reaches 0.4 and the reader's pick trails the runner-up by a hair:+ # a lip macro with no face found scores 3D 0.35 / AI 0.27 / live 0.22 (issue #8 #22-#27), which is no call+ undecided = dp < 0.4 and vprobs.get(v, 0.0) > 0 and rec["deterministic"]["probs"].get(v, 0.0) >= 0.15 \+ and sp - rec["deterministic"]["probs"].get(v, 0.0) <= 0.08+ if v not in (d, ranked[1][0]) and not person and not undecided: # it must back one of the tools' two best guessesreturn None# the tools' confidence only protects the AI / live axis (frame-rate evidence), not a "rendered" texture callif (d in AI_LIVE_AXIS or v in AI_LIVE_AXIS) and not (person and d not in AI_LIVE_AXIS):if dp >= 0.65 and dp - sp >= 0.25: # tools are sure: frame-rate evidence beats "looks real / looks like a presenter"return None- if v == "live_action" and facts.get("transcode_degraded") and not vctx.get("native30"):- return None # transcoded 24fps-source footage never becomes live action on looks alone+ if (v == "live_action" and facts.get("transcode_degraded") and not vctx.get("native30")+ and not facts.get("native_cadence")):+ # transcoded 24fps-source footage never becomes live action on looks alone; a shot that itself carries+ # no duplicate frames in a 30 fps file has the camera cadence, so the reader's eye decides there+ # (issue #8 lipstick ad: AI opener with pulldown + 75 s of phone footage without, whole-video native30 False)+ return Nonereturn vprobsdiff --git a/skills/rea-video/references/review.md b/skills/rea-video/references/review.mdindex a3823c9..633312f 100644--- a/skills/rea-video/references/review.md+++ b/skills/rea-video/references/review.md@@ -6,7 +6,7 @@ SKILL.md 第 1 节流程的补充:看图结果怎么和工具融合,以及实测得来(仓库 `eval/RESULTS.md`):-- 只有一个看图来源(只有 VLM 或只有你)时,看图结果只能在工具前两名候选里选。工具对"AI / 实拍 / 数字人"有把握时不改;转码的 24fps 素材不会仅凭"看起来真"改成实拍。看图结果在 3D / 代码动效 / 录屏之间的区分最有用。+- 只有一个看图来源(只有 VLM 或只有你)时,看图结果只能在工具前两名候选里选。工具对"AI / 实拍 / 数字人"有把握时不改;转码后带 24→30 重复帧的镜头不会仅凭"看起来真"改成实拍。镜头自身没有重复帧(原生 30fps 节奏)时,你的实拍判断会被采纳,哪怕整片因为混了 AI 开场而没被标成原生 30fps;工具前三名都不到 0.4、且你选的类别只比次选差一点时,也以你为准。看图结果在 3D / 代码动效 / 录屏之间的区分最有用。- VLM 和你都答了:先判大类(生成 / 渲染 / 实拍 / 录屏 / 静图),再判细类。工具首选只要有你们其中一方支持(同细类或同大类,比如工具判 AI 视频、你判数字人),就按工具首选的大类;你们两个一致反对工具时,按正常融合。- 标了「有分歧」的镜头(工具和 VLM 对是不是实拍意见相反)必看:核对 VLM 写的证据在截图里是否真的看得见,VLM 会编理由。- review_tasks.json 里写着"用户过去 n 次把工具判的 X 改成 Y"的镜头,是用户反复纠正过的类型,要重点看。diff --git a/tests/test_memory.py b/tests/test_memory.pyindex 1af8431..6ff7c60 100644--- a/tests/test_memory.py+++ b/tests/test_memory.py@@ -113,8 +113,10 @@ def test_single_image_reader_cannot_flip_ai_vs_live_axis():assert _vlm_gate(rec(p(ai_video=0.9, avatar=0.03)), vlm_avatar, {}) is None # tools sure + not in top-2assert _vlm_gate(rec(p(ai_video=0.74, cg_3d=0.1)), p(cg_3d=0.95), {}) is None # tools sure on AI axisassert _vlm_gate(rec(p(cg_3d=0.56, code_render=0.36)), p(code_render=0.8), {}) # 3D vs code: VLM helps- assert _vlm_gate(rec(p(ai_video=0.46, live_action=0.38), {"transcode_degraded": True}),+ assert _vlm_gate(rec(p(ai_video=0.46, live_action=0.38), {"transcode_degraded": True, "pulldown": "24→30"}),p(live_action=0.85), {"native30": False}) is None # 24fps transcode never -> live+ assert _vlm_gate(rec(p(ai_video=0.46, live_action=0.38), {"transcode_degraded": True, "native_cadence": True}),+ p(live_action=0.85), {"native30": False}) # this shot has camera cadence: the reader decidesassert _vlm_gate(rec(p(ai_video=0.46, live_action=0.38), {"transcode_degraded": True}),p(live_action=0.85), {"native30": True})agent_only = {"deterministic": {"probs": p(ai_video=0.9, avatar=0.03), "facts": {}}, "review": {"label_probs": vlm_avatar}}diff --git a/tests/test_transcode.py b/tests/test_transcode.pyindex 59f27f1..b15613d 100644--- a/tests/test_transcode.py+++ b/tests/test_transcode.py@@ -3,6 +3,7 @@ from rea_video.classify import deterministic, video_contextPHOTO = {"noise_sigma": 0.5, "temporal_noise": 1.2, "flat_ratio": 0.02, "palette95": 220, "axis_edge_ratio": 0.2,"dup_ratio": 0.0, "moving_pair_ratio": 1.0, "zero_pixel_ratio": 0.1, "camera": "smooth_move", "saturation": 0.3}PROV_WECHAT = {"hints": {"platform": ["WeChat transcode"], "generator": [], "camera": []}}+PROV_DOUYIN = {"hints": {"platform": ["Douyin/TikTok"], "generator": [], "camera": []}}def _shots(dup):@@ -45,3 +46,47 @@ def test_transcoded_ai_or_live_without_decisive_evidence_is_flagged():assert _ai_or_live_doubt("live_action", {"transcode_degraded": True}, {}, {"native30": True}) is None # phone cameraassert _ai_or_live_doubt("ai_video", {"pulldown": "24→30"}, {}, {}) is None # not transcoded: noise evidence worksassert _ai_or_live_doubt("cg_3d", t, {}, {}) is None+++def test_native_cadence_is_per_shot():+ # mixed edit: AI opener with 24->30 pulldown, then phone footage without; the whole-file flag is off+ shots = _shots(0.2)[:2] + _shots(0.0)+ ctx = video_context(shots, PROV_DOUYIN, 30.0)+ assert ctx["native30"] is False+ _, _, live = deterministic(dict(PHOTO, noise_sigma=0.4, sharp_period_ac=0.6), provenance=PROV_DOUYIN, fps=30.0, ctx=ctx)+ assert live["native_cadence"] is True # GOP sharpness rhythm of a re-encode does not count against it+ _, _, ai = deterministic(dict(PHOTO, dup_ratio=0.2, dup_period=5, dup_regularity=0.6), provenance=PROV_DOUYIN, fps=30.0, ctx=ctx)+ assert ai["native_cadence"] is False and ai["pulldown"] == "24→30"+ _, _, f24 = deterministic(PHOTO, provenance=PROV_DOUYIN, fps=24.0, ctx=ctx)+ assert f24["native_cadence"] is False+++def test_reviewer_live_call_passes_on_shot_with_camera_cadence():+ from rea_video.pipeline import _ai_or_live_doubt, _vlm_gate++ live = {"live_action": 0.9, "ai_video": 0.1}+ rec = {"deterministic": {"probs": {"ai_video": 0.47, "live_action": 0.39, "cg_3d": 0.1, "avatar": 0.04},+ "facts": {"transcode_degraded": True, "native_cadence": True, "pulldown": None}},+ "review": {"label_probs": live}}+ assert _vlm_gate(rec, live, {"native30": False}) == live+ rec["deterministic"]["facts"].update(native_cadence=False, pulldown="24→30")+ assert _vlm_gate(rec, live, {"native30": False}) is None+ # and the verdict is not flagged "to confirm" once the shot has cadence and a reader saw filmed footage+ t = {"transcode_degraded": True, "native_cadence": True}+ assert _ai_or_live_doubt("live_action", t, {}, {"native30": False}, seen_live=0.9) is None+ assert _ai_or_live_doubt("live_action", t, {}, {"native30": False}, seen_live=0.0) # tools alone: still to confirm+ assert "24fps" in _ai_or_live_doubt("live_action", {"transcode_degraded": True, "pulldown": "24→30"}, {}, {"native30": False})+++def test_reader_decides_when_tools_are_undecided():+ from rea_video.pipeline import _vlm_gate++ live = {"live_action": 0.9, "ai_video": 0.1}+ facts = {"transcode_degraded": True, "native_cadence": True}+ rec = {"deterministic": {"probs": {"cg_3d": 0.35, "ai_video": 0.27, "live_action": 0.22, "code_render": 0.09}, "facts": facts},+ "review": {"label_probs": live}}+ assert _vlm_gate(rec, live, {"native30": False}) == live # 3D 0.35 / AI 0.27 / live 0.22 is no call+ rec["deterministic"]["probs"] = {"cg_3d": 0.45, "ai_video": 0.27, "live_action": 0.22, "code_render": 0.06}+ assert _vlm_gate(rec, live, {"native30": False}) is None # a 0.45 lead is a call: live must be in the top two+ rec["deterministic"]["probs"] = {"cg_3d": 0.35, "ai_video": 0.3, "live_action": 0.12, "code_render": 0.23}+ assert _vlm_gate(rec, live, {"native30": False}) is None # the reader's pick trails by too much