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
影视片段线索只看黑边版式和 24/25fps 源,不再识别画面上的片名
june3d5fdad59698
diff --git a/eval/film.yaml b/eval/film.yamlindex 4228ce6..256a02a 100644--- a/eval/film.yaml+++ b/eval/film.yaml@@ -2,7 +2,7 @@# 视频不入库(eval/media/ 已 gitignore):用 TikHub 抖音搜索(douyin_search_fetch_video_search_v2)找到,# douyin_app_v3_fetch_one_video_v3 取地址下载到 eval/media/film/;bit_rate 里 is_h265=2 的档位 ffmpeg 解不了,改用 play_addr_265# 真值来源:人工看联系表目测 + 视频标题和画面上的片名;没有生产记录,属于目测真值。-# 影视片段在像素上就是摄影机拍的画面,工具只给线索(黑边版式、24/25fps 源、《》片名)、不下结论,+# 影视片段在像素上就是摄影机拍的画面,工具只给线索(黑边版式、24/25fps 源)、不下结论,# 所以只开工具时这一组的准确率预期很低,要看「标出待确认」的比例和看图复核后的准确率。videos:- id: film_hk_kungfu_beat@@ -60,7 +60,7 @@ videos:label: film_footagereal_material: true- # 反例:AI 生成的短剧做的解说,版式和真人短剧解说一样(《片名》、「影视效果」免责声明),画面是 AI 生成+ # 反例:AI 生成的短剧做的解说,版式和真人短剧解说一样(「影视效果」免责声明),画面是 AI 生成- id: film_ai_shortdrama_recappath: eval/media/film/ai_shortdrama_recap.mp4source: 抖音 老北观影 aweme 7704868350626680115,话题 #ai短剧;人物脸过于完美、千人一面,25fpsdiff --git a/rea_video/capabilities/routing.yaml b/rea_video/capabilities/routing.yamlindex 892af08..9de7291 100644--- a/rea_video/capabilities/routing.yaml+++ b/rea_video/capabilities/routing.yaml@@ -33,7 +33,7 @@ signals:static_hold: {detected_by: [analyze.shot_boundary], desc: 静帧定格(图片或卡片停留)}anim_2d: {detected_by: [analyze.video_understanding], desc: 2D 动画(手绘逐帧、Live2D、AE/Spine 角色动画),工具测不出,靠看图}stop_motion: {detected_by: [analyze.video_understanding], desc: 定格动画(实物/黏土/纸偶逐帧拍摄),工具测不出,靠看图}- film_footage: {detected_by: [analyze.video_understanding, analyze.ocr_text_track], desc: 剪进来的电影/电视剧/短剧画面(影视解说、混剪、名场面),像素上和实拍、AI 分不开,工具只给线索(黑边版式、24/25fps 源、《》片名),靠看图}+ film_footage: {detected_by: [analyze.video_understanding], desc: 剪进来的电影/电视剧/短剧画面(影视解说、混剪、名场面),像素上和实拍、AI 分不开,工具只给线索(黑边版式、24/25fps 源),靠看图}ai_edited_footage: {detected_by: [analyze.video_understanding], desc: 实拍画面被 AI 二次加工(换脸、对口型、风格化、换装、换背景)}# ---------------------------------------------------------------- 拆分diff --git a/rea_video/classify.py b/rea_video/classify.pyindex bb14537..176b68b 100644--- a/rea_video/classify.py+++ b/rea_video/classify.py@@ -14,7 +14,7 @@ Base layer labels (what produced the moving picture of the shot):film_footage 影视片段(剪进来的电影、电视剧、短剧画面:影视解说、混剪、名场面)anim_2d / stop_motion have no pixel test yet (held frames "on twos" look like a frame-rate conversion); film_footage iscamera footage like any other, so pixels cannot tell who shot it (the tools only collect hints: letterbox, 24/25fps-source, a 《title》 on screen). Only an image reader (VLM or agent) can call these three, see UNMEASURED.+source). Only an image reader (VLM or agent) can call these three, see UNMEASURED.Overlays (composited on top): subtitle / title / label text, static graphics, layout template.Deterministic evidence is decisive for *temporal* questions (is anything moving? is the@@ -117,23 +117,17 @@ RULES = {FILM_HINT_ZH = LangDict({"letterbox": "画面嵌在上下或左右的黑边里(影视解说常见的版式)",- "source_24": "素材是 24/25fps 源(电影、电视剧的帧率;AI 视频也常是这个帧率)",- "title_mark": "画面上有《》书名号标注的片名"},+ "source_24": "素材是 24/25fps 源(电影、电视剧的帧率;AI 视频也常是这个帧率)"},en={"letterbox": "the picture sits inside black bars (the usual film-recap layout)",- "source_24": "the source is 24/25fps (the frame rate of films and TV; AI video often uses it too)",- "title_mark": "a title in 《》 brackets is on screen"})-TITLE_MARK = re.compile(r"《[^《》]{1,24}》")+ "source_24": "the source is 24/25fps (the frame rate of films and TV; AI video often uses it too)"})-def film_hints(f: dict, text: dict | None, fps: float | None, pulldown: str | None) -> list[str]:+def film_hints(f: dict, fps: float | None, pulldown: str | None) -> list[str]:"""Hints that a photographic shot was cut from a film / series. letterbox: the picture inside fixed black bars,- wider than tall (features.picture_box). source_24: a 24/25fps source, pulled up to 30 or native. title_mark: a- 《title》 on screen. source_24 alone is the AI-video signature too, so it only counts next to another hint."""+ wider than tall (features.picture_box). source_24: a 24/25fps source, pulled up to 30 or native. source_24 alone is the AI-video signature too, so it only counts next to another hint."""out = []if f.get("picture_box") and f.get("picture_aspect", 0) >= 1.3:out.append("letterbox")- if any(TITLE_MARK.search(t) for tr in (text or {}).get("tracks", []) for t in tr.get("texts", [])):- out.append("title_mark")native_film_rate = bool(fps and (23.5 <= fps <= 25.5) and f.get("dup_ratio", 1) < 0.05)if out and (pulldown in ("24→30", "24→60", "25→30?") or native_film_rate):out.append("source_24")@@ -169,9 +163,9 @@ def video_context(shots: list[dict], provenance: dict | None, fps: float | None)if f.get("dup_ratio", 1) < 0.02 and f.get("sharp_period_ac", 0) < 0.45:native_dur += dnative30 = bool(fps and 29 <= fps <= 31 and photo_dur >= 3 and native_dur / photo_dur >= 0.7)- # photographic time carrying a film / TV hint (letterbox, 《title》): a film recap or compilation looks like this+ # photographic time carrying a film / TV hint (letterbox): a film recap or compilation looks like thisfilm_dur = sum(float(r.get("duration", 0)) for r in shots- if (r.get("features") or {}).get("palette95", 0) >= 100 and film_hints(r.get("features") or {}, r.get("text"), fps, None))+ if (r.get("features") or {}).get("palette95", 0) >= 100 and film_hints(r.get("features") or {}, fps, None))total = sum(float(r.get("duration", 0)) for r in shots) or 1.0return {"transcoded": bool(plat), "platform": plat, "native30": native30,"native30_share": round(native_dur / photo_dur, 3) if photo_dur else None,@@ -359,7 +353,7 @@ def deterministic(f: dict, overlay: dict | None = None, text: dict | None = None# ---- film / TV footage hints -------------------------------------------------# who shot the picture is not in the pixels (a film still is camera footage, an AI drama can look the same):# these only say "this may be a clip cut from a film or series", the call is left to an image reader- hints = film_hints(f, text, fps, pulldown) if photo > 0.5 and family in ("dynamic", "mostly_static", "planar") else []+ hints = film_hints(f, fps, pulldown) if photo > 0.5 and family in ("dynamic", "mostly_static", "planar") else []facts["film_hints"] = hintsif hints:ev.append(T("影视片段线索:{h}。这些只说明可能是剪进来的影视剧画面,和 AI 视频、自己拍的实拍在像素上分不开,要看图确认",diff --git a/rea_video/pipeline.py b/rea_video/pipeline.pyindex 9d380f3..0039376 100644--- a/rea_video/pipeline.py+++ b/rea_video/pipeline.py@@ -246,10 +246,10 @@ def _ai_or_live_doubt(label: str, facts: dict, prov: dict, vctx: dict, seen_livereturn Nonehints = facts.get("film_hints") or []if hints and not seen:- # letterbox / 《title》 on screen: a film recap or compilation looks exactly like this, and so can an AI drama- return T("{l}还是影视片段待确认:{h};剪进来的影视剧画面和{l}在像素上分不开,需要看图(认得出的演员或剧集、片名、台标、群演和布景的规模)",+ # a letterboxed picture: a film recap or compilation looks exactly like this, and so can an AI drama+ return T("{l}还是影视片段待确认:{h};剪进来的影视剧画面和{l}在像素上分不开,需要看图(认得出的演员或剧集、台标、群演和布景的规模)","{l} or film / TV footage, to confirm: {h}; a clip cut from a film or series cannot be told from {l} by pixels, needs an image reader "- "(recognisable actors or series, a title, a channel logo, the scale of extras and sets)",+ "(recognisable actors or series, a channel logo, the scale of extras and sets)",l=LABEL_ZH[label], h=join(FILM_HINT_ZH[k] for k in hints))if label == "ai_video" and facts.get("pulldown") in PULLDOWN_24 and not (prov.get("hints") or {}).get("generator"):# a cinema / mirrorless camera shooting 24p and exported at 30 fps leaves the same cadence as a generator:@@ -574,8 +574,8 @@ def finalize(breakdown: dict, out: Path, engine: str | None = None) -> dict:" ({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)if (vctx.get("film_hint_share") or 0) > 0.3 and not any(r["base"]["label"] == "film_footage" for r in shot_records):- verdict += T("(其中 {r:.0%} 时长有影视片段线索(黑边版式、《》片名),可能是影视解说或混剪,需看图确认)",- " ({r:.0%} of the duration carries film / TV hints (letterbox layout, a 《title》), possibly a film recap or compilation, to confirm by looking)",+ verdict += T("(其中 {r:.0%} 时长有影视片段线索(黑边版式),可能是影视解说或混剪,需看图确认)",+ " ({r:.0%} of the duration carries film / TV hints (letterbox layout), possibly a film recap or compilation, to confirm by looking)",r=vctx["film_hint_share"])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)):diff --git a/rea_video/production.py b/rea_video/production.pyindex 2971d2e..772682e 100644--- a/rea_video/production.py+++ b/rea_video/production.py@@ -16,7 +16,7 @@ from pathlib import Pathimport cv2-from .classify import LABEL_ZH, TITLE_MARK+from .classify import LABEL_ZHfrom .aspects.camera import SUPPORT_ZHfrom .plan import CODE_STYLES, Planner, code_scene, shot_prompts@@ -444,17 +444,15 @@ def production_plan(b: dict, out: Path, engine: str = "seedance2.0") -> dict:def footage_runs(shots: list[dict]) -> list[dict]:- """Film / TV clips in a row, with the 《titles》 read on screen: what to look for in the source."""+ """Film / TV clips in a row: the stretches to find in the source."""runs, cur = [], []for r in shots + [None]:if r is not None and r["base"]["label"] == "film_footage":cur.append(r)continueif cur:- titles = list(dict.fromkeys(m for x in cur for tr in (x.get("text") or {}).get("tracks", [])- for t in tr.get("texts", []) for m in TITLE_MARK.findall(t)))runs.append({"shots": [x["index"] for x in cur], "start": cur[0]["start"], "end": cur[-1]["end"],- "duration": round(cur[-1]["end"] - cur[0]["start"], 3), "titles": titles[:8]})+ "duration": round(cur[-1]["end"] - cur[0]["start"], 3)})cur = []return runs@@ -622,6 +620,5 @@ def report_md(plan: dict) -> list[str]:"- These shots are cut from existing films or series: find the same clips in the source and cut them; rights belong to the studio and commercial use needs a licence. ""Without the source, shoot them yourself with the same shot size, camera setup and lighting, or approximate them with AI"), ""]for f in plan["footage"]:- L.append(f"- {f['start']:.1f}–{f['end']:.1f}s " + T("{n} 镜", "{n} shot{s}", n=len(f["shots"]), s=_s(len(f["shots"])))- + (T(",画面上的片名:{t}", ", titles on screen: {t}", t=T("、", ", ").join(f["titles"])) if f["titles"] else ""))+ L.append(f"- {f['start']:.1f}–{f['end']:.1f}s " + T("{n} 镜", "{n} shot{s}", n=len(f["shots"]), s=_s(len(f["shots"]))))return Ldiff --git a/rea_video/vlm.py b/rea_video/vlm.pyindex 1bde837..4d20fb9 100644--- a/rea_video/vlm.py+++ b/rea_video/vlm.py@@ -206,7 +206,7 @@ SHOT_PROMPT = """你是视频制作逆向工程专家。判断这个镜头的「- static_hold:静帧定格(图片或卡片停留不动)- anim_2d:2D 动画(手绘逐帧、Live2D、AE/Spine 角色动画、扁平插画风动画):线条和平涂色块、角色有骨骼或逐帧动作,常见"一拍二"(每两帧才变一次)- stop_motion:定格动画(黏土、毛毡、纸偶、乐高等实物逐帧拍摄):真实材质和灯光、动作一顿一顿、帧间轻微闪烁、指纹和纹理细节-- film_footage:剪进来的已有影视作品画面(电影、电视剧、网剧、竖屏短剧的片段,影视解说、混剪、名场面合集常见):认得出的演员或剧集、专业剧组的布光和多机位、大量群演和成套布景、片头片尾字幕、台标或平台水印、画面上的《片名》、嵌在黑边里的宽画幅+- film_footage:剪进来的已有影视作品画面(电影、电视剧、网剧、竖屏短剧的片段,影视解说、混剪、名场面合集常见):认得出的演员或剧集、专业剧组的布光和多机位、大量群演和成套布景、片头片尾字幕、台标或平台水印、嵌在黑边里的宽画幅如果画面是实拍或写实画面,再拆「怎么拍、怎么打光」(aspects 里各项),纯图形/文字/界面画面这些字段写"不适用"。@@ -217,7 +217,7 @@ SHOT_PROMPT = """你是视频制作逆向工程专家。判断这个镜头的「注意区分:卡通/3D 风格的 AI 视频(形变、闪烁、不精确)与真正的 3D 渲染(几何稳定、精确);AI 生成的写实视频与实拍(看手、文字、背景细节、物理);AI 生成的动画风视频(形变、线条游移)与真正的 2D 动画(线条稳定、按帧精确);AI 仿定格风格(材质在帧间漂移)与真正的定格动画(同一实物、光照不变、只有逐帧位移);-影视片段(剪自已有的电影/电视剧/短剧:live_action 只用于视频作者或客户自己拍的画面)与 AI 短剧(脸过于完美且千人一面、手和文字出错、群演和背景稀少、物体形变);"影视效果""剧情需要"这类免责声明和《片名》在 AI 短剧解说里也常见,不能单独作为影视片段的证据;+影视片段(剪自已有的电影/电视剧/短剧:live_action 只用于视频作者或客户自己拍的画面)与 AI 短剧(脸过于完美且千人一面、手和文字出错、群演和背景稀少、物体形变);"影视效果""剧情需要"这类免责声明在 AI 短剧解说里也常见,不能单独作为影视片段的证据;暗底发光粒子拼成的器官、人体、地球、分子等科普画面是代码渲染(粒子系统),不是 3D 实体模型,也不是 AI 视频或实拍:亮部由成千上万个点或细线组成、没有连续的明暗表面,常配 HUD 式章节牌和引线标注。代码绘制的画面没有材质纹理:大面积平滑渐变、纯色块、辉光、毛玻璃卡片、CSS 3D 翻转卡片都是代码渲染,不是 3D 渲染(3D 渲染有布料/木纹/金属等材质、有投影和物体间的光影关系);分形缩放、plasma 之类彩虹色场是着色器生成,不是实拍或 AI 视频。diff --git a/skills/rea-video/references/review.md b/skills/rea-video/references/review.mdindex a1159c7..9e749f8 100644--- a/skills/rea-video/references/review.md+++ b/skills/rea-video/references/review.md@@ -25,7 +25,7 @@ SKILL.md 第 1 节流程的补充:看图结果怎么和工具融合,以及## 影视解说、混剪:先判是不是剪进来的影视片段-画面嵌在黑边里、有《片名》、或标题写着解说 / 混剪 / 名场面时,工具会在证据里写「影视片段线索」,并把镜头标成「AI 视频还是影视片段待确认」或「实拍还是影视片段待确认」。工具测不出谁拍的,这一步要你看图:+画面嵌在黑边里时,工具会在证据里写「影视片段线索」,并把镜头标成「AI 视频还是影视片段待确认」或「实拍还是影视片段待确认」。工具测不出谁拍的,这一步要你看图:- 认得出演员或剧集、剧组规模的布光和布景、群演、台标或平台水印、清楚可读的场景文字 → `film_footage`。- 脸过于完美、不同角色长得很像、手和文字出错、纹理漂移 → `ai_video`(AI 短剧解说的版式和真人剧解说一模一样,别只看版式)。diff --git a/skills/rea-video/references/taxonomy.md b/skills/rea-video/references/taxonomy.mdindex 990006d..89cecdf 100644--- a/skills/rea-video/references/taxonomy.md+++ b/skills/rea-video/references/taxonomy.md@@ -14,7 +14,7 @@| static_hold | 静帧 | 85% 以上帧逐像素重复 | 一张图 || anim_2d | 2D 动画 | 工具测不出,只能看图:线条和平涂色块稳定、角色有骨骼或逐帧动作、常见"一拍二" | 角色设定图 + 首尾帧生成;要精确口型动作时做 AE / Live2D / Spine || stop_motion | 定格动画 | 工具测不出,只能看图:真实材质(黏土、毛毡、纸)、动作一顿一顿、帧间轻微闪烁、同一实物光照不变 | 首选真的拍(固定机位、每秒约 12 张);AI 只能近似 |-| film_footage | 影视片段 | 工具测不出,只给线索:画面嵌在黑边里、24/25fps 源、画面上有《片名》。看图看:认得出的演员或剧集、专业布光和多机位正反打、大量群演和成套布景、台标或平台水印 | 找原片对应片段再剪(版权属于片方,商用要授权);不用原片就按同样景别和打光自己拍,或 AI 近似 |+| film_footage | 影视片段 | 工具测不出,只给线索:画面嵌在黑边里、24/25fps 源。看图看:认得出的演员或剧集、专业布光和多机位正反打、大量群演和成套布景、台标或平台水印 | 找原片对应片段再剪(版权属于片方,商用要授权);不用原片就按同样景别和打光自己拍,或 AI 近似 |`anim_2d` / `stop_motion` / `film_footage` 只由看图来源判断:只有一方看图时结论标「待确认」,VLM 和 agent 都看过才去掉。@@ -110,7 +110,7 @@**影视片段 vs AI 短剧 vs 自己拍的实拍**- 影视片段:认得出的演员或剧集;专业剧组的布光(主光、轮廓光、布景里的实用光源)、景深和多机位正反打;大量群演、成套布景和道具、动作戏有替身和威亚;画面里的文字(招牌、报纸、屏幕)清楚可读;常带台标、平台水印、片头片尾字幕,或嵌在黑边里的宽画幅。-- AI 短剧:脸过于完美、不同角色长得很像;手、牙齿、文字出错;背景人物少且模糊;物体和衣服纹理在帧间漂移;镜头多是 5–10 秒的单人近景。「影视效果」「剧情需要」这类免责声明和《片名》在 AI 短剧解说里也常见,不能单独当证据。+- AI 短剧:脸过于完美、不同角色长得很像;手、牙齿、文字出错;背景人物少且模糊;物体和衣服纹理在帧间漂移;镜头多是 5–10 秒的单人近景。「影视效果」「剧情需要」这类免责声明在 AI 短剧解说里也常见,不能单独当证据。- 自己拍的实拍:口播、vlog、开箱这类作者本人或客户出镜,手机或小团队拍摄,没有剧组规模的布景和群演。- 解说类视频里如果插了作者自己的口播或 AI 画面,按镜头分别标。- 工具只开像素时会把影视片段判成「AI 视频」或「实拍」并标出「待确认」,复核时要改判。diff --git a/tests/test_film.py b/tests/test_film.pyindex d29b35a..a1958ec 100644--- a/tests/test_film.py+++ b/tests/test_film.py@@ -8,7 +8,6 @@ from rea_video.production import footage_runsPHOTO = {"noise_sigma": 0.5, "temporal_noise": 1.2, "flat_ratio": 0.02, "palette95": 220, "axis_edge_ratio": 0.2,"dup_ratio": 0.2, "dup_period": 5, "dup_regularity": 0.6, "moving_pair_ratio": 1.0, "zero_pixel_ratio": 0.1,"camera": "smooth_move", "saturation": 0.3}-TITLE = {"tracks": [{"texts": ["2026 ·《长安十二时辰》"], "text_height": 0.03}], "text_coverage": 0.02}def _letterboxed(seed: int, h: int = 852, w: int = 480, top: int = 300, ph: int = 270) -> np.ndarray:@@ -48,8 +47,8 @@ def test_intersect_box():def test_film_hints_are_evidence_not_a_verdict():f = dict(PHOTO, picture_box=[0, 0.35, 1, 0.31], picture_aspect=1.78)- probs, ev, facts = deterministic(f, text=TITLE, fps=30.0)- assert set(facts["film_hints"]) == {"letterbox", "title_mark", "source_24"}+ probs, ev, facts = deterministic(f, fps=30.0)+ assert set(facts["film_hints"]) == {"letterbox", "source_24"}assert any("影视片段线索" in e or "Film / TV footage hints" in e for e in ev)assert max(probs, key=probs.get) != "film_footage" # the tools never call it on hints aloneassert probs["film_footage"] > 0.05@@ -62,7 +61,7 @@ def test_24fps_alone_is_not_a_film_hint():def test_tool_only_run_flags_film_hints_as_to_confirm():f = dict(PHOTO, picture_box=[0, 0.35, 1, 0.31], picture_aspect=1.78)- _, _, facts = deterministic(f, text=TITLE, fps=30.0)+ _, _, facts = deterministic(f, fps=30.0)doubt = _ai_or_live_doubt("ai_video", facts, {}, {}, seen=False)assert doubt and ("影视片段" in doubt or "film / TV" in doubt)@@ -85,13 +84,12 @@ def test_video_context_film_share():assert video_context(shots, None, 30.0)["film_hint_share"] == 0.75-def test_footage_runs_collect_titles():- def shot(i, label, texts=()):- return {"index": i, "start": i, "end": i + 1, "base": {"label": label}, "text": {"tracks": [{"texts": list(texts)}]}}- runs = footage_runs([shot(1, "film_footage", ["2024 ·《庆余年》"]), shot(2, "film_footage"), shot(3, "live_action"),- shot(4, "film_footage", ["《狂飙》第 3 集"])])+def test_footage_runs_group_contiguous_film_shots():+ def shot(i, label):+ return {"index": i, "start": i, "end": i + 1, "base": {"label": label}}+ runs = footage_runs([shot(1, "film_footage"), shot(2, "film_footage"), shot(3, "live_action"), shot(4, "film_footage")])assert [r["shots"] for r in runs] == [[1, 2], [4]]- assert runs[0]["titles"] == ["《庆余年》"] and runs[1]["titles"] == ["《狂飙》"]+ assert (runs[0]["start"], runs[0]["end"]) == (1, 3)def test_reader_picks_film_over_live_action_inside_the_filmed_group():