What does Reference Video → New Style Asset Pack do?
Reference result: The Gilded Text style (src/library/gilded/, library-gilded, styles/我的风格/暗金文献风/) was distilled from a single reference video (not committed to git). User-recognized effect: The style is instantly recognizable, but all components are rewritten, sample content is original, and nothing from the original footage (copy, titles, watermarks) is carried over.
Execute steps 0–7 in one go, without waiting for user confirmation between steps. After each step, provide a one- or two-sentence progress update. Do not export or commit to git unless the user explicitly asks. Before starting, read the project root CLAUDE.md, src/library/README.md, and styles/README.md. Prefix all npm / npx / node commands with export NODE_OPTIONS=--max-old-space-size=4096.
Boundaries of Distillation (Think Before Acting)
Distill visual grammar, not content. You may learn the style itself (color tendencies, font pairings, layout grids, entrance methods, transition techniques, rhythm); you may not copy a specific work.
- Learn: Color system, font personality and hierarchy, layout positions, element entrance/exit/transition methods, easing and duration, camera motion, rhythm (cut frequency, shot length, beat matching), chart/prop drawing techniques, textures (grain, glows, paper textures).
- Do not copy: Original copy and subtitles, titles, specific scene layout and storyboard order, creator names / watermarks / brand identifiers, portraits of people from the original footage, third-party logos and trademarks.
- Characters: If the original footage includes well-known copyrighted characters (anime, game, brand mascots), learn their construction technique (geometry, proportions, strokes, coloring) but create an obviously different original character — do not draw something "vaguely similar".
- Music: Do not include the original soundtrack in the asset pack; if music is wanted, use the music library (
public/music/) and clearly note in the README that licensing is unconfirmed. - Sample copy in previews: Write your own, on a different topic than the original footage. Use placeholders like "Sample Text" or "Example Person" for cited book names or people.
When the user says "replicate one-to-one", follow the boundaries above and reply with a single sentence: "Style is one-to-one; content is not copied."
0. Define Style ID and Directories
- Style ID: Lowercase English kebab-case, based on the most prominent visual feature (e.g.,
gilded,ink-scroll,neon-grid). Must not conflict with existing directories insrc/library/. Chinese name: 3–6 characters (e.g., 暗金文献风, 宣纸水墨风). - Distillation package: Place under
materials/distill/<styleID>/<videoName>/(materials/is not committed to git; original footage frames must not enter the repository). - Output:
src/library/<styleID>/,src/library/previews/<Name>Demo.tsx,styles/我的风格/<chineseName>/README.md+preview.jpg.
1. Machine Analysis (Run Once per Video)
uv run --with numpy --with pillow python .claude/skills/weilanx-creator-distill-video/scripts/analyze.py \
<video> --out materials/distill/<styleID>/<videoName>
Produces report.md (read this first), data.json, keyframes/ (keyframe per shot), sheets/ (contact sheet every 3 seconds), palette.png. The report includes: hard cuts and shot table, motion intensity per second, main palette (by area) and accent colors (by saturated pixels, not drowned by large backgrounds), brightness/saturation, audio loudness and beat points (calls the gilded style skill's beats.py).
If there are too many or too few hard cuts, adjust --cut (default 0.30; smaller = more sensitive). If the contact sheet is too dense or too sparse, adjust --every.
2. Human Inspection: Understanding Why It Looks Good
See references/拆解方法.md for details. Order:
- Contact sheet: Scan through, classify into categories (title card, year header, chart, object, quote…), note the time range for each.
- Keyframes: Look at each one, crop and zoom to examine fonts, strokes, shadows, textures (
ffmpeg -vf crop=…). - Motion slices: Cut one slice each for entrance, exit, transition, and signature action. Count "how many frames to complete", "ease-in-out or linear", "blur/scale/offset present":
Slices should also be taken at peaks in the motion intensity curve and before/after cut points in the shot table.uv run --with pillow python .claude/skills/weilanx-creator-distill-video/scripts/strip.py <video> \ --at 16.6 --span 1.2 --n 8 --out materials/distill/<styleID>/strips/t16.6.jpg - Color picking: Get accent colors from the report; pick pixel colors for specific elements from keyframes (
uv run --with pillow python -c "…getpixel…"). - Multiple videos: Analyze each independently, then find common grammar; document inconsistencies as "variants" (e.g., warm-tone vs. cold-tone glow).
3. Write the Style Recipe Card
Using the structure from references/配方卡模板.md, write into styles/我的风格/<chineseName>/README.md: one-sentence positioning, visual characteristics (base texture, color scheme, fonts, fixed layout, entrances, transitions, camera, rhythm, signature frames), component list, key code locations, usage table, "things intentionally not copied". This is the design document before writing code; clarify it before moving on.
4. Write the Asset Pack Code
Follow the layering of src/library/gilded/ (it is the result of the first distillation and its structure can be directly referenced):
| File | What to Place |
|---|---|
theme.ts | Color constants, font constants, style functions (gradient text, glow), generic entrance functions (e.g., soft) and easing values |
stage.tsx | Scene layer: background, texture (grain/dust/paper texture), fixed layout elements (headers, quotes, captions), title card, quote card, soft-entry container |
props.tsx | Objects and props |
charts.tsx | How this style draws charts (only present if the original footage includes charts) |
Hard rules (engineering conventions, see CLAUDE.md):
- Animation is a pure function of frame number: Components take
fand compute their state; userand(seed)for randomization. No CSS animations, noMath.random(). - The library must not import from
src/episodes/. - Use fonts already in the repository (
public/fonts/, OFL) or system fonts. To add a new font, confirm its license, add it topublic/fonts/and updatepublic/fonts/LICENSES.md. - Each component must have a one-line Chinese comment explaining its purpose and key parameters.
5. Preview Composition
src/library/previews/<Name>Demo.tsx: Every 150 frames, demonstrate each component in sequence. Use this style's own transitions between sections. Write original sample copy on a different topic from the original footage.- Export
<NAME>_DEMO_FRAMES, registerlibrary-<styleID>insrc/Root.tsx. Aspect ratio should match the original video. npm run typecheck && npm test.
6. Side-by-Side Verification (At Least Two Rounds)
- For each section, render one frame:
npx remotion still src/index.ts library-<styleID> /tmp/<styleID>/sN.jpg --frame=N --scale=0.5 --timeout=120000. Render only one frame at a time (parallel rendering causes memory overflow). - Compare with a keyframe of the same type from the original footage by stacking them horizontally (
ffmpeg -i original-frame -i our-frame -filter_complex hstack). Check point by point: background color, main color, accent color, font personality, font size hierarchy, layout position, texture, whitespace. - Motion comparison: For the same type of entrance, compare original slices vs. our slices — do frame counts and easing match?
- Each round: list discrepancies → fix → re-render. Common issues: gradient text on small font sizes turning brown, glow too weak, elements too small with too much whitespace, charts cramped in the center.
- After fixes, stitch the 4 sections into
styles/我的风格/<chineseName>/preview.jpg(use only our rendered frames, do not include original footage screenshots).
7. Registration and Delivery
- Add a section to
src/library/README.md(following the format of "暗金文献风 gilded/": file | content table + bullet points). - Add a row to "我的风格" table in
styles/README.md. In the recipe card's usage table, write "not yet used". - Studio preview link:
http://localhost:3000/library-<styleID>(if not open, start in background withnpx remotion studio src/index.ts --no-open --port 3000). - In your reply, include: key points of this style (3–5 items), component list, what was fixed after side-by-side verification, what was intentionally not copied, and what remains to be improved.
- If the user wants to immediately use it in an episode, proceed with the corresponding episode production workflow. For non-narrated knowledge shorts, you can reference the
weilanx-creator-gilded-videoprocess, substituting the new asset pack.