Kaiti Lecture Film Skill (楷体大字讲义电影)
Transform a set of notes / theorem(s) / a topic into a "Kaiti large-font · dark premium · frame-accurate audio sync" explainer video.
Sample output: examples/real-number-completeness-film/out/实数完备性大电影_配音版_1080P60.mp4
(144 seconds / 1080P60 / 26 dubbed segments / 3D opening temple + historical section + 6 theorem proofs + 3D finale).
Pipeline at a glance:
Lecture content → ① Scene scripts (Python/Manim) → ② One-click render + stitch (build_film)
→ ③ Source-code timeline reconstruction → ④ Segment table + dubbing script (dub_config)
→ ⑤ TTS / self-recorded audio + cascade scheduling (dub_pipeline) → ⑥ Verification & acceptance (verify_film) → Delivery
1. Environment Requirements (Cross-platform)
| Dependency | Purpose | Installation |
|---|---|---|
| Python ≥ 3.10 | Run Manim & scripts | python.org / system package manager |
| Manim CE ≥ 0.18 | Render animations | pip install manim (verify: manim --version) |
| FFmpeg + FFprobe | Stitching, dubbing mux, verification | macOS brew install ffmpeg; Windows winget install ffmpeg; Linux apt install ffmpeg |
| LaTeX (including dvisvgm) | MathTex formula rendering | macOS MacTeX; Windows MiKTeX; Linux TeX Live |
| edge-tts | Free Chinese TTS | pip install edge-tts (not needed if using own recordings) |
| Kaiti-style Chinese font | Film aesthetic | macOS built-in Kaiti SC; Windows built-in KaiTi (楷体); Linux sudo apt install fonts-arphic-ukai or open-source LXGW WenKai. Details in assets/fonts/字体说明.md |
Network: TTS & image sourcing need internet; rendering / stitching / verification run fully offline.
2. Directory Structure (Standard Skill Skeleton)
| Part | Path | Purpose |
|---|---|---|
| Facade + Brain | SKILL.md (this file) | When to use, how, rule index |
| Practical Guide | AGENT-实操指南.md (root) | For the executing Agent: how to adapt any user content (not just sample theme) into this style |
| Knowledge Base | references/ | Style spec · Dubbing methodology · Long video guide · Web image sourcing · Troubleshooting (read on demand, one topic per file) |
| Hands | scripts/ | build_film.py render+stitch · dub_pipeline.py dubbing synthesis · verify_film.py verification |
| Sample | examples/real-number-completeness-film/ | Complete runnable project: 3 scene source files + portrait assets + dubbing script + config + final video |
| Assets | assets/ | Font instructions · LaTeX template · scenes.json template |
| Manual Docs | 使用说明.pdf · 成本估算.pdf | For the client: environment setup / operation manual & token cost estimate |
3. Standard Workflow (8 Steps)
- Project Init: Create a new project folder (suggest
_proj-<topic>/), copyassets/portraits/structure and any one scene source from the sample as skeleton. - Scene Scripting: Write scene classes per
references/style-guide.md. Each scene oneconstruct, 30–90 seconds, self-contained (copy constants + base class into file, no cross-file import of scenes).MathTexmust NOT contain Chinese characters. - Single Scene Smoke Test:
manim -ql your_file.py SceneClass→ quick 480p render, check layout (zero overlap / no clipping). - Render & Stitch: Write
build/scenes.json(template atassets/templates/scenes.template.json), thenpython scripts/build_film.py build/scenes.json(incremental:--only SceneName; smoke test:--quality ql). - Timeline Reconstruction: Follow
references/timeline-dubbing.mdto accumulate durations from source code, hard self-check: accumulated value = ffprobe measured (error ≤0.5s). If needed, use probes to pinpoint drift. Never build segment table by eye-balling. - Segment Table + Script: Write
work/dub_config.json(26-segment example in sample). Word budget ≈ (segment_length − 0.7s) × 4.6 words (real speech rate). Keep engaging but strictly matching the visuals. - Dubbing Synthesis:
python scripts/dub_pipeline.py work/dub_config.jsonAutomates: segment TTS (with retry + silent trimming + hash caching) → cascade scheduling → ffmpeg mux → final video. Instructions for using own recordings in same document. - Verification & Acceptance:
python scripts/verify_film.py --master master.mp4 --dubbed final.mp4 --probes 5.5,11.2,143Hard criteria: final duration = source ±0.5s; loudness -20 to -30dB with no dead segments; probe frames audio-video aligned. - Delivery:
out/final video +out/段落表.txt+ dubbing script.md. Run verify before delivery to get all green.
4. Quick Rules (Top 8, full list in references/troubleshooting.md)
MathTexmust NOT contain Chinese characters (LaTeX without ctex will crash) — useText(zh_font=...)for Chinese, combined withVGroup(zh(...), mt(...)).arrange(RIGHT)for mixed content.ImageMobjectis not a VMobject — put multiple objects inGroup; usingVGroupwill crash.- Surface types (
Cylinder/Sphere) withfill_colorwill not work (default cyan checkerboard) — must usecheckerboard_colors=[light, dark]; for solid color usecheckerboard_colors=False. self.play(...)withoutrun_timedefaults to 1.0s; mixed animations take max; timeline accumulation must check each segment.- Top-half text (
build_deduction_block, y>0) and bottom-half graphics (shift(DOWN*1.9~2.0)) are strictly separated; all objectsfit(width≤13.6)to avoid clipping. - No hardcoded user paths in scripts — always use
BASE_DIR = os.path.dirname(os.path.abspath(__file__)). - TTS disconnections / long segments are common — pipeline includes retry and hash caching; change script only re-renders affected segments, not entire batch.
- Timeline mismatch ≠ restart: use "boundary +0.4s probe frames" to locate the few segments with drift, fix only those.
5. Long Videos (30–60 minutes) — Conclusion: No Problem
Architecture naturally supports: one scene per file, one chapter per manifest, chapter-by-chapter dubbing, lossless stitching, hash-cached incremental re-dub. 1 hour ≈ 45–60 scenes; render time ≈ 8–20× final duration (chapter-based unattended overnight runs); TTS free and per-segment cached.
Operational details, project structure, and resume-from-breakpoint specs in references/long-film-playbook.md.
6. References Index
When tasked with "turn these notes / article into a video in this style", first read root
AGENT-实操指南.md(content transformation algorithm: any content → scene list → visual metaphor mapping), then browse below as needed.
| File | When to read |
|---|---|
style-guide.md | Before writing any scene code (layout / font / color / component contracts / 3D specs) |
timeline-dubbing.md | When entering dubbing phase (timeline reconstruction / probes / word budget / self-recorded audio) |
long-film-playbook.md | When project exceeds 10 scenes (chapterization / incremental / capacity estimation) |
web-image-sourcing.md | When needing historical portraits, illustration assets (web search + copyright boundaries) |
troubleshooting.md | When errors occur, check here first before fixing |