Compress an article into an explainer video that "hooks at the start and leaves you with something after watching". Claude acts as both director and programmer: writing the script, storyboarding, choosing the drawing method for each scene, writing the drawing code for every frame, and reworking based on screenshots; the browser and FFmpeg are only responsible for turning code into pixels and files.
Core constraints:Each frame is determined only by time t. Do not read the current time, do not use Math.random(use rng(seed)), and do not go online during rendering. Keep these three rules, and the same code renders exactly the same video every time, and changing one place affects only one place.
Pipeline
素材 ─▶ ① 解说稿 script.json ─▶ ①b 分镜表 storyboard.py【Ray 确认】
─▶ ② 配音 tts.py(Gemini 预置 / Ray 复刻音色)
─▶ ③ Whisper 校对 qa_tts.py(合格判定 + 逐字时间写入 timeline)
─▶ ③c 原声插入 splice_clips.py【有原声时】
─▶ ③b 数字人主持人 host.py(左下角口型默认带;大机位用户确认后才做)
─▶ ④ 分镜:kit 场景写 scenes.js;语法场景只写 cues
─▶ ⑤ 静帧检查 render.js sheet ─▶ ⑥ 出片 render.js video + 听感检查 audio_check.py ─▶ ⑧ 发布包 publish.py
Dedicated style mode: when Ray says he does not want a fixed style, wants a style suited to this episode's content, and wants screen recordings / real footage / screenshots, ②③ stay the same, and ④⑤⑥ switch to HyperFrames composition; see hyperframes.mdfor the process, skeleton, sourcing points, and safe areas. This mode comes with: a top bar progress indicator segmented by chapter, original audio insertion (splice_clips.py), locally generated music (gen_bgm.py / mix_bgm.py), and a small number of sound effects positioned with anchors. Moving web pages (interactive diagrams, WebGL demos) are recorded as deterministic clips against a virtual clock using scripts/record_clip.mjs .
Real footage first(Ray 2026-10-15): what viewers are willing to watch is real things; hand-drawn and code animation get aesthetically tiring after a while. For each scene, look for real material first,dynamic takes priority over static: screen recordings, actual local runs, official product demo clips, news / launch event footage, the segment being discussed in someone else's video, Ray's own videos and backend data; only after that come real screenshots, original text, and photos. Code animation does only two things: string real material together (transitions, annotations, counting, comparison), and depict abstract mechanisms that real footage cannot capture. Other people's work can be included in the final cut as citations, with "source · date" marked on screen. In the storyboard stage, write for each scene footage(what real material is used, where it comes from, whether it is dynamic),storyboard.py will list them, and it will remind you if there is too little dynamic real material in the whole video.
Two confirmation gates: the script gate (only look at the narration) and the storyboard gate (look at what each scene depicts and what drawing method is used). Both gates are before voiceover and visual writing, when changes cost nothing; pass these two gates before starting work, and you can avoid rework. When the user says "just do it", skip both gates; when they say "I've already looked at the script", only pass the storyboard gate.
Aspect ratio: vertical 1080×1920 by default (Douyin, WeChat Channels). Only output 1920×1080 when Ray wants horizontal (YouTube, WeChat Channels / Douyin horizontal):new_project.sh <slug> --landscape, i.e. script.json top-level "aspect": "landscape". One project outputs only one aspect ratio, not two versions at the same time. Horizontal can only use syntax fragments or HyperFrames mode (the hand-drawn routine uses vertical coordinates, andrender.js will reject it); there is no progress bar, subtitles are white text with black outline, and the host is a small circular window that appears only on key sentences, switching between bottom-left / bottom-right by scene (host.md"horizontal"). Dimensions, safe areas, subtitles, and host placement are all in assets/canvas.json, and each script reads from there.
The scripts are all in this skill's scripts/ Hereinafter, $SK refers to this skill directory.
0. Environment self-check
$SK/scripts/check_setup.sh
You must see READY. If GEMINI_API_KEY is missing, ask the user for a key; don't substitute another service. The output will list the registered cloned voices.
1. Read the material, write the narration script
Read the full material (clippings, candidate topic cards, existing voiceover scripts all count). When the library has Ray's recorded voiceover scripts, read one first to get a feel for the language.
$SK/scripts/new_project.sh <英文-slug> # 默认建在 ~/Movies/ray-explainer/YYYY-MM-DD-<slug>/;横屏加 --landscape
Don't put video files into the Obsidian vault: the vault has git auto-snapshots, and large files will enter the history.
Write script-rules.md according to script.json: group by scene, 1–4 sentences per scene, each sentence is one voiceover call and also one visual beat. At the top level write title、central_judgment、header(the top subtitle),theme(the color palette for the whole video, see grammars.md"Color palette for the whole video"; new projects default to "ray-ip", i.e. Ray's IP spec, see ip-style.md: write "sig": true)、voice、to_confirm。
1b. Storyboard gate
Once the script is finalized, first according to grammars.md assignthis episodeone drawing style (only one style per episode), then from style-refs.md pick a reference card to set the style (if Ray specified one, use his; if he drops a new link, extract frames and build a card according to the method there),script.json write at the top level "style_ref", then add three fields to each scene, and use this drawing style to write grammar or pattern(writing neither means a hand-drawn kit):
beat: what this scene is about, in one sentencevisual: what the visuals are, in order of appearance, written in plain languageanchors: which word triggers which visual event
python3 $SK/scripts/storyboard.py <project> # 打印分镜表并写入 storyboard.md
Paste the table as-is to the user and wait for confirmation. The user cares about three things: what each scene draws, whether the drawing style is right, and whether to merge, split, or delete a scene. Estimated duration is about 5.8 characters per second, with an error of within a few seconds. Only after confirmation do you proceed to voiceover; if the narration was changed during the storyboard stage, first change lines , then continue.
The host in the lower-left corner is part of the IP; the large camera position is not added by default. The new project template includes "host": {"avatar": "ray", "big": []}: Ray's likeness is shrunk into the lower-left corner for the whole video, and the mouth shapes change with the voiceover, without tuning video models or spending money; after step 3, run host.py once to generate the lip sync. The large camera position (gesture videos generated by MiniMax H3, which costs money) is still not added by default: when pasting the storyboard table, attach the line "Should this one add the large camera position?"; only if the user explicitly asks to add it, mark the sentences according to host.md , give an estimate first, and generate after agreement.
2. Voiceover
python3 -I $SK/scripts/tts.py <project>
The overall loudness of the narration is unified to −21 LUFS (the cloud version level approved by Ray; original audio clips are cut at −17); it's the same no matter which voice is used, no need to adjust manually; if you want to change it, write script.json in "loudness"。
Choose a voice(script.json of "voice"):
voices.jsona name registered in"ray": Ray's cloned voice, directly calls the MiniMax API'sspeech-2.8-hd(scripts/minimax_api.py, requiresMINIMAX_API_KEY; the key for the domestic platform platform.minimax.cn is set separately asMINIMAX_API_HOST=https://api.minimax.cn; domestic accounts have a low default requests-per-minute tier and occasionally hit 1002 rate limiting, and tts.py will automatically back off and retry), about 0.1 USD per thousand characters.modelOld entries infal-ai/that start with1.1(set by Ray on 2026-10-13)."ray-local": local cloned voice, goes through VoxCPM2 (mlx-community/VoxCPM2-8bit, MLX 8bit; 2026-10-14 two rounds of blind listening, won 9 out of 12 sentences against MiniMax), costs nothing, and the samples never leave the local machine.voices.jsonThe entry says"provider": "voxcpm2", record the model directory (the model is about 3 GB and can be put on an external drive, such as/Volumes/<盘名>/ai-models/VoxCPM2-8bit; if the drive is not mounted it will report an error directly), reference clips,cfg3.0、takes3. Each sentence is synthesized 3 times, and Whisper picks the take closest to the script (VoxCPM2 outputs differently each time; common problems are English words being mispronounced and the first word of a sentence being swallowed). It cannot adjust speed directly; it relies on post-processing speed changes;native_speed1.1 means the original speed is equivalent to MiniMax's 1.1, so the template'sspeed1.1 will not be sped up again. The speed is about 1.3x real time; a 3-minute episode takes around 10 minutes to synthesize. The runtime environment is in~/.local/share/ray-explainer/voxcpm-env(uv venv -p 3.12, installmlx-audio==0.5.9 soundfile mlx-whisper)。- All other values are treated as Gemini preset voices: Charon (male, crisp, the first choice when no cloned voice is registered), Puck (male, lively), Kore (female).
"speed": speed, template default 1.1. MiniMax supports 0.5–2; Gemini can only use 1.0. Changing the speed means reconfiguring everything: in exclusive style mode, rerun tts → qa_tts → splice_clips → host.py --plan-only → make_beats → build, and the visuals and anchor sound effects follow automatically.
Use Ray's own recorded voiceover as the dubbing(he records it once and cuts out the breath pauses himself, and Claude matches it to the visuals sentence by sentence):script.json Write "recording": {"src": "<视频或音频>", "continuous": true, "takes": {"<幕>.<句>": [[起, 止]]}}. First use Whisper (mlx_whisper with word-level timing) to transcribe the whole thing, determine the start and end by sentence,lines change it to what he actually said (only fix misheard characters), cut the whole thing continuously with the ends joined together, no added pauses and no trimming the edges; for unedited raw recordings, you can remove continuous, and each sentence can be assembled from several segments (the interface uses a 20 ms fade in/out). After that, proceed as usual with qa_tts → host.py --plan-only → make_beats → build. On-camera: cut vertical segments from the same source by sentence, crop to a square above the shoulders, and place a circular small window in sentences where the lower left/lower right of the frame is empty.
When there is no cloned voice yet: ask the user to provide 1–3 minutes of clean voiceover recording (a phone recording or the original footage of a published video is fine), then:
python3 $SK/scripts/clone_voice.py <录音> --name ray # 只在本地处理:抽人声、降噪、统一响度,先听一下
python3 $SK/scripts/clone_voice.py <录音> --name ray --upload # 用户在对话里同意后再上传
Voice is personal biometric data,--upload before that, explicit user consent must be obtained in the conversation. Cloning is a one-time fee (subject to MiniMax pricing), and the registration information is written to ~/.config/ray-explainer/voices.json, not put into any repository. After cloning, the script will immediately synthesize a test line: MiniMax deletes cloned voices that have not been used within 7 days, and this step is to keep it.
General rules:
- Send only the main text. Gemini TTS will read instructions like "say in a confident tone:" verbatim, in both Chinese and English.
- Cache by service, model, voice, speed, and text; changing one sentence redoes only that sentence; changing the voice redoes everything.
- Marked
SLOWThe sentence's speed is abnormal, most likely because extra content was read in. Gemini will automatically back off when it encounters 429, and the whole video will take a few minutes; do not add concurrency.
3. Whisper proofreading + word-by-word timing
python3 $SK/scripts/qa_tts.py <project>
Transcribe each sentence twice: the normal transcription is used to compare against the script and judge whether it is acceptable; the pass with word-level timestamps is used only for timing alignment. The latter will hallucinate in the silence at the end of a sentence, producing things like "ran ran ran" or "please like and subscribe", so it cannot be used to judge acceptability. Unqualified segments will be renamed to .bad, rerun tts.py and it will be synthesized again. Must bad: 0 to continue.
When the script contains years or numbers (according to script-rules.md Write it digit by digit in Chinese characters and pair with display), then run it again:
python3 $SK/scripts/check_numbers.py <project> # Gemini 按实际读音听写含数字的句子,几美分
When you see a number read like "two thousand and nineteen", revise the script and re-align that sentence. Write the alignment result as each sentence's chars, that is, the absolute time at which each character starts speaking; the kit's at(), grammar cues, and subtitle switches all use it.
3b. Bottom-left host (included by default with IP) and the big camera shot (optional, only made after user confirmation)
python3 $SK/scripts/host.py <project> # big 为空:只生成左下角口型,不花钱,直接跑
python3 $SK/scripts/host.py <project> --dry-run # big 里写了大机位句子时:先列段落和预计费用,贴给用户等同意
python3 $SK/scripts/host.py <project> # 用户同意后:H3 生成大机位 + 角落口型,写 host/plan.json
The big camera shot (opening, key quotes, ending, about 30 seconds per episode) uses MiniMax H3 by default to generate video with gestures and a moving mouth (not word-by-word lip sync), about $0.08/second; when word-by-word lip sync is needed, "model": "pro" switch to Kling, about $0.115/second; the rest of the time the host shrinks into the bottom-left corner, using a mouth-swap layer of the same character, at no cost. For the character, principles for choosing sentences, and screen avoidance, see host.md. Videos without the host field are not affected in any way.
The big camera shot is not added by default. big When it is empty, host.py only counts corner mouth shapes, costs nothing, and runs directly; only when the user explicitly wants the big camera shot (or confirms adding it when asked) do you write sentences into big ,--dry-run estimate the cost, and generate after agreement.
4. Storyboard: first decide the drawing style for this episode, then write each scene
According to the style selection table in grammars.md , based on what this episodeas a wholeis about, chooseonedrawing style and use it for every scene:
- Grammar scene: in this scene of
script.json, write"grammar"and"cues", no code needed. Write the cue time as{"line": 1, "phrase": "创造新行为"}, and it will precisely hit the moment this word starts speaking. - Hand-drawn routine scene (preferred): in this scene write
"pattern"、"data"、"cues", no code needed. Available routines include rankings, key quotes, N-grid and elimination, story to rule, funnel, path, cause-effect swap, and checklist, see patterns.md. Full routine examples:assets/template/script.patterns.example.json。 - Handwritten scene (use last): for unique visuals not covered by routines, write
scenes.jsinS.<sceneId> = (t, sc) => {...}; functions of the same name can also be overlaid on routines to add small elements. For the API see kit-api.md, and the example isassets/template/scenes.example.js. If a visual will be used again later, turn it into a new routine and add it topatterns.js。Do not modify kit.js or existing routines for the sake of one video。 - Use only one drawing style per episode: hand-drawn routines, one kind of grammar, or HyperFrames for the whole episode, choose one of the three, and use it for the opening and ending too (the opening and ending markers come from the signature scene). When mixing,
storyboard.pyandrender.jswill warn; if you really must mix, write"mix": trueand explain why. - Landscape (
"aspect": "landscape", decided by Ray on 2026-10-14): the image is basically unobstructed, with 5% margins on all sides.No progress bar and no small headings; subtitles are white text with black outline, no background box, centered and pressed to the bottom (y 946–1036); the host is a small circular window 164 in diameter in the bottom-left corner (card-color background + thin dark green ring),only appears on key sentences:host.showmark 3–6 sentences (written the same way asbig, at no cost); the rest of the time it is not on screen; for the scene where the main image leans left, write"host_side": "right"to move it to the bottom-right (learned from Xiaolin Shuo). When posting the storyboard table, attach the key sentences you chose. Grammar segments automatically yield the top 60 and bottom 150 (bottom 230 when there is a host). For the dark version use"theme": "ray-ip-dark"(Dark gray + dark green, prioritize AI and tech themes). - Vertical safe zone: output at 1080×1920, keep all information only within y 200–1680 (the top 200 will be blocked by the Dynamic Island and status bar, the bottom 240 will be covered by the platform's author name, caption, and interaction bar), and put only background texture in these two bands. The progress bar and subtitle are at y 200–290. By default with a corner host: move the subtitle bar up to y≈1470 (
host.pyofcaption_y), the host goes from 1560 downward, the main screen only occupies y 300–1440, and grammar segments will automatically move out of the way; removehostthe film's subtitle bar returns to y 1560–1656, and the main stage can be used up to y 1520.
5. Still-frame check (mandatory, cannot be skipped)
node $SK/scripts/render.js <project> sheet 18 # 均匀抽 18 帧拼成 contact.jpg
node $SK/scripts/render.js <project> stills 7,36.3,95 # 指定时刻(全片时间)
Use Read to look at contact.jpg, and check item by item:
- Whether any elements overlap, exceed the canvas, or cover the subtitles
- Whether there are empty shots: the screen is empty while someone is talking
- Whether icons, emojis, and colors match the original intent (for example, a smiley face drawn as a frown, or a lightbulb filled in black)
- Whether every scene has something moving or appearing
- Whether the visuals are already engaging within the first 3 seconds
- Whether the cues for grammar scenes appear when the corresponding words are spoken. If they do not match, adjust
phraseoroffset
The built-in browser panel does not execute scripts in local HTML; previews can only rely on render.js. When a grammar scene fails to start, rendering will directly error out and exit, and the error message will say which scene and which cue.
6. Output
node $SK/scripts/render.js <project> video 30
A 2.5-minute film renders in about 1 minute (HyperFrames mode is about 1:1 real time). After output, use ffmpeg -ss <t> -i out.mp4 -frames:v 1 to extract 3–5 frames from the finished film for review,then run the listening check, and then deliver with SendUserFile:
python3 $SK/scripts/audio_check.py <project> [out.mp4]
It measures the volume difference between the vocals and the music between sentences (below −32 dB means inaudible, above −8 dB steals from the vocals), the music under each segment of original sound, and the number of sound effects (more than 15 triggers a reminder). Checking acceptance only with screenshots will miss sound problems: inaudible music and overly dense sound effects will be caught by Ray in one listen when watching the film.
Motion check (automatic, reports only and does not block the film):video automatically runs after rendering scripts/film_gate.py(from huashu-art-motion), the results are written to <project>/gate.json, and the terminal prints two lines gate:. To run it separately on an existing finished film:node $SK/scripts/render.js <project> gate [文件名.mp4]. Three gates:
- Fast-motion frame ratio: the proportion of frames within the shot where the picture is moving. Huashu calibrated it using films he has commented on: the lowest approved is 0.068, the highest rejected is 0.021, and the red line is 0.035. This is Huashu's taste, not Ray's: a red light does not mean it cannot be published, but you should watch the "worst 30 seconds" it reports at normal speed, then decide whether to add in-shot motion there (objects moving on their own, a slow push-in to see details, a pan to the next item, a pull-back to see the whole), and write the conclusion in the delivery notes. A still-frame collage cannot reveal this item.
- Mid-section empty frames: frames with almost no edges at all lasting continuously for more than 0.3 seconds. A red light means a real problem, so go look at the reported timecode. It cannot detect empty shots with texture such as a paper-grain desktop; step 5's still-frame check must be done yourself.
- Blue-purple ratio: the proportion of the whole film occupied by blue-purple background shots. Yellow or red lights indicate that a background such as deep purple starry sky was used; change the background color.
The upper limit for SendUserFile to phone / web is 30 MB; anything larger is only visible on the local desktop client. When the final cut exceeds 30 MB, also compress a phone version and deliver both together, with the bitrate calculated by duration to ensure it does not exceed 28 MB (a fixed 900k once produced a 30.4 MB file for a 4-minute video):
python3 $SK/scripts/phone_export.py <project> # → out_phone.mp4
7. Delivery Notes
In the reply, provide:
- Duration, aspect ratio, voice
- Content structure: how the opening hooks the viewer, what steps the main body covers, what the ending's payoff is
- The drawing method used for each act
- To be confirmed: fabricated statements, exaggerated statements, questionable facts, and sentences with Whisper similarity between 0.8–0.9 (with timestamps)
- Motion amount:
gate.json; when the fast-motion frame ratio is a red light, write the conclusion after watching the worst 30 seconds (what was added, or why nothing needs to be added) - Cost:
python3 $SK/scripts/cost.py <project>give the portion for voiceover and the digital human main camera position; Claude's tokens are summarized from the session records - What can be changed: voice, a single sentence, a single act, the drawing method of one act. A script revision only needs rerunning 2→3→5→6; changing only the visuals only needs rerunning 5→6
Does not automatically publish to any platform.
8. Publishing Package
After the user approves the final cut, write in script.json write in cover_t(the cover takes the frame at which second) and publish(titles title alternatives,description description,tags tags, following Ray's writing rules: direct, colloquial), then:
python3 $SK/scripts/publish.py <project> --vault <知识库根目录>
- Generate
cover.jpg: this frame has no subtitles or progress bar - Generate
publish.md: title, description, tags, ready to copy and paste - In the vault's
10-创作/25-口播草稿/<日期>-<标题>.mdwrite a note: frontmatter records the video path, duration, voice, drawing method, and number of items to be confirmed; the body is the storyboard table, verbatim script, and publishing copy. The video itself is not copied into the vault - When the video comes from an existing spoken master script(ray-kb quick speak, etc.), write in
script.jsonwrite"draft": "<母稿在 vault 里的相对路径>": the script does not create a new note, only adds avideo_*field and a "Publishing Copy" section to the master script (rerunning replaces it, it does not stack two copies), to avoid file name collisions with the master script - When the final cut is not named
out.mp4, write inpublishwrite in"video": "<文件名>"; HyperFrames projects (withhf/build.py) use the COVER version to render a single frame separately for the cover, see hyperframes.md - If the user has manually edited this note, the script will refuse to overwrite; only add
--force - Delivery reminder: the platform's "AI-generated content" declaration must be checked (voice cloning, digital human), and CC-licensed images must be credited in the description
- For landscape videos, the cover is handed to
ray-cover'slandscape(16:9, 1920×1080, and also output a jpg for YouTube); vertical covers (Douyin, Video Account 9:16, Xiaohongshu 3:4) are handed toray-cover's video cover process: Ray's real photo + large title, black/white/gray + dark green IP;cover.jpg(a frame from the final cut) is only used as a backup
Boundaries
- Realistic visuals, faces, close-ups of animals: code cannot draw them well. When needed, recommend live-action shooting or switch to a video model. The cartoon digital human host is the exception, see host.md。
- The kit's handwriting font depends on macOS's built-in Hannotate SC; the syntax snippets and subtitles use the Source Han Sans and LXGW WenKai bundled with the skill, so they will not change appearance on a different machine.
- Kit / syntax mode doesn't include background music or sound effects; if you want to add them, mix them in during compositing with FFmpeg, and take the sound effect timings from timeline.json; the exclusive style mode (HyperFrames) comes with its own soundtrack, makes way for the voiceover, and provides per-scene sound effects.
assets/huashu/comes from huashu-art-motion (MIT), includes only the narration part, and has been modified for vertical screen (horizontal screen uses the upstream original layout). For the source, scope, and list of changes, seeassets/huashu/NOTICE.md。