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
Add an English path through the docs and CLI
june6b2f689b64ce
diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.jsonindex ed8e18f..dc90264 100644--- a/.claude-plugin/plugin.json+++ b/.claude-plugin/plugin.json@@ -1,7 +1,7 @@{"name": "rea-video","version": "0.1.0",- "description": "逆向拆解视频:逐镜头判断实拍 / AI / 3D / 代码渲染 / 录屏,拆剪辑包装、声音和真实素材,给出复刻方案。",+ "description": "Reverse-engineer a video shot by shot: live action, AI, 3D, code-rendered or screen capture, plus editing, sound, real footage and a remake plan. 逆向拆解视频,给出复刻方案。","author": {"name": "June"},diff --git a/.codex-plugin/plugin.json b/.codex-plugin/plugin.jsonindex af24f45..4749e78 100644--- a/.codex-plugin/plugin.json+++ b/.codex-plugin/plugin.json@@ -1,7 +1,7 @@{"name": "rea-video","version": "0.1.0",- "description": "逆向拆解视频:逐镜头判断实拍 / AI / 3D / 代码渲染 / 录屏,拆剪辑包装、声音和真实素材,给出复刻方案;抓魔术揭秘等特殊时刻。",+ "description": "Reverse-engineer a video shot by shot: live action, AI, 3D, code-rendered or screen capture, plus editing, sound, real footage, special moments and a remake plan. 逆向拆解视频,给出复刻方案。","author": { "name": "June" },"homepage": "https://github.com/JuneYaooo/rea-video","repository": "https://github.com/JuneYaooo/rea-video",@@ -10,8 +10,8 @@"skills": "./skills/","interface": {"displayName": "rea-video",- "shortDescription": "拆解一条视频是怎么做出来的,给出复刻方案",- "longDescription": "逐镜头判断制作方式(实拍、AI 生成、3D、代码渲染、录屏等),拆字幕花字、声音和真实素材,给出复刻方案;魔术、剧情类视频还能抓出揭秘、反转、穿帮时刻,出逐帧图解和慢放。需要本机装好 rea-video CLI(bash scripts/install_skill.sh)。",+ "shortDescription": "See how a video was made and get a remake plan / 拆解视频怎么做的,给出复刻方案",+ "longDescription": "Judges each shot (live action, AI-generated, 3D, code-rendered, screen capture and more), breaks down captions, sound and real footage, and writes a remake plan. For magic and story videos it also finds reveals, twists and mistakes, with frame-by-frame strips and slow motion. Needs the rea-video CLI (bash scripts/install_skill.sh). 逐镜头判断制作方式,拆字幕、声音和真实素材,给出复刻方案。需要本机装好 rea-video CLI。","developerName": "June","category": "Productivity","capabilities": ["Interactive", "Read", "Write"],@@ -19,6 +19,7 @@"logo": "./.codex-plugin/logo.png","composerIcon": "./.codex-plugin/logo.png","defaultPrompt": [+ "Use rea-video to break down how this video was made: ~/Movies/ref.mp4","用 rea-video 拆解这条视频是怎么做的:~/Movies/ref.mp4","这条魔术视频是怎么变的?找出揭秘时刻:~/Movies/magic.mp4"]diff --git a/README.md b/README.mdindex 30f40ee..64a5159 100644--- a/README.md+++ b/README.md@@ -267,16 +267,17 @@ No. rea-video is for learning a video's structure, pacing and techniques, then r## Docs-- [docs/what-it-detects.md](docs/what-it-detects.md): everything it detects (10 visual types, camera, lighting, grade, audio)-- [docs/replicate.md](docs/replicate.md): how to remake from the report-- [docs/cases.md](docs/cases.md): details on each example-- [docs/decompose.md](docs/decompose.md): detection rules-- [docs/cli.md](docs/cli.md): CLI usage and capsule-cinema integration-- [docs/videomd.md](docs/videomd.md): VIDEO.md, the standard breakdown package that agents and downstream tools read (open format: [videomd/videomd](https://github.com/videomd/videomd))+- [docs/en/workflow.md](docs/en/workflow.md): the full path in English, from install to remake plan+- [docs/en/what-it-detects.md](docs/en/what-it-detects.md): everything it detects (10 visual types, camera, lighting, grade, audio)+- [docs/en/replicate.md](docs/en/replicate.md): how to remake from the report+- [docs/en/cases.md](docs/en/cases.md): details on each example+- [docs/en/decompose.md](docs/en/decompose.md): detection rules+- [docs/en/cli.md](docs/en/cli.md): CLI usage and capsule-cinema integration+- [docs/en/videomd.md](docs/en/videomd.md): VIDEO.md, the standard breakdown package that agents and downstream tools read (open format: [videomd/videomd](https://github.com/videomd/videomd))- [rea_video/capabilities/](rea_video/capabilities/README.md): capability tables for video / image / audio models, used to pick models for the remake plan- [eval/RESULTS.md](eval/RESULTS.md): eval results-The docs are in Chinese for now.+Run `rea-video prefs lang en` for English reports, CLI help and messages. The capability tables, eval results and agent skill are in Chinese.## Communitydiff --git a/docs/en/capsule-cinema.md b/docs/en/capsule-cinema.mdnew file mode 100644index 0000000..de867c6--- /dev/null+++ b/docs/en/capsule-cinema.md@@ -0,0 +1,27 @@+# Using capsule-cinema++`remake-run`, `assemble` and `remake` run capsule-cinema's `scripts/remake_reference.py`, and `capsule-draft` runs this package's `rea_video/integrations/to_capsule.py`. Both run in **capsule-cinema's own Python environment**, so they can import its code and read its `.env`. The interpreter is chosen in this order: `--python` (on `remake-run` and `capsule-draft`) > `$CAPSULE_CINEMA_PYTHON` > `<capsule-root>/.venv/bin/python` > the current interpreter. rea-video's own required dependencies are numpy, OpenCV, Pillow, PyYAML, videomd and onnxruntime.++```bash+CC=~/code/github/capsule-cinema # capsule-cinema repo++# 1) Decompose (VLM recommended; reuses capsule-cinema's Gemini config; add --lang en for an English report)+rea-video --env-file $CC/.env decompose ref.mp4 -o out/ref --vlm++# 2a) Generate a capsule draft (no changes to capsule-cinema's code; injects the breakdown through tool_factory)+rea-video capsule-draft out/ref/breakdown.json \+ --capsule-root $CC --capsule-name my_ref_remake # add --write-capsule to save it under capsules/++# 2b) Remake: plan from intent and model → generation jobs → capsule-cinema generates → assemble on the original timeline with a comparison video+rea-video plan out/ref --model seedance-2.5 # reads out/ref/remake/intent.yaml; final prompts go in remake/prompts.json+rea-video remake-plan out/ref/breakdown.json --capsule-root $CC+rea-video remake-run out/ref/remake/jobs.json --dry-run # inspect the jobs first+rea-video remake-run out/ref/remake/jobs.json # real calls (billed)+rea-video assemble out/ref/breakdown.json out/ref/remake/results.json+```++- Generated shots: each call of a generation unit is one job. The input type follows the plan (source reference video / one source key frame per shot / first and last frames / text only), and the prompt is the final version in `remake/prompts.json`. No jobs are written if the plan checks report errors.+- Still pan-and-zoom shots and held frames: no model call. `assemble` rebuilds them locally from the measured zoom and pan.+- Code-rendered and screen-recorded shots: the source is kept by default (`keep_original`). To rebuild them, implement the report's text tracks and layout in Remotion.+- To run part of a plan: `remake-run ... --only G2` (a generation unit), or `--only 2,5` / `--only shot_002` (the units containing those shots). If any shot produces no video, the command exits non-zero and the details are in results.json.+- If capsule-cinema isn't at the default path (`~/code/github/capsule-cinema`), set it once with `rea-video prefs capsule_root <path>`, or pass `--capsule-root` every time. `remake-run` must use the same root as `remake-plan`.diff --git a/docs/en/cases.md b/docs/en/cases.mdnew file mode 100644index 0000000..6da8429--- /dev/null+++ b/docs/en/cases.md@@ -0,0 +1,93 @@+# Cases++The 7 reports below were all generated with this version: the tool measured each video, then an AI assistant reviewed the frames shot by shot (with no vision model turned on) before the report and video package were written. In the contact sheets, each cell is one shot, and the color bar shows the production method, confidence and time. The full reports include the key takeaways, story line, shot list, remake steps, and evidence and prompts for each shot. The linked reports are in Chinese.++The sample videos in `docs/cases/videos/` were recompressed to keep the repo small. Platform marks (Douyin / TikTok / WeChat) are gone and there is an extra layer of compression. If you run them yourself, results will differ from the reports, especially with the tool alone and no visual review. To reproduce a report, use the original file downloaded from the platform.++## 1. Source vs AI remake: TikTok live action → remade with a new product++20 seconds · source 14 shots / remake 21 seconds, 8 shots++++▶ [TikTok source](../cases/videos/v11_tiktok_original.mp4) · [AI remake](../cases/videos/v12_oiioii_juicer_remake.mp4) · Full reports: [source](../cases/v11/report.md) · [remake](../cases/v12/report.md)++| | Source | AI remake |+|---|---|---|+| How it was made | All first-person phone footage with a real voice-over | All AI-generated |+| How to remake it | 1 scene, 2 camera setups | 8 shots combined into 3 Seedance 2.0 generations |+| What to prepare | The physical product | A product reference image (with a clear logo on the bottle) |++- Source: it opens with the conclusion (title "This bottle is a GAME CHANGER"), then shows each step in one cut until the drink is ready. The hands, the jars on the counter and the background stay consistent in every shot, with natural handheld shake.+- Remake: add ingredients, close the lid, blend, pour, one step per shot. The brand text on the bottle is garbled in every shot, whole fruit turns into a smoothie within half a second with no blending, and the glass changes shape three times in two seconds. These are the giveaways of generated footage.+- The remake is organized around generation: 8 shots in 3 generations, each using reference images to keep the product's look. The report states which inputs each generation needs, where they come from, and the full Chinese and English prompts.++## 2. Mixed video: AI character dialogue + code UI + real screenshots++19 seconds · 10 shots++++▶ [Source video](../cases/videos/dual_role.mp4) · [Full report](../cases/dual_role/report.md)++How it was made: code/template render 59% + AI-generated video 41%. Two AI characters talk back and forth (5 shots, in two rooms at night), intercut with 5 dark gray template segments that hold screenshots of a diagnostic report, note images and a GitHub page, each slowly pushing in. There is no music and no added sound effects.++How to remake it: generate the 5 dialogue shots in 4 calls, using two character reference images to lock their looks. Build the 5 template segments as 1 code project and swap in your own screenshots.++## 3. 3D explainer: why salted duck eggs ooze oil++66 seconds · 29 shots++++▶ [Source video](../cases/videos/salted_egg.mp4) · [Full report](../cases/salted_egg/report.md)++How it was made: all 29 shots are 3D renders. A plush monkey keeps viewers watching while a cross-section model of a duck egg explains the idea in 4 steps, turning each invisible process into a visible animated metaphor. The same cross-section model appears in 8 shots, with fur and materials stable across frames. Narration sits over library music, with 6 added sound effects on animation beats such as salt grains popping out and oil dripping.++There are two ways to remake it:++- Use a video model: 29 shots in 14 generations.+- Have an LLM write Blender or Three.js code: build the character and cross-section once and render each shot from a set camera. This gives the best consistency across angles, and changing the copy only means changing code.++## 4. Code UI motion: product promo++70 seconds · 9 shots++++▶ [Source video](../cases/videos/v10_oiioii_gen_coding_first.mp4) · [Full report](../cases/v10/report.md)++How it was made: a promo for OiiOii's "video remake" feature, made entirely of code-driven UI animation with no voice-over. It walks through the flow of uploading a hit video, rewriting it in one sentence and producing videos in batches. The AI people and products on screen are still images inside UI cards, not full-screen AI video. There is one added sound effect when particles scatter at the end.++How to remake it: no video model needed. Write 1 Remotion project, with full control of text and UI, where changing the copy only means changing data. An LLM can write it directly, and the report has a shot-by-shot motion timeline.++## 5. AI music video: a historical figure in a recording studio++164 seconds · 118 shots++++(The image shows the first 24 shots from an earlier segmentation.) ▶ [Source video](../cases/videos/qing_mv.mp4) · [Full report (118 shots)](../cases/qing_mv/report.md)++How it was made: AI-generated video 53% + digital avatar lip sync 32% + still pan and zoom 13% + code-rendered title 3%. Zeng Guofan, wearing headphones in a recording studio, sings the story of his life, with each lyric paired with a matching historical image. The opening credits name Claude as lyricist and Suno as composer. Five shots are the same finished clip used twice in the video, so a remake only generates them once.++How to remake it:++- First generate the song with Suno, following the style and rhythm.+- For the lip-sync shots in the studio, drive a digital avatar with a portrait and the vocal.+- Generate the remaining AI shots in 33 calls.+- Make the still pan-and-zoom shots locally from one image each, with no model call.++The report's "Sound" section is wrong for this video: it calls the vocal TTS narration and the music a library track, when it's actually an AI-generated song. Visual review only looks at the picture, and judging sound takes a model that can hear audio.++## 6. Live-action product video: immersive unboxing++71 seconds · 69 shots++++▶ [Source video](../cases/videos/unboxing.mp4) (Douyin creator 阿咪🍓, 720p transcode) · [Full report](../cases/unboxing/report.md)++How it was made: 99% live action. A phone is fixed on an overhead mount while a pair of hands unpacks 7 cream-colored home items on a rug. There is no voice-over. Unboxing sound recorded on set and short lines of small subtitles carry the pacing, at about one shot per second. The unboxing sounds are location audio, so they don't count as added sound effects.++How to remake it: no model needed. Use a phone and an overhead mount, lay the products flat on a light rug, and reach in from the bottom of the frame to unbox them. In post, add an upbeat library track and write subtitles in small text next to the products.diff --git a/docs/en/cli.md b/docs/en/cli.mdnew file mode 100644index 0000000..30ee778--- /dev/null+++ b/docs/en/cli.md@@ -0,0 +1,159 @@+# CLI reference++You usually don't need to type these commands: give an agent the repo and a video, and it calls them as described in [SKILL.md](../../skills/rea-video/SKILL.md). This page is for people who want to run the tool themselves or see what the agent is doing. For a guided path, start with [workflow.md](workflow.md).++## Install++Requires Python ≥ 3.10 and ffmpeg (macOS: `brew install ffmpeg`; Ubuntu: `apt install ffmpeg`).++```bash+git clone https://github.com/JuneYaooo/rea-video && cd rea-video+pip install -e ".[ocr]" # numpy / opencv / pillow / pyyaml / onnxruntime + optional OCR+rea-video --help+bash scripts/install_skill.sh # optional: installs the CLI and links the skill into the agent directories you have (~/.claude, ~/.codex, ~/.agents, ~/.gemini; ~/.claude if none exist)+```++If you install `[ocr]` by hand, the OCR dependency also installs `opencv-python`, which competes with rea-video's `opencv-python-headless` for the same `cv2` directory. Run this once afterwards (`install_skill.sh` does it for you):+`pip uninstall -y opencv-python && pip install --force-reinstall --no-deps "opencv-python-headless>=4.8,<5"`++Claude Code can also install the skill as a plugin. The CLI still needs `pip install`, and the skill checks for it first:++```text+/plugin marketplace add JuneYaooo/rea-video+/plugin install rea-video@rea-video+```++The first decompose downloads the audio separation models to `~/.cache/rea-video/models`: about 67 MB for vocals and music, and about 149 MB for sound effects. A 30-second video takes about a minute without a VLM.++Once the skill is installed, tell Claude Code, Codex or zcode something like "break down xxx.mp4 and tell me whether it's AI-made". The agent follows [SKILL.md](../../skills/rea-video/SKILL.md): check memory, decompose, review the frames, deliver from the template.++## Quick start++Reports are in Chinese by default. Add `--lang en` to `decompose`, or run `rea-video prefs lang en` once.++```bash++# 1. Deterministic forensics only (offline, free)+rea-video decompose ref.mp4 -o out/ref++# 2. Add a VLM (recommended, not required): a multimodal model looks at the frames, which improves live action / AI / 3D calls+# Any OpenAI-compatible multimodal model works; list several models as fallbacks+export REA_VLM_BASE_URL=https://.../v1 REA_VLM_API_KEY=... REA_VLM_MODEL=gemini-2.5-pro,gpt-4o+rea-video decompose ref.mp4 -o out/ref --vlm+# Or reuse capsule-cinema's config: rea-video --env-file ~/code/github/capsule-cinema/.env decompose ref.mp4 -o out/ref --vlm+# If every VLM call fails the run continues; the report and the "VLM:" line in `rea-video summary` say that all calls failed and the result is the same as no VLM+# With only a Gemini key: export GEMINI_API_KEY=... (set the model with REA_GEMINI_MODEL); special moments use Gemini's own API and send clips with sound++open out/ref/report.html++# 3. No VLM, but the agent can read images (zcode, Claude Code and other multimodal agents): let the agent act as the VLM+rea-video survey ref.mp4 -o out/ref # overview first, then close-ups: finds cuts, transitions and key frames per shot (answer, then rerun the same command until done)+rea-video decompose ref.mp4 -o out/ref # shots follow the cuts from survey+rea-video review out/ref # writes per-shot visual review tasks and an answer template+rea-video apply-review out/ref --by zcode # after the agent fills in the answers, merges them into the verdict and report++# 4. Corrections and preferences are remembered (in ~/.rea-video; change the location with REA_VIDEO_HOME)+rea-video correct out/ref --shots 3 --label still_motion --note "This is stop-motion"+rea-video prefs vlm on && rea-video prefs --note "Keep reports short"+rea-video memory++# Audio only: stems/original.wav (original), vocals.wav (dry vocals), music.wav (music), effects.wav (sound effects)+rea-video stems ref.mp4 -o out/ref+```++Audio separation uses the models below. They run on the local CPU and download on first use to `$REA_VIDEO_MODELS` (default `~/.cache/rea-video/models`):++- Vocals and music: UVR MDX-Net Inst HQ 3 (about 67 MB).+- Speakers (only with `rea-video[asr]` installed): pyannote segmentation 3.0 + 3D-Speaker CAM++ (about 35 MB together). When two or more people speak, each gets a track, `stems/voice_S1.wav` and so on, and spoken lines show who said them.+- Sound effects: BandIt v2 multilingual (about 149 MB; Watcharasupat, Wu, Orife, [arXiv 2407.07275](https://arxiv.org/abs/2407.07275), weights under CC BY-SA 4.0). It splits audio into dialogue, music and effects, and rea-video keeps the effects track. Effects in the report are found on this track and preview clips are cut from it, so they contain no vocals or music. It runs at about 1.5x the audio duration. If the model can't be downloaded, effects are detected on the mix instead.++The separation and text recognition models pick their thread count from the machine: performance cores on Apple silicon, physical cores elsewhere, capped by the cores available to the process (including container limits) and by 8. Set `REA_VIDEO_THREADS` to override it. The effect of thread count on results is below 16-bit audio precision and can be ignored.++Example output (mixed video):++```+Verdict: mixed production: code/template render 59% + AI-generated video 41%; overlays: subtitles, title (code or editor compositing)+#1 00:00.000 1.38s code/template render → R01 Remotion rebuild+#2 00:01.375 2.50s AI-generated video (24fps source, no sensor noise...) → R07 first/last-frame generation (capsule-cinema)+...+```++## Remake with capsule-cinema++```bash+CC=~/code/github/capsule-cinema # capsule-cinema repo; or set CAPSULE_CINEMA_ROOT, or run rea-video prefs capsule_root $CC once and drop --capsule-root+rea-video plan out/ref --model seedance-2.5 # builds and checks the remake plan (part two of the report) from remake/intent.yaml and the model+rea-video remake-plan out/ref/breakdown.json --capsule-root $CC # turns the plan's generation units into jobs and handoff files (not written if the checks report errors)+rea-video remake-run out/ref/remake/jobs.json # hands off to capsule-cinema to generate (billed; try --dry-run first)+rea-video assemble out/ref/breakdown.json out/ref/remake/results.json # hands off to capsule-cinema to assemble and check; add --overlays to put subtitles and styled text back on replaced shots+rea-video capsule-draft out/ref/breakdown.json --capsule-root $CC --capsule-name my_remake+```++- Stills with pan and zoom, and held frames: no model call. They are rebuilt locally from the measured zoom and pan.+- Code renders and screen recordings: the report gives the text tracks and layout for a Remotion rebuild.+- Subtitles, styled text and stickers: kept out of generation prompts. References taken from the source (reference video, key frames, first and last frames) have the text erased. Put it back after generation with `assemble --overlays`.+- `capsule-draft`: injects the breakdown through capsule-cinema's own `tool_factory` and produces a reusable recipe draft, without changing capsule-cinema's code.++See [capsule-cinema.md](capsule-cinema.md).++## Commands++| Command | What it does |+|---|---|+| `decompose VIDEO [--vlm] [--no-ocr] [--ocr-lang zh\|ja\|ko] [--lang zh\|en] [--no-packaging] [--max-vlm-shots N] [--no-asr] [--asr-lang auto\|bn] [--no-speakers] [--no-moments]` | Breaks down a video. Writes breakdown.json, report.html/md, the video package (`VIDEO.md` + `video/`), storyboard.jpg, first and last frames per shot, `packaging/` (subtitle SRT, styled ASS, packaging timeline, sticker crops) and `sfx/` (a short clip of each sound effect, playable from the report's effects table). `--lang en` puts the verdict, report, `summary` output and VLM descriptions in English (default Chinese; agents choose from the language of the request, and `rea-video prefs lang en` sets the default; the `*_zh` field names in breakdown.json stay, and their content follows the report language). `--no-packaging` skips the packaging layer (saves about 30–50 seconds per minute of video). `--ocr-lang ja` reads subtitles and styled text with a Japanese model (about 10 MB, downloaded to `$REA_VIDEO_MODELS` on first use; offline, point `$REA_OCR_REC_MODEL` at a local model), and `rea-video prefs ocr_lang ja` sets the default. `--ocr-lang ko` does the same with a Korean model (PP-OCRv5, about 14 MB) and turns off text direction classification, which misreads Korean lines as upside down. `--max-vlm-shots N` caps VLM calls (default 60); with more shots, the least certain go first and the rest rely on deterministic forensics, and the `VLM:` line says how many were sent. With the optional `rea-video[asr]`, local speech recognition runs on the dry vocals and writes timed lines to `speech.lines` and the report's script table (machine transcription, not proofread); `--no-asr` skips it. For Bengali speech add `--asr-lang bn`, which uses a Bengali model (SenseVoice doesn't support Bengali and hears it as English, Japanese or Korean; about 90 MB, downloaded to `$REA_VIDEO_MODELS` on first use), and `rea-video prefs asr_lang bn` sets the default |+| `survey VIDEO [-o OUT_DIR] [--vlm] [--no-detail] [--workers N]` | Looks before cutting. Round one lays the whole video out as a contact sheet of small cells (small cells save tokens and are only for finding cuts; the count follows the editing pace, half evenly spaced and half where the picture changes most) and asks whether each neighboring pair is the same picture, a lot of change, a hard cut, a transition or unclear. Later rounds zoom in frame by frame on transitions and unclear spots (transitions already dense enough in the overview, and unclear spots between adjacent frames, are not enlarged; this is decided from the change curve). Transition frames are sampled where change is greatest, tasks in a round can run concurrently, and there are at most three rounds. Once cuts are set, each shot gets a key-frame image (candidates for shots with a lot of action, a few cells for short shots), and the AI picks the key frames, names their kind and judges how the picture was made. Every image is filled to the size the model won't downscale (about 1568 px / 1.15 MP) with as many cells as fit. Questions and answers use JEV format: `state` holds the material, questions carry `criteria`, and answers contain only options and probabilities. Results go to `survey/timeline.json` (cuts, transition lengths, key frames per shot, shot lengths, change curve, base picture judgment per segment). decompose cuts shots from it, and the report's and package's "rhythm and key frames" come from it. Without a VLM the agent answers: the command prints the images to read and the answer files to write, then you rerun the same command. `--vlm` answers with the configured model. decompose runs it automatically when VLM is on (`--no-survey` skips it) |+| `review OUT_DIR` | Writes per-shot visual review tasks (review_tasks.json) and an answer template (review_answers.json) for an agent that can read images |+| `moments OUT_DIR [--vlm] [--no-vlm] [--redo]` | Finds special moments: magic reveals, plot twists, climaxes, continuity errors. It starts from the spoken lines, on-screen text, a whole-video contact sheet and tool candidates (a gasp, a sudden rise in voice level, fast motion that freezes; these are only hints), and picks the passages and their types. Each passage becomes a large frame-by-frame sheet, from which it picks the initial state, the method or key action, the moment of change and the reaction. If the change falls between two cells it checks frame by frame once more. Each moment is then told in 3–6 steps (the key step, the frame range of the change, a red circle when the position is certain, a zoom region, what is visible, what is inferred, why viewers missed it). The overview samples by visual change (denser where there is motion, near-identical frames merged). Results go to the report's "Special moments" section and `video/moments.md`. Each moment exports a numbered diagram with the frame-by-frame process (`M1.jpg`), a slow-motion clip of the reveal (`M1_slow_*.mp4`: only the changing part, 0.2 seconds per frame with timestamps, holding on a circled key frame), a reveal short (`M1_reveal_*.mp4`: normal speed → slowed and zoomed change → freeze → reaction), and the original clip with sound plus the source key frames (`moments/`). Without a VLM the agent answers and reruns the same command. A VLM that accepts video also gets the clip with sound. With only `GEMINI_API_KEY`, it uses Gemini's own API. decompose runs this automatically when VLM is on (about 3–5 extra calls; `--no-moments` skips it) |+| `apply-review OUT_DIR [ANSWERS] [--by NAME] [--lang zh\|en]` | Merges the agent's visual answers with the deterministic results and rewrites breakdown.json and the report. `--lang` can switch the report language at this step (verdict, evidence and report text are regenerated; descriptions and prompts already written by the VLM keep their language) |+| `correct OUT_DIR --shots N --label L [--real yes/no] [--note]` | Records a user correction: updates the verdict and report and saves it to memory (applied automatically to the same file later, and shown as a hint when reviewing similar shots) |+| `prefs [KEY VALUE] [--note TEXT]` | User preferences: default engine, whether VLM is on by default, VLM config file, reviewer name, report language (`lang zh\|en`), free-text notes for the agent |+| `memory [--export-labels YAML]` | Shows what is remembered (preferences, common corrections); exports corrections as evaluation samples |+| `probe VIDEO` | Reads metadata clues only (capture device, implicit AIGC labels, C2PA, editor signatures) |+| `summary breakdown.json` | Prints a compact verdict and marks low-confidence shots to review |+| `videomd OUT_DIR` | Regenerates the video package (`VIDEO.md` + `video/`, for models and downstream programs; format in [videomd.md](videomd.md)) from breakdown.json. decompose and apply-review do this automatically |+| `videomd OUT_DIR --check` | Validates a directory against the video package spec and lists each problem |+| `pdf OUT_DIR` | Prints report.html to report.pdf with the local Chrome / Chromium / Edge (`REA_CHROME` sets the path). Folded body text is expanded; reference data such as timelines and per-shot evidence stays folded |+| `tiles VIDEO --start --end --every [--grid]` | Builds a frame grid over a time range for close review. `--grid` draws a line every 0.1 in whole-frame coordinates, for placing the red circle on special moments |+| `frames OUT_DIR [--every 0.25] [--points 4000] [--all]` | Splits code-rendered shots into scenes (a new scene starts when the drawn elements change position or shape as a whole) and writes `frames/`: full-size first, middle and last frames per scene, `scene_XX_layer.png` (a cutout of the drawn layer with background and text removed), `points/scene_XX.json` (sample points of that layer) and `scenes.json` (base color, background glow, foreground colors, blob count, extent, centroid path over time). Works on dark and light backgrounds. decompose runs it automatically on code-rendered shots |+| `compare REF REMAKE [--scenes frames/scenes.json] [-o DIR]` | Compares the drawn layer of a remake and its source frame by frame: position, shape overlap and amount. Each side extracts foreground against its own base color, so a changed background can still be compared. Reports what to change (shift earlier or later, left or right, spread, amount, foreground and base color differences) for the whole clip, each scene and the worst frames. `-o` writes `compare.json` and a side-by-side of the worst moments, `compare_worst.jpg` |+| `drive OUT_DIR [--shots 3-7] [--depth] [--no-clean] [--prefer 10] [--max 15]` | Builds driving videos for dance and action shots: erases post-production subtitles and stickers, cuts at pauses near beats, and writes `drive/seg_XX.mp4` (silent), `seg_XX_first.jpg` (align the character image's framing and direction to it), `seg_XX_music.wav`, `segments.jpg` and a `README.md` with prompts for each route. By default it uses the plan's motion-driven units (shots marked with `performance.move` during review). `--depth` also writes depth videos (needs transformers + torch) |+| `drive OUT_DIR --join [RESULTS]` | Fits generated segments (default `drive/results.json`: `{"seg_01": path}`) to their lengths, joins them, cuts them by shot and writes `remake/mine.json`. Then run `remake` for the comparison video |+| `eval labels.yaml` | Measures accuracy and cut F1 on labeled samples |+| `capsule breakdown.json` | Exports capsule-cinema's video analysis JSON |+| `models [ID]` | Lists generation models in the capability map. With an id, prints that model's prompt format and key-frame requirements (`models keyframes` prints the general key-frame guide). Models added in `~/.rea-video/capabilities/models/*.yaml` are listed too |+| `plan OUT_DIR [--model ID] [--generate ai\|all]` | Builds part two of the report from the remake intent `remake/intent.yaml` (model, whole video or AI shots only, what to swap): generation units, inputs per call, draft prompts and plan checks. Final per-model prompts in `remake/prompts.json` are format-checked. The breakdown itself doesn't change |+| `remake-plan` | Writes the plan's generation units as jobs and handoff files |+| `remake` / `assemble` | Hand off to capsule-cinema to assemble the remake and check it |+| `remake-run JOBS [--dry-run] [--only G2\|2,5\|shot_002] [--capsule-root]` | Hands remake jobs to capsule-cinema (billed). Exits non-zero if any job produced no video |+| `capsule-draft breakdown.json` | Generates a capsule-cinema capsule draft |++## Pipeline++```+Ingest ─► Decompose ─► Video IR ─► Plan ─► Reconstruct ─► Verify ─► Remix+```++| Stage | Scope |+|---|---|+| Ingest, Decompose, Video IR (`breakdown.json`) | Available; the main body of this repo |+| Plan | Available: a remake route per shot, and capsule-cinema jobs for AI shots |+| Reconstruct | Partial: AI shots go to capsule-cinema and still pan-and-zoom shots are rebuilt locally. For code layers the tool gives text tracks and layout, and does not generate a Remotion project |+| Verify | Partial: `assemble` puts the remake together and outputs a comparison video. There is no automatic scorecard across all shots |+| Remix | Not available |++1. **Ingest**: probe, extract frames, separate audio.+2. **Decompose**: deterministic CV and a VLM split the work. CV handles exact time and position: cuts, OCR tracks, segmentation, camera motion, beats, word alignment. The VLM handles meaning: shot intent, performance, style.+3. **Video IR**: timeline → tracks → clips. Each clip is labeled with a render type (`code` / `gen` / `footage` / `audio`) and carries parameters, evidence and unknowns.+4. **Plan**: reads the [capability map](../../rea_video/capabilities/README.md), routes each generation unit to primitives and models, and outputs a Shot Recipe with cost estimates and points that need user confirmation.+5. **Reconstruct**: the code layer renders with tools such as Remotion, the generation layer calls models, the audio layer uses TTS, music and effects, and everything is composited.+6. **Verify**: checks cut alignment, OCR text consistency, layout IoU, perceptual similarity, subject consistency, motion paths, beats and lip sync, and outputs a scorecard so an agent can loop on the worst shots.+7. **Remix**: when swapping people, products, copy, language or aspect ratio, only the affected layers are re-rendered.++## Two modes++- **fidelity**: match structure, rhythm, camera, text and motion item by item, and measure the result with scores.+- **adapt**: keep the relationships that made the source work, such as the hook, reveal and rhythm, and rewrite the content for a new topic.++The two can be mixed by layer. For example, rhythm and camera can use fidelity while people and copy use adapt.++`rea-video clean-paths <dir> [--apply]`: removes local machine paths from an older breakdown package so it can be shared. By default it only reports. Paths still needed at runtime, such as generation jobs, are kept and listed.diff --git a/docs/en/decompose.md b/docs/en/decompose.mdnew file mode 100644index 0000000..f5e1621--- /dev/null+++ b/docs/en/decompose.md@@ -0,0 +1,94 @@+# Decomposition method: how a shot's production method is judged++Goal: for each shot, give the production method of the base picture, the overlays, the evidence and a confidence, then a remake route.++## 1. Labels++| Label | Meaning | Remake route (rea_video/capabilities/routing.yaml) |+|---|---|---|+| `live_action` | Live action | R07: AI image-to-video approximation, or reshoot |+| `ai_video` | AI-generated video | R07: first and last frames + prompt, generated by capsule-cinema |+| `avatar` | Digital avatar talking head | R03: voice clone + digital avatar |+| `cg_3d` | 3D render | R08: 3D modeling and rendering, or AI first/last-frame approximation |+| `code_render` | Code/template render (motion graphics, text, UI, charts, cards) | R01: Remotion/HTML rebuild |+| `screen_capture` | Screen recording/screenshot | R02: record the real interface |+| `still_motion` | Still image + pan and zoom | R17: one image + measured motion, reproduced exactly on the local machine |+| `static_hold` | Held frame | R18: one image |+| `anim_2d` | 2D animation | R19: set the character and style with an image model, then first/last-frame generation |+| `stop_motion` | Stop-motion | R20: shoot it frame by frame, or approximate with image-to-video |+| `film_footage` | Film, TV or short-drama footage cut in | R21: find and cut the matching source footage |++Overlays are listed separately: subtitles, titles, text callouts, graphic stickers, layout templates. One shot can be "AI video + code subtitles".++## 2. Where the evidence comes from++Deterministic forensics handles what can be measured, and the VLM handles what has to be understood:++| Question | Method | Reliability |+|---|---|---|+| Where are the cuts | HSV histogram distance and pixel difference with a locally adaptive threshold; the changed area must be large enough, so a popping element isn't a cut. Jump cuts / punch-ins: a one-frame jump from the same camera position, much larger than the change in surrounding frames, with stable frames on both sides; flashes and fire that brighten and recover within one or two frames aren't cuts. Cross dissolves: whether middle frames are a linear blend of the end frames, using optical flow to rule out push and pull. Transitions: each boundary gets a start and end, then is classified as fade / flash / dissolve / wipe / push / whip pan / zoom / rotate / blur / glitch / shake, with direction for wipes and pushes | High (F1 = 1.0 on two ground-truth videos, one with 14 dissolves of 0.25s) |+| Did the picture move | Share of pixel-identical repeated frames, first/last frame difference | High |+| Is it one image with pan and zoom | LK optical flow fitted to a similarity transform (RANSAC): high inlier ratio, low residual, no local motion, and almost nothing left after motion compensation | High |+| Rendered or photographed texture | Share of flat 8×8 blocks, colors needed to cover 95% of pixels, ratio of horizontal and vertical straight edges, Immerkær noise | High (separates renders from photos) |+| 2D compositing / code motion | Background pixels exactly unchanged frame to frame, with motion only in local areas | High |+| Original frame rate | Repeated-frame pattern (about 20% for 24→30, period 4–6); periodic sharpness changes from frame interpolation (weak evidence without repeated frames, since recompression can create it too); native ≥48 fps with no repeated frames | Medium-high: generation models output 24/25 fps, phones often shoot 60 fps |+| Live action, AI or 3D | Sensor and temporal noise, handheld shake, frame-rate fingerprints, plus VLM checks for flaws (fingers, text, physics, flickering texture) | Medium with deterministic evidence only, high with a VLM |+| Metadata | Capture device make/model; GB 45438 implicit AIGC labels (Label 1/2/3 and provider code); C2PA; editor/renderer signatures | Very strong when present; often stripped by platforms |+| Overlays | Edge clusters with frozen pixels over a moving background, plus OCR text tracks (position, whether it changes over time, whether it's horizontal) | Medium-high |+| Audio | Onsets/beats, share of cuts landing on onsets (beat sync), speech modulation features | Medium |++Segments joined by jump cuts come from the same footage (same camera position and background). With a VLM on, they are merged into one clip and asked about once (up to 12 seconds and 8 segments): production method and shooting style are answered once for the whole run, with a separate description and remake prompt per segment. When VLM calls are capped, the shots the tool is least certain about and the longest shots go first. Text on a shot comes straight from the whole-video OCR pass for that time range. Only when that pass is too sparse (long videos) or the packaging layer is off does it read 1–4 frames per shot based on duration.++## 2.1 Real user assets++Material sources fall into four kinds: AI-generated, rendered by the maker, real user assets, and mixed.++- **Full frame**: derived from the base picture label. Live action = live footage; screen capture = interface recording/screenshot; a held frame from a photo or screenshot = real asset.+- **Embedded** (detected only in rendered pictures):+ - A light, low-saturation panel with ≥6 small text areas in one frame → interface screenshot (confirmed real asset)+ - An area with high grayscale entropy and no flat color → image or video clip (real or AI **to be confirmed**)+ - The subtitle band is excluded from detection+- In the remake plan, real assets are listed in `user_assets`. The user provides them for the remake, and they can't be generated by a model.++## 2.2 Sound++HPSS on the STFT (median filtering to separate harmonic and percussive parts):++- **Voice**: 3–8 Hz syllable modulation in the voice band, plus pauses between lines; pitch gives a male/female hint. With several speakers, dry vocals are split by voice into one track per speaker.+- **Music**: a music bed that stays loud and tonal in the gaps between speech, or a clear beat period. BPM comes from onset autocorrelation, key from Krumhansl profiles, and section changes from chroma novelty.+- **Editing**: share of cuts landing on beats or onsets.+- **Sound effects**: the deterministic layer only offers prominent non-vocal transients as low-confidence candidates. The VLM provides the full list by listening (see measurements in eval/RESULTS.md).+- **Output**: `audio` (measurements), `audio_plan` (sound tracks and remake plan after merging the VLM), `audio.png` (timeline).++## 3. Fusion++Final probability ∝ deterministic probability^(0.6 × trust weight) × VLM probability, with two hard constraints:++- A shot with a frozen picture can't be labeled as any kind of video generation.+- A shot with rigid whole-image pan and zoom can't be labeled live action or digital avatar.++Trust weights: held frame 1.6, still pan and zoom 1.4, code render 1.0, and only 0.6 for live action, AI and 3D, so the VLM mostly decides those three.++When a visual source (VLM or agent review) takes part, the judgment has two steps. First decide how the picture came to be (generated: AI video + digital avatar; rendered: 3D + code; live action; screen recording; still image), then pick the specific label within that group. Confidence is the total probability of the group. So when "the tool says AI video, the agent says digital avatar, the VLM says live action", the first two votes count together as "generated" instead of being split and beaten by a strong "live action". With the tool alone it still takes the top specific label: the tool's avatar score is carved out of AI video, so merging them would outweigh live action (on the talking-head eval set, the measured result drops from 0.51 to 0.33).++Majority rule: when the tool's top pick agrees with exactly one of the two visual sources (same label, or same group), the verdict must stay in that group.++Other checks:+- When the tool and VLM disagree on live action vs not, and no agent has reviewed it, the shot is marked "disputed" and goes on the must-review list in `review_tasks.json`. VLMs can invent evidence that isn't visible (for example, "garbled wall clock digits" in the juicer source).+- Frame rate only says the footage has a 24 fps source: when a shot is labeled AI video with no AIGC label and the visual source says live action, it's marked "AI or 24p camera footage, to be confirmed", with confidence capped at 0.7.+- Text read by OCR that isn't in the VLM's list of post-production text (or that moves with an object in the picture) counts as text on an object, not an overlay.++## 4. Output++```+out/<name>/+ breakdown.json Video IR (rea_video.breakdown.v1): features, evidence, probabilities, overlays and remake plan per shot+ report.html/md Human-readable report (same content; HTML is rendered from Markdown): verdict → content and structure (summary, hook, structure timeline, script) → characters, scenes and props →+ sound (one card each for voice / music / effects / ambience) → shooting, lighting and editing → editing and packaging layer → remake plan (with real asset and reference lists) →+ shot list → uncertain points → appendix (folded per-shot evidence, metadata). Characters, scenes, props and script come from whole-video VLM analysis or agent review (top-level cast in review_answers.json)+ storyboard.jpg Storyboard overview (colored by production method)+ shots/ Contact sheet, first frame and last frame per shot (first and last frames are also remake inputs)+ clips/, vlm_cache/ VLM input clips and cache (--vlm only)+```++`finalize()` can reclassify from saved features and VLM answers alone: after a rule change there's no need to decode the video again, and `rea-video eval` does this automatically.diff --git a/docs/en/replicate.md b/docs/en/replicate.mdnew file mode 100644index 0000000..a4972ee--- /dev/null+++ b/docs/en/replicate.md@@ -0,0 +1,53 @@+# Remake from the report++The report's "Make it yourself" section starts by naming the type of video (talking head, tabletop / unboxing, vlog, live-action skit, AI story short, AI product ad, AI music video, digital-avatar talking head, short AI clip, 3D / animation, film commentary / montage, motion-graphics explainer, screen tutorial, stills with pan and zoom, beat-synced montage, dance / action performance). It then lists the steps in the order that type of video is usually made. The type only decides which steps exist and their order. The content of each step comes from this video:++- Shooting: the measured shot size, camera position, lighting (key direction, ratio, softness, color temperature), color, and a lighting setup derived from those measurements+- Generation: how many generation units, how many calls to which model, and the first frame and reference images for each unit+- Editing: shot count, average seconds per cut, jump cuts and punch-ins, transitions other than hard cuts+- Packaging: subtitle line count, position, color and entrance, with the subtitle timeline saved as an SRT file+- Sound: source of voice and music, BPM, key, number of sound effects+- Last step: put the finished shots back on the original timeline and output a side-by-side comparison with the source++If something wasn't measured, its step is left out. A video often mixes methods, and when another type covers a quarter of the duration, its steps are listed too. Below is how to make each kind of picture. At the end, have the agent assemble everything on the original timeline.++## Live-action shots: shoot them++1. The report gives a shooting schedule: how many scenes, how many camera setups per scene, which to shoot first, plus shot size, handheld or mounted, where the key light comes from, whether fill is needed, and a gear list. Shots from the same scene are grouped together even when they are apart in the final video.+2. After shooting, send the footage to the agent and say "cut my footage in following the shot list".+3. The agent trims each clip to the matching shot's position and length, assembles the original timeline, and outputs a side-by-side comparison so you can check the pacing. Shots you haven't filmed use the source as a placeholder, so you can shoot one scene and check it before moving on.++## AI-generated shots: use a video model++1. The report gives generation units: connected shots in the same scene are combined into one generation, with the model, the reference images to prepare (product, character), multi-shot prompts (Chinese and English), and how each generation continues from the previous one.+2. There are two ways to run them:+ - By hand: paste the unit prompt and references into a web tool such as Jimeng or Kling, then send the generated video to the agent to put back on the original timeline.+ - Automatically: with [capsule-cinema](https://github.com/JuneYaooo/capsule-cinema) installed, say "remake the AI shots with capsule-cinema". The agent calls the video model, assembles the result and outputs a comparison. Model calls cost money, so it does a free dry run first and generates only after you confirm.+3. Automatic generation runs one job for each call in a generation unit, so connected shots can share a call when the model supports it.++## Dance and action shots: drive them from the source++Dance, fight and fitness shots are about large full-body motion. Product demos, talking heads, or singing and speaking with small movements don't count; they stay in normal generation units and work with lip sync or a digital avatar. Generating from only first and last frames leaves the motion in between to the model's guess, which loses choreography and beat sync, so the report lists these shots separately as "motion-driven" instead of putting them in generation units.++1. Have the agent run `rea-video drive <report directory>`. It erases subtitles and stickers and cuts the shots at pauses near beats into segments of about 10 seconds, each with its own driving video.+2. Prepare a character sheet (front, side and back full-body views in the same outfit, plus a face close-up) and use it for every segment.+3. In most cases, use the driving video directly as a reference, with no need for depth or a blank 3D model. For a single person, full body, in one take, use Kling motion control. For several people, camera movement or cuts inside the segment, use Seedance 2.5 omni-reference. To run locally, use Wan Animate. The report picks a first choice for this video on these criteria, with prompts already written:+ - Busy source background (streets, crowds, clutter), or a new scene very different from the source: convert to a depth video (`--depth` or Video Depth Anything) first, which keeps only motion, space and camera.+ - Space and camera also need to change, or the motion will be reused: use motion capture onto a blank 3D model, set new cameras and render in Blender, then generate from that reference.+ - The facial performance matters: stay with the source as a direct reference. Depth, skeleton and blank models carry only the body, so expressions are lost.+ - The new character is chibi, an animal or a cartoon with very different proportions: use a skeleton video (DWPose + Wan VACE).+4. Send the generated segments to the agent. It runs `rea-video drive --join` to put them back on the original timeline and outputs a side-by-side comparison, so you can check beat sync against the original track.++## Code / UI motion: write code++The report gives the text, layout and motion timing of each segment. Ask the agent to "write a Remotion project from the report". After that, changing the copy only means changing data. The tool doesn't generate this project itself; the agent writes it.++## Stills with pan and zoom: generate locally++From one image and the measured zoom and pan speed, the agent generates the shot locally with no model call.++## Sound: three separate tracks++- Voice-over: the script is in the report. Use TTS or record it yourself.+- Music: find a track in a music library by BPM, key and style, or generate one with Suno.+- Sound effects: add them from the timing table.diff --git a/docs/en/videomd.md b/docs/en/videomd.mdnew file mode 100644index 0000000..cb480a8--- /dev/null+++ b/docs/en/videomd.md@@ -0,0 +1,49 @@+# The VIDEO.md package++Breaking down a video produces two things:++- **A report for people** (`report.html` / `report.pdf`): what the video is about, why it works, how it was made, and how to remake it.+- **A package for models and programs** (`VIDEO.md` + `video/`): the same conclusions in a fixed format in one directory. Agents read it to answer questions, and downstream projects read it to create remake jobs.++Every skill has a `SKILL.md`, and every video has a `VIDEO.md`. VIDEO.md is an open format. The spec, design notes, integration and generation guides, and validator live at [videomd/videomd](https://github.com/videomd/videomd), which is the source of truth. This page only covers what a rea-video package contains.++## Read it layer by layer++1. **Card** (`VIDEO.md` front matter, a few hundred tokens): what the video is about, how it was made, and how certain that is.+2. **Overview and map** (`VIDEO.md` body, about 1–2k tokens): verdict, story line, remake summary, uncertain points. The map has one file per line: `path | ~tokens | contents · when to read`.+3. **Timeline** (`video/timeline.md`): one shot per line. Keys with `~` are inferred. Keys without it are visible in the picture or measured.+4. **Shot files** (`video/shots/<id>.md`) and frames: open these only to verify a particular shot.++For a 3-minute talking-head video, reading through the overview takes about 2k tokens and adding the timeline about 4k. The full data in `breakdown.json` is about 190k tokens.++## What rea-video puts in the package++| File | Contents |+|---|---|+| `VIDEO.md` | The card has `made_mix` (production methods by share of duration), `confidence`, `readers` (tool / vision model / agent / human) and `source.sha256`. The body has the verdict, what it's about, story line, remake summary, real assets to obtain, uncertain points and the map |+| `video/timeline.md` | `story` narrative role · `seen` picture · `act` performance · `camera` camera movement · `overlay` overlays · `made~` production method · `material~` material source · `remake` remake route · `flag` needs review |+| `video/content.md` | Content and structure, story line, spoken lines |+| `video/cast.md` | Characters, scenes, props |+| `video/sound.md` | Voice, music, sound effects, beat and sources |+| `video/rhythm.md` | Rhythm and key frames: cuts per minute, shot lengths, change curve (one digit per 0.5 seconds), time and length of cuts and transitions (each time with the source frame number @N; if survey checked it, what it cut to), and key frames per shot (time + kind: first frame, action start / landing, turn, element in or out, composition change, peak expression, mid-transition and so on) |+| `video/moments.md` | Special moments (magic reveals, twists, climaxes, continuity errors), one per line: type, time of the change, the four key frames (initial state / method / change / reaction), what happened, and paths to the clip and reveal short. The next line has the explanation steps (* marks the key step) and what's visible / inferred / why viewers missed it. If moments haven't been searched yet, it says how to do it |+| `video/look.md` | Shot size, camera, lighting, editing and gear for live-action shots (when there are any) |+| `video/packaging.md` | Timing and style of subtitles, styled text, stickers and picture-in-picture |+| `video/remake.md` | Remake plan: generation units, shooting schedule, code compositing, real assets to prepare, performance and emotion |+| `video/shots/<id>.md` | Per shot: `inferred` (production method, probability, runner-up, who decided, whether it has real assets), `flags`, `keyframes` (time and kind), `frames`. The body has what's visible, inference and basis, and prompts |+| `breakdown.json`, `shots/`, `stems/`, `sfx/`, `packaging/`, `frames/` (only with code-rendered shots), `storyboard.jpg`, `audio.png` | Full data and media files, all listed in the map |++Topic files with no content aren't generated.++## Commands++```bash+rea-video decompose ref.mp4 -o out/ref # generates the package along with the breakdown+rea-video videomd out/ref # regenerates the package from breakdown.json+rea-video videomd out/ref --check # validates against the VIDEO.md spec (uses the videomd package)+```++```python+import videomd+pkg = videomd.read("out/ref") # {"card", "map", "timeline", "shots"}+```diff --git a/docs/en/what-it-detects.md b/docs/en/what-it-detects.mdnew file mode 100644index 0000000..ff12872--- /dev/null+++ b/docs/en/what-it-detects.md@@ -0,0 +1,66 @@+# What it detects++## How the picture was made++Each shot gets one of the 11 labels below. "Tool can measure" means it can be decided offline without looking at the image. The rest need a vision model or an agent to look at the frames.++| Label | Common examples | Tool can measure | Eval videos |+|---|---|---|---|+| Live action | Talking head, vlog, product demo, store visit | ✓ | 5 |+| AI-generated video | Text-to-video, image-to-video, AI short dramas | ✓ | 24 |+| Digital avatar | A portrait driven to speak by audio | Partly | 0 |+| 3D render | Blender / C4D explainers, product animation | ✓ | 14 |+| 2D animation | Hand-drawn, Live2D, After Effects character animation | ✗ needs vision | 0 |+| Stop-motion | Clay, felt or paper puppets shot frame by frame | ✗ needs vision | 0 |+| Film footage | Movie, TV or short-drama clips cut into commentary, montages or famous-scene compilations | ✗ needs vision (the tool only gives clues) | 8 |+| Code / template | Text animation, UI, charts, slide-style cards | ✓ | 16 |+| Screen recording / screenshot | Software walkthroughs, web pages | ✓ | 11 |+| Still with pan and zoom | One image with zoom and pan | ✓ | 3 |+| Held frame | An image or card that stays on screen | ✓ | 5 |++The same shot also gets separate marks for:++- Post-production overlays: subtitles, styled text, titles, stickers, layout templates. Text on objects (packaging, signs) is kept apart from subtitles where possible. See "Editing and packaging layer" below.+- Real assets: screen recordings, screenshots, photos and video clips embedded in the picture, whose original files a remake needs. Products, logos and people in AI shots are listed as reference images for the remake.+- AI edits on live action (judged visually): face swap, lip sync, restyling, AI outfit change, keying and background replacement, adding or removing objects, beauty filters. The remake plan reads "shoot first, then apply this AI edit with this model".++## How live action was shot++| Aspect | What it reports |+|---|---|+| Framing | Shot size (wide to extreme close-up), camera height, composition |+| Camera | Handheld / gimbal / tripod, push, pull, pan and track, phone or camera, slow motion / time-lapse / speed ramps |+| Lighting | Key light direction and height; lighting ratio; soft or hard light; color temperature; background blur; rim light, catch light, practical lights in frame |+| Lighting setup | 12 setups with gear lists: frontal soft light, key + fill, hard side light, backlight, night ambient, low key, high key, colored mood light (RGB / neon), product still life, direct outdoor sun, outdoor overcast, outdoor backlight |+| Color | Style (natural, teal and orange, Japanese, film, black and white, dark, high saturation) plus saturation, contrast, black level, warmth |+| Editing | Pace, jump cuts, punch-ins, share of inserts, whether cuts land on the beat |+| Format | Talking head, tabletop, handheld product demo, vlog |++Lighting ratio, softness, color temperature and color are measured from pixels. The light source, rim light, whether it's outdoors and the capture speed come from looking at the image. The report lists both sides next to each other.++## Editing and packaging layer++The whole video is analyzed on one timeline instead of shot by shot, because a subtitle or sticker often spans a cut.++| Item | How it's measured | Output |+|---|---|---|+| Subtitle timeline | OCR at 2 frames per second, tracks text line by line at the same position, then aligns start and end to about 0.1 seconds using grayscale frames at 10 fps; two-line subtitles are merged into one line | `packaging/subtitles.srt` |+| Text style | Measured from pixels: text color, outline color and width, box color, gradient, keyword highlight color (including a color change as a word is spoken), size, slant, weight | Style column in the report |+| Text type | Subtitle (lines replacing each other at one position), styled text (at least two of: large, colored, slanted, thick outline, multicolor, pop-in), title (stays at the top), text callout (chapter cards, labels that follow an object), text in the scene | Type of each text item |+| Entrance / exit | Direct, scale pop, fade, slide, character by character; bounce or color change mid-line | Report and ASS animation |+| Stickers / GIFs / picture-in-picture | A clearly bounded area that stays still over moving video; stays while everything around it changes at a cut; appears and disappears as a block mid-shot (marked "possible" on live action); moving inside on a fixed cycle means a looping GIF | Time, position and crop (`packaging/sticker_XX.jpg`). Measured recall is about half; vision fills in the rest |+| Sound effect sync | Each effect is aligned to the nearest visual event (subtitle / styled text / sticker appearing, or a cut, within ±0.2 seconds). Without a VLM, transient sounds at the moments styled text and stickers appear are added as low-confidence candidates | "Visual event" column of the effects table |++It also exports `packaging/overlays.ass` (colors, outlines, positions and pop animation; burn in directly with `ffmpeg -vf ass=` after switching to the source font) and `packaging/timeline.json`.++Pixels can't tell which font is used or what a sticker shows, so a VLM or agent fills that in by looking. In 3D, animation and layout shots, objects appear suddenly as part of the picture, so only stickers that span a cut or loop count there. The rest are listed as "picture content" and can be confirmed visually if needed. Evaluation results are in [eval/RESULTS.md](../../eval/RESULTS.md).++## Sound++- Voice: real person or AI voice, and the spoken script.+- Music: BPM, key, sections, and whether it's AI-generated or library music.+- Sound effects: the time and type of each effect, and the visual event it lands on (subtitle / styled text / sticker appearing, or a cut).++## Special moments++These are moments worth cutting out on their own: magic reveals, plot twists, climaxes and continuity errors. Finding them means understanding the content, so the side that can see (a VLM or agent) does it. It reads the spoken lines, on-screen text and a whole-video overview to pick passages, then zooms into each passage to set four key frames: initial state, method or key action, moment of change, reaction. Candidates from sound and picture (a gasp, a surprised tone, laughter, a sudden rise in voice level, fast motion that freezes) only suggest where to look. Each moment is then told in 3–6 steps. It marks the frame where the thing actually changes (often earlier than when the camera shows it or someone gasps), draws a red circle where it's certain, and separates what is visible, what is only inferred (the method, where a prop came from) and why viewers missed it. The changing part is marked frame by frame, showing how the object moved instead of suddenly appearing. Each moment exports a numbered diagram with the frame-by-frame process, a slow-motion clip of only the change (0.2 seconds per frame, with timestamps), a reveal short (normal speed → slowed and zoomed change → freeze → reaction), and the original clip with sound plus key frames. See `moments` in [cli.md](cli.md).diff --git a/docs/en/workflow.md b/docs/en/workflow.mdnew file mode 100644index 0000000..0948bdf--- /dev/null+++ b/docs/en/workflow.md@@ -0,0 +1,153 @@+# English workflow++This guide goes from install to a remake plan in English. For every command and flag, see the [CLI reference](cli.md).++## 1. Install++You need Python ≥ 3.10 and ffmpeg (macOS: `brew install ffmpeg`; Ubuntu: `apt install ffmpeg`).++```bash+pip install "rea-video[ocr] @ git+https://github.com/JuneYaooo/rea-video"+rea-video --help+```++From a clone, `bash scripts/install_skill.sh` installs the CLI and links the skill into your agent directories.++**Windows** (without Git Bash, do these steps by hand):++```powershell+winget install Gyan.FFmpeg # or: choco install ffmpeg; then open a new terminal+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` doesn't need administrator rights. `rea-video pdf` looks for Chrome or Edge under `Program Files` or `%LOCALAPPDATA%`. If yours is elsewhere, set `REA_CHROME`.++Common setup problems:++| Problem | What to do |+|---|---|+| Windows: `requires a different Python: 3.8.10 not in '>=3.10'` | Run `py -0p` to list versions, then `py -3.12 -m pip install ".[ocr]"`. If `rea-video` isn't found afterwards, run `py -3.12 -m rea_video` |+| `externally-managed-environment` | Don't use `--break-system-packages`. Run `pipx install "rea-video[ocr] @ git+https://github.com/JuneYaooo/rea-video"` or `bash scripts/install_skill.sh` |+| No matching `onnxruntime` package | Use Python 3.10–3.14: `pipx install --python python3.12 "rea-video[ocr] @ git+https://github.com/JuneYaooo/rea-video"` or `PYTHON_BIN=python3.12 bash scripts/install_skill.sh` |+| `opencv-python` conflicts with the headless build after a manual `[ocr]` install on Python ≤ 3.12 | `pip uninstall -y opencv-python && pip install --force-reinstall --no-deps "opencv-python-headless>=4.8,<5"` |++Optional local speech recognition gives you timed spoken lines when a video has no burned-in subtitles:++```bash+pip install "rea-video[ocr,asr] @ git+https://github.com/JuneYaooo/rea-video"+```++## 2. Switch to English++```bash+rea-video prefs lang en+```++This makes English the default for reports, CLI help and common errors. To get English help and errors without saving a preference, set `REA_VIDEO_LANG=en` instead. That variable doesn't change the report language, so also pass `--lang en` to `decompose`.++What stays the same in English mode:++- **Source text.** Original captions, spoken lines and other quoted text stay in the language of the video.+- **JSON keys.** Schema keys don't change. Fields such as `*_zh` in `breakdown.json` keep their names, and their content follows the report language.++## 3. Decompose++```bash+rea-video decompose ref.mp4 -o out/ref --lang en+rea-video summary out/ref/breakdown.json+```++This runs offline. A vision model (VLM) is optional but makes live action / AI / 3D calls more reliable. Any OpenAI-compatible multimodal model works:++```bash+export REA_VLM_BASE_URL=https://.../v1 REA_VLM_API_KEY=... REA_VLM_MODEL=gemini-2.5-pro+rea-video decompose ref.mp4 -o out/ref --vlm --lang en+```++You can also keep these in a file and pass `rea-video --env-file <path> decompose ...`. Check the `VLM:` line in `summary`: `ok` means it worked, `partial` means some shots got results, `failed` or `not_configured` means the run is the same as having no VLM, and `off` means it wasn't requested.++If subtitles are Japanese or Korean, add `--ocr-lang ja` or `--ocr-lang ko`. For Bengali speech, add `--asr-lang bn`.++## 4. Review and apply++The tool measures pixels, and some labels need someone to look at the frames. An agent that can read images can do this without a VLM:++```bash+rea-video review out/ref+# fill in out/ref/review_answers.json using the tasks and images in out/ref/review_tasks.json+rea-video apply-review out/ref --by your-name+rea-video summary out/ref/breakdown.json+```++- Write `evidence`, `description` and prompts in English.+- Leave `label_probs` as `{}` for shots you didn't look at. They are skipped.+- Answers are merged with the measurements instead of replacing them, so strong evidence such as frame rate and AIGC labels still counts.+- Check shots marked as disputed first, and confirm that any evidence a VLM cites is really visible.+- If you can't view the images, don't override the tool's production-method labels. List uncertain shots instead.+- If you forgot `--lang en`, run `rea-video apply-review out/ref --lang en`. Report text is regenerated, and descriptions and prompts already written by a VLM keep their language.++To correct a single shot and have the tool remember it:++```bash+rea-video correct out/ref --shots 3 --label still_motion --note "This is a slow zoom on a photo"+```++## 5. Read the report++Open `out/ref/report.html`, or make a PDF with `rea-video pdf out/ref` (needs Chrome, Chromium or Edge). The report starts with the verdict, then covers content and structure, characters and scenes, sound, shooting and editing, packaging, the remake plan, the shot list and uncertain points.++Treat "to be confirmed" as a real answer: the tool couldn't settle that point. Machine-transcribed speech is not proofread. Agents should read `VIDEO.md` and `video/` instead of the full `breakdown.json`; see [videomd.md](videomd.md). For what each label means, see [what-it-detects.md](what-it-detects.md).++## 6. Plan a remake++The breakdown and remake plan are separate. Describe what you want in `out/ref/remake/intent.yaml`:++```yaml+model: seedance-2.5+generate: ai # ai (default): generate only AI shots; all: generate every shot+swaps:+ - from: the original lipstick+ to: my insulated bottle+ image: /absolute/path/product.jpg+```++Then build the plan:++```bash+rea-video models # list models+rea-video models seedance-2.5 # prompt format and key-frame needs for one model+rea-video plan out/ref+```++If no model is set, `plan` uses your `rea-video prefs engine <id>` value, then `minimax-h3`. Draft prompts are in the report. Write the final ones to `out/ref/remake/prompts.json` as `{"G1": "..."}` and run `plan` again until its checks pass.++To generate and assemble with Capsule Cinema:++```bash+rea-video prefs capsule_root /path/to/capsule-cinema+rea-video remake-plan out/ref/breakdown.json+rea-video remake-run out/ref/remake/jobs.json --dry-run+rea-video remake-run out/ref/remake/jobs.json # billed model calls+rea-video assemble out/ref/breakdown.json out/ref/remake/results.json --overlays+```++`rea-video remake out/ref` also needs Capsule Cinema. It rebuilds still shots, cuts in any finished clips, uses the source as a placeholder for the rest, and writes per-shot progress to `remake/status.md`. Add your own clips to `remake/mine.json` as `{"results": {"<shot number>": {"video": "/absolute/path.mp4"}}}` and run it again.++Other shot types:++- **Code-rendered shots:** rebuild them with an HTML video framework, or run `rea-video code-remake out/ref` for a quick draft.+- **Dance and action shots:** run `rea-video drive out/ref`, generate from the driving videos, then run `rea-video drive out/ref --join`.++Remake options:++| Option | What it is | Requirements |+|---|---|---|+| [capsule-cinema](https://github.com/JuneYaooo/capsule-cinema) | Open-source local generation pipeline that works directly with `remake-plan` and `remake-run` | Local setup with your own models and keys; billed per model call |+| [ChatCut](https://chatcut.io/r/github-e4rd?utm_content=skill_reply) (rea-video sponsor) | AI video editor with desktop (macOS / Windows) and web versions that can remake a reference video on one timeline | Account required, no model setup. Regular editing uses your existing agent subscription; generating AI video or images needs a ChatCut membership and uses credits; remaking a reference video needs the desktop version |+| [HyperFrames](https://github.com/heygen-com/hyperframes) | Open-source HTML video framework for rebuilding code-rendered and motion-graphics shots | Node.js 22 or later; the framework is free (Apache-2.0), and its Studio app has paid plans |+| Do it yourself | Shoot and edit yourself, or generate by hand on another platform, following the report's shooting plan and shot list | rea-video is free; other platforms charge their own fees |++More detail: [replicate.md](replicate.md), [capsule-cinema.md](capsule-cinema.md).diff --git a/rea_video/cli.py b/rea_video/cli.pyindex 6473912..9d22085 100644--- a/rea_video/cli.py+++ b/rea_video/cli.py@@ -9,7 +9,7 @@ import sysfrom pathlib import Pathfrom .util import ASR_LANGS, LOG, OCR_LANGS, load_env_files, read_json, setup_logging, read_image, write_json-from .i18n import LANGS, T, set_lang+from .i18n import LANGS, T, U, set_lang, set_ui_langfrom .classify import LABELSfrom .vlm import vlm_note@@ -25,10 +25,10 @@ def _env(args) -> None:if env_file:if not Path(env_file).expanduser().is_file():# silently skipping it made people think the VLM was configured- msg = T("找不到配置文件 {p}", "env file not found: {p}", p=env_file)+ msg = U("找不到配置文件 {p}", "env file not found: {p}", p=env_file)if explicit:raise SystemExit(f"rea-video: {msg}")- LOG.warning("%s%s", msg, T("(来自 prefs env_file)", " (from prefs env_file)"))+ LOG.warning("%s%s", msg, U("(来自 prefs env_file)", " (from prefs env_file)"))files.insert(0, Path(env_file))loaded = load_env_files(files)if loaded:@@ -42,7 +42,7 @@ def _ocr_lang(args) -> None:lang = getattr(args, "ocr_lang", None) or pref("ocr_lang")if lang:if lang not in OCR_LANGS:- raise SystemExit(f"错误:不支持的 OCR 语言 {lang}(可选:{', '.join(OCR_LANGS)})")+ raise SystemExit(U(f"错误:不支持的 OCR 语言 {lang}(可选:{', '.join(OCR_LANGS)})", f"error: unsupported OCR language {lang} (choose from: {', '.join(OCR_LANGS)})"))os.environ["REA_OCR_LANG"] = lang@@ -53,7 +53,7 @@ def _asr_lang(args) -> None:lang = getattr(args, "asr_lang", None) or pref("asr_lang")if lang:if lang not in ASR_LANGS:- raise SystemExit(f"错误:不支持的语音识别语言 {lang}(可选:{', '.join(ASR_LANGS)})")+ raise SystemExit(U(f"错误:不支持的语音识别语言 {lang}(可选:{', '.join(ASR_LANGS)})", f"error: unsupported speech language {lang} (choose from: {', '.join(ASR_LANGS)})"))os.environ["REA_ASR_LANG"] = lang@@ -83,7 +83,7 @@ def cmd_decompose(args) -> int:stems = not args.no_stems and pref("stems", "on") == "on"lang = args.lang or pref("lang", "zh")if lang not in LANGS:- raise SystemExit(f"错误:不支持的报告语言 {lang}(可选:{', '.join(LANGS)})")+ raise SystemExit(U(f"错误:不支持的报告语言 {lang}(可选:{', '.join(LANGS)})", f"error: unsupported report language {lang} (choose from: {', '.join(LANGS)})"))b = decompose(args.video, out, use_vlm=use_vlm, whole_vlm=not args.no_whole, ocr=not args.no_ocr,workers=args.workers, engine=args.engine or pref("engine"), platform_meta=meta, stems=stems,packaging=not args.no_packaging, lang=lang, asr=not args.no_asr, max_shots_vlm=max(1, args.max_vlm_shots),@@ -110,15 +110,15 @@ def cmd_survey(args) -> int:cfg = VLMConfig.from_env()if cfg is None:- raise SystemExit("rea-video: --vlm 需要 VLM 配置(REA_VLM_BASE_URL / REA_VLM_API_KEY / REA_VLM_MODEL)")+ raise SystemExit(U("rea-video: --vlm 需要 VLM 配置(REA_VLM_BASE_URL / REA_VLM_API_KEY / REA_VLM_MODEL)", "rea-video: --vlm needs VLM settings (REA_VLM_BASE_URL / REA_VLM_API_KEY / REA_VLM_MODEL)"))asker = vlm_asker(VLMClient(cfg, out / "vlm_cache"), prompt_lang_note())res = run(Path(args.video).expanduser().resolve(), out.expanduser().resolve(), track, detect_shots(track), info,asker=asker, workers=args.workers, detail=not args.no_detail)if res["status"] == "waiting":- res["next"] = T("看 images 里的图,按 tasks 里的问题把答案写进 waiting 里的文件(各文件互不相关,可以并发),再运行同一条命令",+ res["next"] = U("看 images 里的图,按 tasks 里的问题把答案写进 waiting 里的文件(各文件互不相关,可以并发),再运行同一条命令","look at the images, answer the questions in tasks into the waiting files (independent: can run in parallel), then run the same command again")else:- res["next"] = T("运行 rea-video decompose(同一个 -o),镜头按这次的切点切分,关键帧和节奏写进报告",+ res["next"] = U("运行 rea-video decompose(同一个 -o),镜头按这次的切点切分,关键帧和节奏写进报告","run rea-video decompose (same -o): shots follow these cuts, key frames and rhythm go into the report")print(json.dumps(res, ensure_ascii=False, indent=1))return 0@@ -156,7 +156,7 @@ def cmd_moments(args) -> int:elif gemini.configured(): # only a Gemini key: Gemini's own API, which watches the clips with soundasker = mo.vlm_asker(gemini.GeminiClient(), prompt_lang_note())else:- raise SystemExit("rea-video: --vlm 需要 VLM 配置(REA_VLM_BASE_URL / REA_VLM_API_KEY / REA_VLM_MODEL,或 GEMINI_API_KEY)")+ raise SystemExit(U("rea-video: --vlm 需要 VLM 配置(REA_VLM_BASE_URL / REA_VLM_API_KEY / REA_VLM_MODEL,或 GEMINI_API_KEY)", "rea-video: --vlm needs VLM settings (REA_VLM_BASE_URL / REA_VLM_API_KEY / REA_VLM_MODEL, or GEMINI_API_KEY)"))res = mo.run(b, out, asker=asker)if res["status"] == "waiting":res["next"] = T("看 images 里的图,按 tasks 里的说明把答案写进 waiting 里的文件(filled 改成 true),再运行同一条命令",@@ -190,10 +190,10 @@ def cmd_review(args) -> int:if args.force or not ans_path.is_file():ans_path.write_text(dumps_rows(answers), encoding="utf-8")high = [s for s in tasks["shots"] if s["priority"] == "high"]- print(f"{len(tasks['shots'])} 个镜头待看图复核,其中 {len(high)} 个优先:" + ", ".join(f"{s['id']}({'; '.join(s['why'])})" for s in high))- print(f"说明和图片路径:{out / 'review_tasks.json'}")- print(f"把答案填进:{ans_path}")- print(f"然后运行:rea-video apply-review {out} --by <你的名字>")+ print(U(f"{len(tasks['shots'])} 个镜头待看图复核,其中 {len(high)} 个优先:", f"{len(tasks['shots'])} shots to review by eye, {len(high)} first: ") + ", ".join(f"{s['id']}({'; '.join(s['why'])})" for s in high))+ print(U("说明和图片路径:", "Instructions and image paths: ") + str(out / 'review_tasks.json'))+ print(U("把答案填进:", "Write answers to: ") + str(ans_path))+ print(U(f"然后运行:rea-video apply-review {out} --by <你的名字>", f"Then run: rea-video apply-review {out} --by <your name>"))return 0@@ -212,19 +212,19 @@ def cmd_apply_review(args) -> int:log = apply_answers(b, answers, by=args.by or pref("reviewer"))b = finalize(b, out)for p in log["problems"]:- print(f"跳过 {p}")+ print(U(f"跳过 {p}", f"skipped {p}"))if log.get("unanswered"):- print(f"没作答、已跳过 {len(log['unanswered'])} 个镜头")+ print(U(f"没作答、已跳过 {len(log['unanswered'])} 个镜头", f"skipped {len(log['unanswered'])} unanswered shots"))changed = [(r["id"], log["before"][r["id"]], r["base"]["label"]) for r in b["shots"]if r["id"] in log["before"] and log["before"][r["id"]] != r["base"]["label"]]- print(f"已并入 {len(log['applied'])}/{len(b['shots'])} 个镜头;改判 {len(changed)} 个" +- (":" + ", ".join(f"{i} {a}→{c}" for i, a, c in changed) if changed else ""))- print(f"结论: {b['summary']['verdict']}")+ print(U(f"已并入 {len(log['applied'])}/{len(b['shots'])} 个镜头;改判 {len(changed)} 个", f"merged {len(log['applied'])}/{len(b['shots'])} shots, {len(changed)} changed") ++ (U(":", ": ") + ", ".join(f"{i} {a}→{c}" for i, a, c in changed) if changed else ""))+ print(U("结论: ", "Verdict: ") + b['summary']['verdict'])print(f"VLM: {b['summary']['vlm']}")if log.get("packaging"):- print("已并入包装复核:" + ", ".join(f"{k} {n}" for k, n in log["packaging"].items()))+ print(U("已并入包装复核:", "Merged packaging review: ") + ", ".join(f"{k} {n}" for k, n in log["packaging"].items()))if not log["applied"] and not log.get("packaging") and not log["problems"]:- print("答案文件里没有可并入的镜头(先按 review_tasks.md 填 review_answers.json)")+ print(U("答案文件里没有可并入的镜头(先按 review_tasks.json 填 review_answers.json)", "no shots to merge in the answers file (fill review_answers.json following review_tasks.json first)"))return 0 if log["applied"] or log.get("packaging") else 1@@ -261,7 +261,7 @@ def cmd_eval(args) -> int:print(json.dumps(res["summary"], ensure_ascii=False, indent=2))gone = res["summary"].get("missing")if gone:- print("rea-video: " + T("只评了 {n}/{m} 个样本,其余找不到文件:{ids}", "scored {n} of {m} videos, files missing for: {ids}",+ print("rea-video: " + U("只评了 {n}/{m} 个样本,其余找不到文件:{ids}", "scored {n} of {m} videos, files missing for: {ids}",n=res["summary"]["videos"], m=res["summary"]["videos_listed"], ids=", ".join(gone)), file=sys.stderr)return 0@@ -326,7 +326,7 @@ def _capsule_root(args, check: bool = True) -> Path:root = capsule_root(args.capsule_root)if check and not root.is_dir():- raise SystemExit(T(f"找不到 capsule-cinema 仓库:{root}。用 --capsule-root 指定,或 rea-video prefs capsule_root <路径> 设成默认",+ raise SystemExit(U(f"找不到 capsule-cinema 仓库:{root}。用 --capsule-root 指定,或 rea-video prefs capsule_root <路径> 设成默认",f"capsule-cinema repo not found: {root}. Pass --capsule-root, or set it once with: rea-video prefs capsule_root <path>"))return root@@ -370,7 +370,7 @@ def _capsule_command(args, argv: list[str]) -> int:root = capsule_root(getattr(args, "capsule_root", None))script = root / "scripts" / "remake_reference.py"if not script.is_file():- raise SystemExit(T("生成、拼接和验收由 Capsule Cinema 负责,但没找到它:{r}。安装 https://github.com/JuneYaooo/capsule-cinema ,"+ raise SystemExit(U("生成、拼接和验收由 Capsule Cinema 负责,但没找到它:{r}。安装 https://github.com/JuneYaooo/capsule-cinema ,""再用 --capsule-root 指定,或运行 rea-video prefs capsule_root <路径>","Capsule Cinema does the generation, assembly and checks, but it was not found at {r}. Install ""https://github.com/JuneYaooo/capsule-cinema , then pass --capsule-root or run: rea-video prefs capsule_root <path>", r=root))@@ -409,21 +409,21 @@ def cmd_tiles(args) -> int:# bad numbers used to die deep inside numpy / PIL with a traceback, or silently print an empty resultif args.every <= 0:- raise SystemExit("rea-video: --every 必须大于 0(两次抽帧的间隔秒数)")+ raise SystemExit(U("rea-video: --every 必须大于 0(两次抽帧的间隔秒数)", "rea-video: --every must be greater than 0 (seconds between frames)"))if Path(args.video).is_dir() and (Path(args.video) / "breakdown.json").is_file():args.video = read_json(Path(args.video) / "breakdown.json")["source"]["path"] # a package: its source videoif args.start < 0:- raise SystemExit("rea-video: --start 不能小于 0")+ raise SystemExit(U("rea-video: --start 不能小于 0", "rea-video: --start cannot be negative"))if args.cols < 1:- raise SystemExit("rea-video: --cols 至少为 1")+ raise SystemExit(U("rea-video: --cols 至少为 1", "rea-video: --cols must be at least 1"))if args.max < 1:- raise SystemExit("rea-video: --max 至少为 1")+ raise SystemExit(U("rea-video: --max 至少为 1", "rea-video: --max must be at least 1"))if args.cell < 1:- raise SystemExit("rea-video: --cell 至少为 1")+ raise SystemExit(U("rea-video: --cell 至少为 1", "rea-video: --cell must be at least 1"))info = video_info(args.video)end = args.end if args.end is not None else info.durationif args.start >= end:- raise SystemExit(f"rea-video: --end 必须大于 --start(视频时长 {info.duration:.2f} 秒)")+ raise SystemExit(U(f"rea-video: --end 必须大于 --start(视频时长 {info.duration:.2f} 秒)", f"rea-video: --end must be after --start (video is {info.duration:.2f} s)"))times = list(np.arange(args.start, end, args.every))[: args.max]import tempfile@@ -466,10 +466,10 @@ def cmd_frames(args) -> int:from .layers import scene_framesif args.every <= 0:- raise SystemExit("rea-video: --every 必须大于 0")+ raise SystemExit(U("rea-video: --every 必须大于 0", "rea-video: --every must be greater than 0"))out = Path(args.out_dir)if not (out / "breakdown.json").is_file():- raise SystemExit(f"rea-video: {out} 下没有 breakdown.json,先运行 decompose")+ raise SystemExit(U(f"rea-video: {out} 下没有 breakdown.json,先运行 decompose", f"rea-video: no breakdown.json in {out}, run decompose first"))res = scene_frames(out, every=args.every, n_points=args.points, all_shots=args.all)if not res["scenes"]:print(T("没有代码渲染镜头(加 --all 对所有镜头取帧)", "no code-rendered shots (add --all to cover every shot)"))@@ -483,10 +483,10 @@ def cmd_compare(args) -> int:from .layers import compareif args.every <= 0:- raise SystemExit("rea-video: --every 必须大于 0")+ raise SystemExit(U("rea-video: --every 必须大于 0", "rea-video: --every must be greater than 0"))for p in (args.ref, args.remake):if not Path(p).is_file():- raise SystemExit(f"rea-video: 找不到 {p}")+ raise SystemExit(U(f"rea-video: 找不到 {p}", f"rea-video: not found: {p}"))res = compare(args.ref, args.remake, every=args.every, out=Path(args.out) if args.out else None,scenes=Path(args.scenes) if args.scenes else None, worst=args.worst)brief = {k: res[k] for k in ("score", "place", "shape", "offset", "advice", "worst") if k in res}@@ -502,7 +502,7 @@ def cmd_remake(args) -> int:"""The plan is rea-video's; Capsule Cinema takes it from there (stills, clips in, assembly, status, check)."""out = Path(args.out_dir).expanduser().resolve()if not (out / "breakdown.json").is_file():- raise SystemExit(f"rea-video: {out} 下没有 breakdown.json,先运行 decompose")+ raise SystemExit(U(f"rea-video: {out} 下没有 breakdown.json,先运行 decompose", f"rea-video: no breakdown.json in {out}, run decompose first"))if args.code:from .code_remake import code_remake@@ -527,7 +527,7 @@ def cmd_code_remake(args) -> int:out = Path(args.out_dir)if not (out / "breakdown.json").is_file():- raise SystemExit(f"rea-video: {out} 下没有 breakdown.json,先运行 decompose")+ raise SystemExit(U(f"rea-video: {out} 下没有 breakdown.json,先运行 decompose", f"rea-video: no breakdown.json in {out}, run decompose first"))try:res = code_remake(out, reset=args.reset, render=not args.no_render, score=not args.no_compare)except ValueError as e:@@ -542,7 +542,7 @@ def cmd_drive(args) -> int:out = Path(args.out_dir)if not (out / "breakdown.json").is_file():- raise SystemExit(f"rea-video: {out} 下没有 breakdown.json,先运行 decompose")+ raise SystemExit(U(f"rea-video: {out} 下没有 breakdown.json,先运行 decompose", f"rea-video: no breakdown.json in {out}, run decompose first"))try:if args.join is not None:res = join(out, Path(args.join) if args.join else None)@@ -684,12 +684,12 @@ def cmd_correct(args) -> int:try:logged = correct(b, label=args.label, real=real, shots=args.shots, start=args.start, end=args.end, note=args.note or "")except ValueError as e:- print(f"错误:{e}", file=sys.stderr)+ print(U(f"错误:{e}", f"error: {e}"), file=sys.stderr)return 2b = finalize(b, out)changed = [f"{c['shot']} {c['before']}→{c['label']}" for c in logged if c.get("label") and c["before"] != c["label"]]- print(f"已纠正 {len(logged)} 个镜头" + ((":" + ", ".join(changed)) if changed else "") + ",并记入记忆")- print(f"结论: {b['summary']['verdict']}")+ print(U(f"已纠正 {len(logged)} 个镜头", f"corrected {len(logged)} shots") + ((U(":", ": ") + ", ".join(changed)) if changed else "") + U(",并记入记忆", " and saved to memory"))+ print(U("结论: ", "Verdict: ") + b['summary']['verdict'])return 0@@ -717,10 +717,13 @@ def cmd_plan(args) -> int:live = {k: m for k, m in pl.models.items() if m.get("status") not in ("shutdown", "deprecated")}m = next((x for x in live.values() if _norm(x["id"]) == _norm(intent["model"]) or _norm(x.get("name", "")) == _norm(intent["model"])), None)if not m:- print(f"rea-video: 能力地图里没有 {intent['model']}。先查这个模型的官方文档(单次时长、能不能吃参考视频 / 参考图和各几个、"- f"能不能一次出多镜头、首尾帧、原生音频、提示词写法),按 {CAP / 'models' / 'video.yaml'} 的格式写进 "- f"{user_capabilities() / 'models' / (re.sub(r'[^a-z0-9.-]+', '-', intent['model'].lower()) + '.yaml')},再跑一次。"- "已有的模型:rea-video models", file=sys.stderr)+ target = user_capabilities() / 'models' / (re.sub(r'[^a-z0-9.-]+', '-', intent['model'].lower()) + '.yaml')+ print(U(f"rea-video: 能力地图里没有 {intent['model']}。先查这个模型的官方文档(单次时长、能不能吃参考视频 / 参考图和各几个、"+ f"能不能一次出多镜头、首尾帧、原生音频、提示词写法),按 {CAP / 'models' / 'video.yaml'} 的格式写进 {target},再跑一次。"+ "已有的模型:rea-video models",+ f"rea-video: {intent['model']} is not in the capability map. Check its official docs (clip length, reference videos / images and how many, "+ f"multi-shot, first and last frame, native audio, prompt style), add it to {target} in the format of {CAP / 'models' / 'video.yaml'}, "+ "and run again. Known models: rea-video models"), file=sys.stderr)return 2intent["model"] = m["id"]save_intent(out, intent)@@ -734,7 +737,7 @@ def cmd_plan(args) -> int:m=m["id"], p=b["summary"].get("production", "")))if n:print(T("原片参考 {n} 个(已擦掉字幕):{d}", "{n} source references (subtitles erased): {d}", n=n, d=out / "remake" / "refs"))- print(T("模型资料:{src},核实于 {d}", "Model facts: {src}, checked {d}", src="本地补充" if m.get("local") else "能力地图", d=v.get("date") or "?"))+ print(T("模型资料:{src},核实于 {d}", "Model facts: {src}, checked {d}", src=T("本地补充", "local addition") if m.get("local") else T("能力地图", "capability map"), d=v.get("date") or "?"))from .generation import check_linescs = plan.get("checks") or []@@ -752,47 +755,49 @@ def cmd_models(args) -> int:pl = Planner()live = {k: m for k, m in pl.models.items() if m.get("status") not in ("shutdown", "deprecated")}if not args.model:- for cat, title in (("video", "视频"), ("image", "图像(出首帧 / 关键帧)"), ("character", "人物驱动")):+ for cat, title in (("video", U("视频", "Video")), ("image", U("图像(出首帧 / 关键帧)", "Image (first / key frames)")), ("character", U("人物驱动", "Character driving"))):print(f"{title}:")for mid, m in live.items():if m["category"] == cat:lim = (m.get("limits") or {}).get("duration_s") or {}- extra = [f"≤{lim['max']:g}s" if lim.get("max") else "", "一次多镜头" if "video.multi_shot" in m["primitives"] else "",- "有提示词写法" if mid in pl.prompting else ""]+ extra = [f"≤{lim['max']:g}s" if lim.get("max") else "", U("一次多镜头", "multi-shot") if "video.multi_shot" in m["primitives"] else "",+ U("有提示词写法", "prompt guide") if mid in pl.prompting else ""]print(f" {mid:22s} {m['name']}" + (" · " + " · ".join(x for x in extra if x) if any(extra) else ""))- print("\n看某个模型的提示词写法:rea-video models <id>;关键帧通用做法:rea-video models keyframes")+ print(U("\n看某个模型的提示词写法:rea-video models <id>;关键帧通用做法:rea-video models keyframes", "\nPrompt guide for a model: rea-video models <id>; general key-frame guide: rea-video models keyframes"))return 0if args.model == "keyframes":- print("关键帧通用做法:\n" + "\n".join(f"- {x}" for x in pl.keyframe_notes))+ print(U("关键帧通用做法:\n", "General key-frame guide:\n") + "\n".join(f"- {x}" for x in pl.keyframe_notes))return 0m = next((x for x in live.values() if _norm(x["id"]) == _norm(args.model)), None)if not m:- print(f"rea-video: 能力地图里没有 {args.model};rea-video models 列出全部", file=sys.stderr)+ print(U(f"rea-video: 能力地图里没有 {args.model};rea-video models 列出全部", f"rea-video: {args.model} is not in the capability map; rea-video models lists all"), file=sys.stderr)return 2lim = m.get("limits") or {}d = lim.get("duration_s") or {}- facts = [f"单次 {d.get('min', 0):g}–{d['max']:g}s" if d.get("max") else "", "可一次多镜头" if "video.multi_shot" in m["primitives"] else "",- "首帧" if "video.i2v_first_frame" in m["primitives"] else "", "首尾帧" if "video.i2v_first_last" in m["primitives"] else "",- "多参考" if "video.multi_reference" in m["primitives"] else "", "参考视频" if "video.reference_video" in m["primitives"] else "",- "原生音频" if (m.get("audio") or {}).get("native") else ""]+ facts = [U(f"单次 {d.get('min', 0):g}–{d['max']:g}s", f"{d.get('min', 0):g}–{d['max']:g}s per clip") if d.get("max") else "", U("可一次多镜头", "multi-shot") if "video.multi_shot" in m["primitives"] else "",+ U("首帧", "first frame") if "video.i2v_first_frame" in m["primitives"] else "", U("首尾帧", "first + last frame") if "video.i2v_first_last" in m["primitives"] else "",+ U("多参考", "multi-reference") if "video.multi_reference" in m["primitives"] else "", U("参考视频", "reference video") if "video.reference_video" in m["primitives"] else "",+ U("原生音频", "native audio") if (m.get("audio") or {}).get("native") else ""]print(f"{m['id']} · {m['name']}" + (" · " + " · ".join(x for x in facts if x) if any(facts) else ""))notes = pl.prompting.get(m["id"])if not notes:- print("这个模型还没有记录提示词写法,按通用规则写。")+ print(U("这个模型还没有记录提示词写法,按通用规则写。", "No prompt guide recorded for this model yet; follow the general rules."))return 0print("\n".join(prompting_md(notes, full=True)))if m["category"] == "video":- print("\n关键帧通用做法:rea-video models keyframes")+ print(U("\n关键帧通用做法:rea-video models keyframes", "\nGeneral key-frame guide: rea-video models keyframes"))return 0def cmd_prefs(args) -> int:- from .memory import PREF_KEYS, add_note, load_prefs, remove_note, set_pref+ from .i18n import ui_lang+ from .memory import PREF_KEYS, PREF_KEYS_EN, add_note, load_prefs, remove_note, set_prefif args.key and args.value is None and "=" in args.key: # also accept `prefs key=value`args.key, args.value = args.key.split("=", 1)if args.key and args.key not in PREF_KEYS:- print(f"错误:未知偏好 {args.key}(可选:{', '.join(PREF_KEYS)};用法 rea-video prefs <key> <value>)", file=sys.stderr)+ print(U(f"错误:未知偏好 {args.key}(可选:{', '.join(PREF_KEYS)};用法 rea-video prefs <key> <value>)",+ f"error: unknown preference {args.key} (choose from: {', '.join(PREF_KEYS)}; usage: rea-video prefs <key> <value>)"), file=sys.stderr)return 2try:if args.note:@@ -807,13 +812,14 @@ def cmd_prefs(args) -> int:print(load_prefs().get(args.key, ""))return 0except ValueError as e:- print(f"错误:{e}", file=sys.stderr)+ print(U(f"错误:{e}", f"error: {e}"), file=sys.stderr)return 2prefs = load_prefs()- for k, desc in PREF_KEYS.items():- print(f"{k:<9} = {prefs.get(k, '(未设置)')} # {desc}")+ set_ui_lang(prefs.get("lang") if args.key == "lang" else ui_lang()) # `prefs lang en` answers in English right away+ for k, desc in (PREF_KEYS_EN if ui_lang() == "en" else PREF_KEYS).items():+ print(f"{k:<9} = {prefs.get(k, U('(未设置)', '(not set)'))} # {desc}")for i, n in enumerate(prefs.get("notes", []), 1):- print(f"说明 {i}: {n}")+ print(U(f"说明 {i}: {n}", f"Note {i}: {n}"))return 0@@ -822,13 +828,27 @@ def cmd_memory(args) -> int:if args.export_labels:n = export_labels(Path(args.export_labels))- print(f"已导出 {n} 条视频的纠正到 {args.export_labels}(先把 path 填好,再用 rea-video eval 评测)")+ print(U(f"已导出 {n} 条视频的纠正到 {args.export_labels}(先把 path 填好,再用 rea-video eval 评测)", f"exported corrections for {n} videos to {args.export_labels} (fill in path, then score with rea-video eval)"))return 0print("\n".join(summary_lines()))return 0+def _cli_lang(argv: list[str] | None) -> str | None:+ """CLI language: an explicit --lang, then $REA_VIDEO_LANG, then prefs lang."""+ from .memory import pref++ argv = sys.argv[1:] if argv is None else argv+ for i, a in enumerate(argv):+ if a == "--lang" and i + 1 < len(argv):+ return argv[i + 1]+ if a.startswith("--lang="):+ return a.split("=", 1)[1]+ return os.environ.get("REA_VIDEO_LANG") or pref("lang")++def main(argv: list[str] | None = None) -> int:+ set_ui_lang(_cli_lang(argv))ap = argparse.ArgumentParser(prog="rea-video", description="逆向拆解视频:逐镜头判断实拍 / AI 生成 / 代码渲染 / 混合,并生成复刻方案")ap.add_argument("-v", "--verbose", action="store_true")ap.add_argument("--env-file", help="额外的 .env(例如 capsule-cinema/.env,用于 VLM 配置)")@@ -1048,6 +1068,9 @@ def main(argv: list[str] | None = None) -> int:for sp in sub.choices.values(): # also accept `rea-video decompose x.mp4 --env-file ...`sp.add_argument("--env-file", default=argparse.SUPPRESS, help=argparse.SUPPRESS)+ from .cli_en import localize++ localize(ap, ", ".join(LABELS))args = ap.parse_args(argv)setup_logging(args.verbose)_env(args)@@ -1058,7 +1081,7 @@ def main(argv: list[str] | None = None) -> int:except MediaError as exc: # missing ffmpeg / unreadable video: one line, not a tracebackhint = ""if "not found on PATH" in str(exc):- hint = T("\n安装 ffmpeg:macOS `brew install ffmpeg`,Ubuntu/Debian `sudo apt install ffmpeg`,Windows `winget install Gyan.FFmpeg`",+ hint = U("\n安装 ffmpeg:macOS `brew install ffmpeg`,Ubuntu/Debian `sudo apt install ffmpeg`,Windows `winget install Gyan.FFmpeg`","\ninstall ffmpeg: macOS `brew install ffmpeg`, Ubuntu/Debian `sudo apt install ffmpeg`, Windows `winget install Gyan.FFmpeg`")print(f"rea-video: {exc}{hint}", file=sys.stderr)if args.verbose:@@ -1067,7 +1090,7 @@ def main(argv: list[str] | None = None) -> int:except FileNotFoundError as exc: # wrong path to a video / breakdown.json / answers fileif args.verbose:raise- print("rea-video: " + T(f"找不到文件:{exc.filename}", f"file not found: {exc.filename}"), file=sys.stderr)+ print("rea-video: " + U(f"找不到文件:{exc.filename}", f"file not found: {exc.filename}"), file=sys.stderr)return 2diff --git a/rea_video/cli_en.py b/rea_video/cli_en.pynew file mode 100644index 0000000..68bab12--- /dev/null+++ b/rea_video/cli_en.py@@ -0,0 +1,164 @@+"""English text for `rea-video --help`, keyed by command and argument dest ("decompose", "decompose.vlm")."""+from __future__ import annotations++import argparse++from .i18n import ui_lang++_CAPSULE_ROOT = "capsule-cinema repo; defaults to $CAPSULE_CINEMA_ROOT, prefs capsule_root, then ~/code/github/capsule-cinema"+_OUT_DIR = "decompose output directory"+_NO_VLM_AGENT = "no VLM this run (overrides vlm=on in prefs): write tasks for an agent that can read images"++HELP = {+ "": "Reverse-engineer a video shot by shot: live action / AI-generated / code-rendered / mixed, with a remake plan",+ "env_file": "extra .env file (for example capsule-cinema/.env, for VLM settings)",++ "decompose": "break down a video",+ "decompose.vlm": "use a vision model (VLM) to judge each shot; recommended. Without it, live action / AI / 3D are harder to tell apart",+ "decompose.no_vlm": "no VLM this run (overrides vlm=on in prefs)",+ "decompose.no_whole": "skip the whole-video structure and copy analysis",+ "decompose.no_ocr": "skip OCR (also skips the caption and text timelines, leaving sticker detection only)",+ "decompose.ocr_lang": "caption language: zh Chinese and English (default), ja Japanese, ko Korean (the last two download a model on first use); set a default with prefs ocr_lang",+ "decompose.no_packaging": "skip the edit packaging layer (caption timeline, styled text, stickers / GIFs, sound-effect sync); saves about 30-50 s per minute of video",+ "decompose.lang": "language of the report, verdict and VLM descriptions: zh (default) / en; follow the language of the request, or set a default with prefs lang",+ "decompose.max_vlm_shots": "maximum VLM calls (default 60); with more shots, the least certain go first and the rest use measured evidence only",+ "decompose.engine": "video model to plan the remake for (an id from rea-video models); defaults to prefs engine, then minimax-h3",+ "decompose.meta": 'platform metadata JSON, for example {"music": {"title": "xx", "author": "yy", "is_original": false, "popular": true}}',+ "decompose.no_asr": "skip local speech recognition (runs only with rea-video[asr]: transcribes lines and timing from the vocal stem; downloads about 160 MB on first use)",+ "decompose.asr_lang": "speech language: auto (default, SenseVoice detects Chinese / English / Japanese / Korean / Cantonese), bn Bengali (downloads about 90 MB on first use); set a default with prefs asr_lang",+ "decompose.no_speakers": "skip speaker separation (runs only with rea-video[asr]: finds who speaks when and writes stems/voice_S1.wav per speaker; downloads about 35 MB on first use)",+ "decompose.no_survey": "with VLM, skip the overview and close-up pass (use only the cut detector's cuts)",+ "decompose.no_stems": "skip voice / music separation (by default writes stems/original.wav, vocals.wav, music.wav)",+ "decompose.no_moments": "skip special moments (magic reveals, twists, climaxes, mistakes); with VLM they are searched by default, about 3-5 extra calls",++ "stems": "only split the audio into original / vocals / music tracks",+ "probe": "only show container metadata and source clues",++ "eval": "measure breakdown accuracy on a labeled sample set",+ "eval.labels": "labels.yaml",+ "eval.ocr_lang": "same as decompose --ocr-lang",+ "eval.fresh": "do not reuse existing breakdowns",+ "eval.only": "re-decompose only these ids (comma-separated); the rest reuse the cache and are reclassified",+ "eval.stems": "separate vocals on samples with audio labels and re-measure singing / speech on the clean stem",++ "capsule": "export capsule-cinema video analysis JSON (for drafting a capsule)",+ "remake-plan": "write the remake plan's generation units as capsule-cinema jobs (choose the model and swaps in rea-video plan)",+ "remake-plan.capsule_root": _CAPSULE_ROOT,+ "remake-run": "run remake-plan jobs through Capsule Cinema (billed; use --dry-run first)",+ "remake-run.jobs": "jobs.json from remake-plan",+ "remake-run.capsule_root": "must match remake-plan; same default as remake-plan",+ "remake-run.dry_run": "list jobs and parameters without calling a model",+ "remake-run.only": "run only these shots (comma-separated)",+ "remake-run.python": "capsule-cinema Python; defaults to $CAPSULE_CINEMA_PYTHON or <capsule-root>/.venv/bin/python",+ "capsule-draft": "draft a capsule-cinema capsule from a breakdown",+ "capsule-draft.capsule_root": _CAPSULE_ROOT,+ "capsule-draft.write_capsule": "write it to capsules/ in capsule-cinema",+ "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.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",++ "tiles": "tile frames over time to inspect a section closely (for agent review)",+ "tiles.focus": "zoom into part of the frame at --cell width: x0,y0,x1,y1 (0-1, full-frame coordinates); with --grid, the grid uses this region's coordinates",+ "tiles.grid": "draw a 0.1-step grid on each tile (full-frame coordinates, top-left is 0,0) for locating things",++ "frames": "split code-rendered shots into scenes and extract full-size frames, the drawn layer (matte + sample points) and base / glow / foreground colors (decompose runs this automatically)",+ "frames.out_dir": _OUT_DIR,+ "frames.every": "sampling interval in seconds (default 0.25)",+ "frames.points": "sample points per scene (default 4000)",+ "frames.all": "process all shots, not only code-rendered ones",++ "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.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)",+ "compare.out": "output directory for compare.json and compare_worst.jpg",++ "remake": "remake through Capsule Cinema: rebuild stills from their motion (code-rendered shots keep the original unless --code), cut in generated or supplied shots, keep the original elsewhere; writes the video, a comparison and per-shot progress (remake/status.md)",+ "remake.out_dir": _OUT_DIR,+ "remake.code": "draft code-rendered shots with code-remake (close for particles / data visuals; for illustrated animation use an HTML video framework such as HyperFrames)",+ "remake.no_overlays": "do not put captions / styled text back on replaced shots",+ "remake.capsule_root": _CAPSULE_ROOT,++ "code-remake": "first remake of code-rendered shots: write an editable project (code/spec.json + render.py) from each scene's sample points / matte, motion and glow, align to the original, render and score",+ "code-remake.out_dir": _OUT_DIR,+ "code-remake.reset": "regenerate spec.json (edits are kept by default)",+ "code-remake.no_render": "write the project without rendering",+ "code-remake.no_compare": "do not score after rendering",++ "drive": "driving video for dance / action shots: erase captions and stickers, cut at motion pauses (drive/seg_XX.mp4) for motion transfer or reference-video models; --join puts generated segments back on the timeline",+ "drive.out_dir": _OUT_DIR,+ "drive.shots": "only these shots, such as 3-7,9 (default: the motion-driven units in the remake plan)",+ "drive.depth": "also output a depth video (needs transformers + torch; otherwise the README gives a Video Depth Anything command)",+ "drive.no_clean": "do not erase captions and stickers",+ "drive.prefer": "ideal segment length in seconds, default 10",+ "drive.max": "maximum segment length in seconds, default 15; Kling allows up to 30",+ "drive.join": "put generated segments (default drive/results.json) back and write remake/mine.json",++ "summary": "print a compact breakdown (low-confidence shots are flagged)",+ "videomd": "regenerate the model-readable package (VIDEO.md + video/) from breakdown.json; decompose and apply-review do this automatically",+ "videomd.check": "only validate the directory against the VIDEO.md spec (https://github.com/videomd/videomd), without rewriting",+ "clean-paths": "remove local paths from older packages so they can be shared; reports only unless --apply is given",+ "clean-paths.dir": "package directory, or a parent directory with several packages",+ "clean-paths.apply": "rewrite the files",+ "pdf": "print report.html to report.pdf (with local Chrome / Chromium / Edge, all folded sections expanded)",++ "survey": "overview first, then close-ups: find cuts, transitions and key frames per shot (JEV-format Q&A); decompose cuts shots from the result",+ "survey.vlm": "answer each round with the configured VLM (tasks in a round run concurrently)",+ "survey.no_vlm": _NO_VLM_AGENT,+ "survey.no_detail": "only find cuts, without picking key frames per shot",+ "survey.workers": "VLM concurrency",++ "moments": "find special moments (magic reveals, twists, climaxes, mistakes): read the lines and overview, zoom into each section for key frames, export clips and frames",+ "moments.out_dir": _OUT_DIR,+ "moments.vlm": "answer with the configured VLM (about 3-5 calls)",+ "moments.no_vlm": _NO_VLM_AGENT,+ "moments.redo": "discard earlier answers and search again",++ "review": "let an agent that can read images act as the VLM: write per-shot review tasks and an answer template",+ "review.out_dir": _OUT_DIR,+ "review.force": "overwrite an existing review_answers.json",+ "apply-review": "merge an agent's review answers into the verdict and rewrite breakdown.json and the report",+ "apply-review.answers": "answers file (default <out_dir>/review_answers.json)",+ "apply-review.by": "reviewer name (shown in the report)",+ "apply-review.lang": "switch the report language here: verdict, evidence and report text are regenerated; descriptions and prompts already written by the VLM stay in their language",++ "correct": "record a user's correction: update this video's verdict and remember it (similar shots get a review hint later)",+ "correct.out_dir": _OUT_DIR,+ "correct.shots": "shot numbers, comma-separated (such as 3,5 or shot_003), or all for the whole video; or use --start/--end for a time range",+ "correct.label": "correct base label: {labels}",+ "correct.real": "whether the user's real material was used",+ "correct.note": 'the user\'s words or reason, for example "this is stop motion, not AI"',++ "plan": "write the remake plan for the video model the user wants (part two of the report); the breakdown does not change",+ "plan.out_dir": "breakdown directory",+ "plan.model": "model id or name, saved to remake/intent.yaml (from rea-video models; for others, look it up and add it under ~/.rea-video/capabilities/models/)",+ "plan.generate": "ai: generate only the shots that were AI in the original and write a shooting plan for live action; all: generate the whole video (full remake after swapping people or objects)",++ "models": "list generation models in the capability map; with a model id, print its prompt guide and key-frame requirements",+ "models.model": "model id (such as seedance-2.5, kling-3.0); keyframes prints the general key-frame guide",+ "prefs": "show / set preferences (default engine, VLM on or off, VLM env file, reviewer, free-text notes)",+ "prefs.note": 'add a preference note for agents, for example "keep reports short"',+ "memory": "show what is remembered: preferences and common corrections; can export them as eval samples",+}+++def localize(parser: argparse.ArgumentParser, labels: str = "") -> None:+ """Swap the parser's help text for English when the CLI language is English."""+ if ui_lang() != "en":+ return+ parser.description = HELP[""]+ for action in parser._actions:+ if isinstance(action, argparse._SubParsersAction):+ for row in action._choices_actions:+ row.help = HELP.get(row.dest, row.help)+ for name, sub in action.choices.items():+ for arg in sub._actions:+ text = HELP.get(f"{name}.{arg.dest}")+ if text and arg.help != argparse.SUPPRESS:+ arg.help = text.replace("{labels}", labels)+ elif action.dest in HELP and action.help != argparse.SUPPRESS:+ action.help = HELP[action.dest]diff --git a/rea_video/i18n.py b/rea_video/i18n.pyindex bdadc23..1579752 100644--- a/rea_video/i18n.py+++ b/rea_video/i18n.py@@ -19,6 +19,7 @@ from typing import IteratorLANGS = ("zh", "en")LANG_NAMES = {"zh": "中文", "en": "English"}_lang: contextvars.ContextVar[str] = contextvars.ContextVar("rea_video_lang", default="zh")+_ui_lang: contextvars.ContextVar[str] = contextvars.ContextVar("rea_video_ui_lang", default="zh")def set_lang(lang: str | None) -> str:@@ -39,6 +40,23 @@ def T(zh: str, en: str | None = None, **kw) -> str:return s.format(**kw) if kw else s+def set_ui_lang(lang: str | None) -> str:+ """Language of CLI help and diagnostics. Separate from the report language, so it never changes what is written."""+ lang = lang if lang in LANGS else "zh"+ _ui_lang.set(lang)+ return lang+++def ui_lang() -> str:+ return _ui_lang.get()+++def U(zh: str, en: str, **kw) -> str:+ """CLI help / diagnostic text for the current CLI language."""+ s = en if _ui_lang.get() == "en" else zh+ return s.format(**kw) if kw else s++def model_name(name: str | None) -> str | None:if not name or _lang.get() == "zh":return namediff --git a/rea_video/memory.py b/rea_video/memory.pyindex 7bee411..5f5d11f 100644--- a/rea_video/memory.py+++ b/rea_video/memory.py@@ -17,7 +17,7 @@ import timefrom pathlib import Pathfrom .classify import LABEL_ZH, LABELS, top-from .i18n import T, semi+from .i18n import T, U, semifrom .util import ASR_LANGS, OCR_LANGSPREF_KEYS = {@@ -31,6 +31,17 @@ PREF_KEYS = {"capsule_root": "capsule-cinema 仓库位置(remake-plan / remake-run / capsule-draft 的 --capsule-root;也可设 $CAPSULE_CINEMA_ROOT)","lang": "报告和结论的语言:zh(默认)/ en;agent 应按用户提问的语言选,用户明确指定时以指定为准",}+PREF_KEYS_EN = {+ "engine": "default video engine for remake plans (--engine of decompose / remake-plan)",+ "vlm": "whether decompose uses the VLM by default: on / off",+ "env_file": "default VLM env file (same as passing --env-file each time)",+ "stems": "whether decompose separates voice and music by default: on / off",+ "reviewer": "default reviewer name for apply-review",+ "ocr_lang": "caption OCR language: zh (Chinese and English, default) / ja (Japanese, downloads about 10 MB on first use) / ko (Korean, downloads about 14 MB on first use)",+ "asr_lang": "local speech recognition language: auto (SenseVoice detects Chinese / English / Japanese / Korean / Cantonese, default) / bn (Bengali, downloads about 90 MB on first use)",+ "capsule_root": "capsule-cinema repo location (--capsule-root of remake-plan / remake-run / capsule-draft; or set $CAPSULE_CINEMA_ROOT)",+ "lang": "language of reports, verdicts, CLI help and messages: zh (default) / en; agents follow the language of the request, and an explicit choice wins",+}ON_OFF = ("on", "off")HINT_MIN = 2 # a correction pattern becomes a hint once it has been seen this many times, in this many different videos# (one video corrected shot by shot says something about that video, not about the tool)@@ -56,13 +67,13 @@ def _save_prefs(prefs: dict) -> None:def set_pref(key: str, value: str | None) -> dict:if key not in PREF_KEYS:- raise ValueError(f"未知偏好 {key}(可选:{', '.join(PREF_KEYS)};自由文字偏好用 prefs --note)")+ raise ValueError(U(f"未知偏好 {key}(可选:{', '.join(PREF_KEYS)};自由文字偏好用 prefs --note)", f"unknown preference {key} (choose from: {', '.join(PREF_KEYS)}; use prefs --note for free text)"))if value is not None and key in ("vlm", "stems") and value not in ON_OFF:- raise ValueError(f"{key} 只能是 on / off")+ raise ValueError(U(f"{key} 只能是 on / off", f"{key} must be on or off"))if value is not None and key == "ocr_lang" and value not in OCR_LANGS:- raise ValueError(f"ocr_lang 只能是 {' / '.join(OCR_LANGS)}")+ raise ValueError(U(f"ocr_lang 只能是 {' / '.join(OCR_LANGS)}", f"ocr_lang must be one of: {' / '.join(OCR_LANGS)}"))if value is not None and key == "asr_lang" and value not in ASR_LANGS:- raise ValueError(f"asr_lang 只能是 {' / '.join(ASR_LANGS)}")+ raise ValueError(U(f"asr_lang 只能是 {' / '.join(ASR_LANGS)}", f"asr_lang must be one of: {' / '.join(ASR_LANGS)}"))if value is not None and key in ("env_file", "capsule_root"):value = str(Path(value).expanduser().resolve())prefs = load_prefs()@@ -87,7 +98,7 @@ def remove_note(index: int) -> dict:prefs = load_prefs()notes = prefs.get("notes", [])if not 1 <= index <= len(notes):- raise ValueError(f"没有第 {index} 条偏好说明(共 {len(notes)} 条)")+ raise ValueError(U(f"没有第 {index} 条偏好说明(共 {len(notes)} 条)", f"no preference note {index} ({len(notes)} in total)"))notes.pop(index - 1)_save_prefs(prefs)return prefs@@ -141,12 +152,12 @@ def correct(breakdown: dict, *, label: str | None = None, real: bool | None = Nostart: float | None = None, end: float | None = None, note: str = "", record: bool = True) -> list[dict]:"""Mark shots with the user's answer (rec["user"]) and log each correction. Call finalize() afterwards."""if label is not None and label not in LABELS:- raise ValueError(f"未知类别 {label}(可选:{', '.join(LABELS)})")+ raise ValueError(U(f"未知类别 {label}(可选:{', '.join(LABELS)})", f"unknown label {label} (choose from: {', '.join(LABELS)})"))if label is None and real is None:- raise ValueError("至少给出 --label 或 --real")+ raise ValueError(U("至少给出 --label 或 --real", "give at least --label or --real"))recs = _select(breakdown, shots, start, end)if not recs:- raise ValueError("没有选中任何镜头(检查 --shots / --start / --end)")+ raise ValueError(U("没有选中任何镜头(检查 --shots / --start / --end)", "no shots selected (check --shots / --start / --end)"))ctx = breakdown.get("video_context") or {}logged = []for r in recs:@@ -237,30 +248,30 @@ def hint_for(tool_label: str, pats: list[dict]) -> str | None:def summary_lines() -> list[str]:prefs = load_prefs()cs = load_corrections()- lines = [T("记忆目录: {h}", "Memory dir: {h}", h=home())]+ lines = [U("记忆目录: {h}", "Memory dir: {h}", h=home())]set_prefs = {k: v for k, v in prefs.items() if k in PREF_KEYS}- lines.append(T("偏好: ", "Preferences: ") + (T(",", ", ").join(f"{k}={v}" for k, v in set_prefs.items()) if set_prefs else T("(未设置)", "(none set)")))+ lines.append(U("偏好: ", "Preferences: ") + (U(",", ", ").join(f"{k}={v}" for k, v in set_prefs.items()) if set_prefs else U("(未设置)", "(none set)")))for i, n in enumerate(prefs.get("notes", []), 1):- lines.append(T(" 说明 {i}: {n}", " Note {i}: {n}", i=i, n=n))+ lines.append(U(" 说明 {i}: {n}", " Note {i}: {n}", i=i, n=n))if not cs:- lines.append(T("纠正: 还没有记录(用户指出判错时运行 rea-video correct)", "Corrections: none yet (run rea-video correct when the user points out a wrong call)"))+ lines.append(U("纠正: 还没有记录(用户指出判错时运行 rea-video correct)", "Corrections: none yet (run rea-video correct when the user points out a wrong call)"))return linesvideos = {c.get("video_key") for c in cs}- lines.append(T("纠正: {n} 条,涉及 {v} 条视频", "Corrections: {n} across {v} videos", n=len(cs), v=len(videos)))+ lines.append(U("纠正: {n} 条,涉及 {v} 条视频", "Corrections: {n} across {v} videos", n=len(cs), v=len(videos)))for p in patterns(cs):- extra = [T("VLM 也判错 {n}", "VLM also wrong {n}", n=p['vlm_wrong'])] if p["vlm_wrong"] else []- extra += [T("agent 复核也判错 {n}", "agent review also wrong {n}", n=p['review_wrong'])] if p["review_wrong"] else []- extra += [T("其中转码视频 {n}", "{n} transcoded", n=p['transcoded'])] if p["transcoded"] else []- lines.append(T(" 工具「{a}」→ 用户「{b}」 {c} 个镜头 / {v} 条视频", " tool \"{a}\" → user \"{b}\": {c} shots / {v} videos",+ extra = [U("VLM 也判错 {n}", "VLM also wrong {n}", n=p['vlm_wrong'])] if p["vlm_wrong"] else []+ extra += [U("agent 复核也判错 {n}", "agent review also wrong {n}", n=p['review_wrong'])] if p["review_wrong"] else []+ extra += [U("其中转码视频 {n}", "{n} transcoded", n=p['transcoded'])] if p["transcoded"] else []+ lines.append(U(" 工具「{a}」→ 用户「{b}」 {c} 个镜头 / {v} 条视频", " tool \"{a}\" → user \"{b}\": {c} shots / {v} videos",a=LABEL_ZH.get(p['tool'], p['tool']), b=LABEL_ZH[p['right']], c=p['count'], v=p['videos'])- + (T("({e})", " ({e})", e=T(",", ", ").join(extra)) if extra else ""))+ + (U("({e})", " ({e})", e=U(",", ", ").join(extra)) if extra else ""))real = [c for c in cs if c.get("real_material") is not None and c["real_material"] != c.get("real_before")]if real:- lines.append(T(" 真实素材判断被纠正 {n} 次(漏标 {m},误标 {f})", " real-material calls corrected {n} times (missed {m}, false {f})",+ lines.append(U(" 真实素材判断被纠正 {n} 次(漏标 {m},误标 {f})", " real-material calls corrected {n} times (missed {m}, false {f})",n=len(real), m=sum(1 for c in real if c['real_material']), f=sum(1 for c in real if not c['real_material'])))for c in [c for c in cs if c.get("note")][-5:]:- lines.append(T(" 备注({v} {s}): {n}", " note ({v} {s}): {n}", v=c['video'], s=c['shot'], n=c['note']))- lines.append(T("把纠正过的视频导出为评测样本:rea-video memory --export-labels eval/user_labels.yaml",+ lines.append(U(" 备注({v} {s}): {n}", " note ({v} {s}): {n}", v=c['video'], s=c['shot'], n=c['note']))+ lines.append(U("把纠正过的视频导出为评测样本:rea-video memory --export-labels eval/user_labels.yaml","Export the corrected videos as eval samples: rea-video memory --export-labels eval/user_labels.yaml"))return linesdiff --git a/rea_video/review.py b/rea_video/review.pyindex 50bb0e1..d171eb1 100644--- a/rea_video/review.py+++ b/rea_video/review.py@@ -9,6 +9,7 @@ import shleximport timefrom pathlib import Path+from .i18n import Tfrom .classify import LABEL_ZH, LABELS, topfrom . import aspects, narrative, performancefrom .narrative import ROLE_GUIDE@@ -109,16 +110,16 @@ def _priority(rec: dict, ctx: dict) -> tuple[str, list[str]]:label, conf = probs[0] if probs else ("", 1.0)why = []if conf < 0.65:- why.append(f"置信度低({conf:.0%})")+ why.append(T(f"置信度低({conf:.0%})", f"low confidence ({conf:.0%})"))if len(probs) > 1 and probs[0][1] - probs[1][1] < 0.25:- why.append(f"次选 {LABEL_ZH.get(probs[1][0], probs[1][0])} 接近({probs[1][1]:.0%})")+ why.append(T(f"次选 {LABEL_ZH.get(probs[1][0], probs[1][0])} 接近({probs[1][1]:.0%})", f"runner-up {LABEL_ZH.get(probs[1][0], probs[1][0])} is close ({probs[1][1]:.0%})"))if (rec.get("base") or {}).get("disputed"):why.append(rec["base"]["disputed"])facts = (rec.get("deterministic") or {}).get("facts", {})if label == "ai_video" and facts.get("pulldown") in ("24→30", "24→60", "25→30?"):- why.append("只有 24fps 源的帧率证据:AI 和 24p 相机实拍都会这样,看画面定")+ why.append(T("只有 24fps 源的帧率证据:AI 和 24p 相机实拍都会这样,看画面定", "the only frame-rate evidence is a 24 fps source, which fits both AI and a 24p camera: decide from the picture"))if facts.get("transcode_degraded") and label in ("ai_video", "live_action"):- why.append("平台转码,实拍/AI 待确认")+ why.append(T("平台转码,实拍/AI 待确认", "platform transcode: live action vs AI to confirm"))return ("high" if why else "normal"), why@@ -149,7 +150,7 @@ def build_tasks(breakdown: dict, out_dir: str) -> tuple[dict, dict]:from .dance import maybe_motion, move_ofif maybe_motion(rec, breakdown) and not move_of(rec):- why = why + ["长镜头、动作量大、有配乐少台词:如果大幅度的全身动作本身是看点(舞蹈、打斗、健身),填 performance.move / movers / full_body / backdrop"]+ why = why + [T("长镜头、动作量大、有配乐少台词:如果大幅度的全身动作本身是看点(舞蹈、打斗、健身),填 performance.move / movers / full_body / backdrop", "long shot with big motion, music and few lines: if large full-body movement is the point (dance, fight, fitness), fill in performance.move / movers / full_body / backdrop")]shoot_like = any(l in SHOOT_LIKE for l, _ in ranked[:2])shots.append({"id": rec["id"], "index": rec["index"], "start": rec["start"], "end": rec["end"], "duration": rec["duration"],diff --git a/skills/rea-video/SKILL.md b/skills/rea-video/SKILL.mdindex 80fbd86..0e64f95 100644--- a/skills/rea-video/SKILL.md+++ b/skills/rea-video/SKILL.md@@ -1,6 +1,6 @@---name: rea-video-description: 逆向拆解一条视频是怎么做出来的——逐镜头判断实拍 / 影视片段 / AI 生成 / 3D 渲染 / 2D 动画 / 定格动画 / 代码模板渲染 / 录屏截图 / 静态图推拉 / 静帧,以及实拍是否经过 AI 加工(换脸、对口型、风格化),标出后期叠加层(逐句字幕时间轴、花字、标题、贴纸 / GIF / 表情包、画中画)和用户真实素材,拆解人声、背景音乐、音效(卡在哪个画面事件上)与剪辑节奏,并给出可执行的复刻方案(可用 capsule-cinema、ChatCut 等复刻);也能抓魔术揭秘、反转、高潮、穿帮等特殊时刻,出逐帧图解和慢放。当用户给出参考视频、问"这条视频怎么做的 / 是不是 AI / 用了什么素材 / 怎么复刻 / 想二创或做一条同款 / 魔术怎么变的 / 抓高光"时使用。+description: 逆向拆解一条视频是怎么做出来的——逐镜头判断实拍 / 影视片段 / AI 生成 / 3D 渲染 / 2D 动画 / 定格动画 / 代码模板渲染 / 录屏截图 / 静态图推拉 / 静帧,以及实拍是否经过 AI 加工(换脸、对口型、风格化),标出后期叠加层(逐句字幕时间轴、花字、标题、贴纸 / GIF / 表情包、画中画)和用户真实素材,拆解人声、背景音乐、音效(卡在哪个画面事件上)与剪辑节奏,并给出可执行的复刻方案(可用 capsule-cinema、ChatCut 等复刻);也能抓魔术揭秘、反转、高潮、穿帮等特殊时刻,出逐帧图解和慢放。当用户给出参考视频、问"这条视频怎么做的 / 是不是 AI / 用了什么素材 / 怎么复刻 / 想二创或做一条同款 / 魔术怎么变的 / 抓高光"时使用。Use when the user shares a reference video and asks how it was made, whether it is AI, what footage it uses, how to remake it, or how a magic trick works; reply in the user's language.---# rea-video:视频制作方式逆向拆解