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
Handle image paths and Windows setup
june4d98dd8dd183
diff --git a/rea_video/cli.py b/rea_video/cli.pyindex b364ead..81007d6 100644--- a/rea_video/cli.py+++ b/rea_video/cli.py@@ -240,7 +240,7 @@ def cmd_probe(args) -> int:from .media import require_tools, video_infofrom .probe import provenance- require_tools()+ require_tools(("ffprobe",))info = video_info(args.video)p = provenance(info)p.pop("tags", None) if not args.tags else Nonediff --git a/rea_video/code_remake.py b/rea_video/code_remake.pyindex f3aa59d..cdc3fd6 100644--- a/rea_video/code_remake.py+++ b/rea_video/code_remake.py@@ -21,7 +21,7 @@ from .layers import WORK_W, _boxes_at, _text_boxes, compare, layer_mask, scene_ffrom .media import extract_framefrom .packaging import fit_ass_sizes, to_assfrom .plan import code_style-from .util import read_json, write_json+from .util import read_image, read_json, write_jsonPOINT_STYLES = ("particles", "lineart") # drawn as particles on the sampled points; other styles move the cut-out@@ -90,7 +90,7 @@ def match(out: Path, spec_path: Path, rounds: int = 5) -> list[dict]:a, z = e["start"], e["end"]t = a + max(0.6 * (z - a), min(z - a, float(e.get("enter_s", 0)) + 0.05)) # past the morph inextract_frame(video, t, tmp, WORK_W)- ref = cv2.imread(str(tmp))+ ref = read_image(tmp)if ref is None:continuebx = _boxes_at(boxes, a, z)diff --git a/rea_video/layers.py b/rea_video/layers.pyindex 1e60195..dc94618 100644--- a/rea_video/layers.py+++ b/rea_video/layers.py@@ -25,7 +25,7 @@ import numpy as npfrom .features import DETAIL, halo_blurfrom .i18n import Tfrom .media import extract_frame, iter_frames, video_info-from .util import read_json, write_json+from .util import read_image, read_json, write_image, write_jsonWORK_W = 480 # measuring width; positions are written as 0-1 of the frame, so this only sets precisionGRID = (16, 9) # cells of the layout map (x, y)@@ -334,10 +334,10 @@ def scene_frames(out: Path, every: float = 0.25, n_points: int = 4000, all_shotsp = fdir / f"{sid}_{tag}.jpg"extract_frame(video, t, p, full_w)rec["frames"][tag] = f"frames/{p.name}"- full = cv2.imread(str(fdir / f"{sid}_mid.jpg"))+ full = read_image(fdir / f"{sid}_mid.jpg")if full is not None:in_scene = _boxes_at(boxes, a, z)- cv2.imwrite(str(fdir / f"{sid}_layer.png"), cutout(full, in_scene))+ write_image(fdir / f"{sid}_layer.png", cutout(full, in_scene))rec["frames"]["layer"] = f"frames/{sid}_layer.png"img = cv2.resize(full, (WORK_W, max(1, round(full.shape[0] * WORK_W / full.shape[1]))), interpolation=cv2.INTER_AREA)rec["measure"] = measure(img, in_scene)@@ -538,7 +538,7 @@ def compare(ref: str, remake: str, every: float = 0.5, out: Path | None = None,cv2.FONT_HERSHEY_SIMPLEX, 0.5, (0, 0, 255), 1, cv2.LINE_AA)cells.append(row)if cells:- cv2.imwrite(str(out / "compare_worst.jpg"), np.vstack(cells), [cv2.IMWRITE_JPEG_QUALITY, 88])+ write_image(out / "compare_worst.jpg", np.vstack(cells), [cv2.IMWRITE_JPEG_QUALITY, 88])res["sheet"] = str(out / "compare_worst.jpg")write_json(out / "compare.json", res)return resdiff --git a/rea_video/media.py b/rea_video/media.pyindex 37ef191..3b6bfb7 100644--- a/rea_video/media.py+++ b/rea_video/media.py@@ -37,8 +37,8 @@ def passthrough_args() -> list[str]:return list(_PASSTHROUGH)-def require_tools() -> None:- for tool in ("ffmpeg", "ffprobe"):+def require_tools(tools: tuple[str, ...] = ("ffmpeg", "ffprobe")) -> None:+ for tool in tools:if not shutil.which(tool):raise MediaError(f"{tool} not found on PATH")diff --git a/rea_video/redraw.py b/rea_video/redraw.pyindex 39ff3e9..fdc4f0d 100644--- a/rea_video/redraw.py+++ b/rea_video/redraw.py@@ -79,7 +79,7 @@ class Scene:self.centre = np.array(sc.get("centre", [0.5, 0.5]), np.float32) * (W, H)rng = np.random.default_rng(seed)if self.draw == "cutout":- img = cv2.imread(str(base / sc["cutout"]), cv2.IMREAD_UNCHANGED)+ img = cv2.imdecode(np.fromfile(str(base / sc["cutout"]), np.uint8), cv2.IMREAD_UNCHANGED) # any path, also non-ASCII on Windowsimg = cv2.resize(img, (W, H), interpolation=cv2.INTER_AREA)a = img[..., 3:4].astype(np.float32) / 255.0self.layer = img[..., :3].astype(np.float32) / 255.0 * a # premultiplied@@ -241,7 +241,7 @@ def main(argv: list[str] | None = None) -> int:spec = Path(a.spec)if a.frame is not None:out = Path(a.out or spec.with_name(f"frame_{a.frame:.2f}.png"))- cv2.imwrite(str(out), Redraw(spec).frame(a.frame))+ cv2.imencode(out.suffix or ".png", Redraw(spec).frame(a.frame))[1].tofile(str(out))else:if not shutil.which("ffmpeg"):raise SystemExit("ffmpeg not found")diff --git a/scripts/install_skill.sh b/scripts/install_skill.shold mode 100644new mode 100755diff --git a/skills/rea-video/references/setup.md b/skills/rea-video/references/setup.mdindex 5492b13..37f71f0 100644--- a/skills/rea-video/references/setup.md+++ b/skills/rea-video/references/setup.md@@ -8,12 +8,14 @@ pip install "rea-video[ocr] @ git+https://github.com/JuneYaooo/rea-video" #rea-video --help```-**Windows**(`install_skill.sh` 是 bash 脚本,没装 Git Bash 时手动做这三步):+**Windows**(`install_skill.sh` 是 bash 脚本,没装 Git Bash 时手动做这几步):```powershellwinget install Gyan.FFmpeg # 或 choco install ffmpeg;装完新开一个终端-pip install "rea-video[ocr] @ git+https://github.com/JuneYaooo/rea-video"-New-Item -ItemType Junction -Path "$HOME\.claude\skills\rea-video" -Target "<仓库路径>\skills\rea-video"+git clone https://github.com/JuneYaooo/rea-video; cd rea-video+pip install ".[ocr]"+New-Item -ItemType Directory -Force "$HOME\.claude\skills" | Out-Null+New-Item -ItemType Junction -Path "$HOME\.claude\skills\rea-video" -Target "$PWD\skills\rea-video"````Junction` 不需要管理员权限(`SymbolicLink` 需要);仓库路径带中文或空格不用特殊处理。`rea-video pdf` 会用 `Program Files` 或 `%LOCALAPPDATA%` 下的 Chrome / Edge,装在别处就设 `REA_CHROME`。