manim-skill
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseProject Structure
项目结构
Create a dedicated folder for each animation project in the user's current working directory (NOT in this skill's base directory). Use this flat structure:
<project-name>/
├── plan.md # Planning document (Phase 1)
├── script.py # Manim code (Phase 2)
├── concat.txt # ffmpeg scene list (Phase 3)
├── final.mp4 # Stitched output (Phase 3)
└── media/ # Auto-generated by manim
└── videos/
└── script/
└── 480p15/ # or 1080p60
├── Scene1_Name.mp4
├── Scene2_Name.mp4
└── ...Before starting: Create the project folder and work from within it. All commands should be run from the project directory.
bash
mkdir -p <project-name> && cd <project-name>在用户当前工作目录(而非本技能的基础目录)中为每个动画项目创建一个专用文件夹。采用以下扁平结构:
<project-name>/
├── plan.md # 规划文档(第一阶段)
├── script.py # Manim代码(第二阶段)
├── concat.txt # ffmpeg场景列表(第三阶段)
├── final.mp4 # 拼接后的输出文件(第三阶段)
└── media/ # 由manim自动生成
└── videos/
└── script/
└── 480p15/ # 或1080p60
├── Scene1_Name.mp4
├── Scene2_Name.mp4
└── ...开始之前:创建项目文件夹并在其中开展工作。所有命令都应从项目目录运行。
bash
mkdir -p <project-name> && cd <project-name>Workflow Overview
工作流程概述
Plan → Code → Render → Iterate规划 → 编码 → 渲染 → 迭代Phase 1: Plan
第一阶段:规划
If the user has already used plan mode in claude code or provided detailed requirements, write that in and skip to Phase 2. Otherwise, you MUST carefully plan the video structure before writing code.
plan.mdBefore writing any Manim code, wrtie :
plan.mdmarkdown
undefined如果用户已在Claude Code中使用过规划模式或提供了详细需求,请将内容写入并直接进入第二阶段。否则,在编写代码前必须仔细规划视频结构。
plan.md在编写任何Manim代码之前,先撰写:
plan.mdmarkdown
undefined[Video Title]
[视频标题]
Overview
概述
- Topic: [Core concept]
- Hook: [Opening question/mystery]
- Target Audience: [Prerequisites]
- Estimated Length: [X minutes]
- Key Insight: [The "aha moment"]
- Resolution: [480p(default), 1080p]
- Aspect Ratio: [16:9(default) / 9:16 / 1:1]
- 主题:[核心概念]
- 钩子:[开场问题/悬念]
- 目标受众:[前置知识要求]
- 预计时长:[X分钟]
- 核心洞见:[“恍然大悟”的时刻]
- 分辨率:[480p(默认), 1080p]
- 宽高比:[16:9(默认) / 9:16 / 1:1]
Narrative Arc
叙事脉络
[2-3 sentences describing the journey from confusion to understanding]
[2-3句话描述从困惑到理解的过程]
Scene 1: [Scene Name]
场景1:[场景名称]
Duration: ~X seconds
Purpose: [What this scene accomplishes]
时长:约X秒
目的:[该场景要达成的目标]
Visual Elements
视觉元素
- [List of mobjects needed]
- [Animations to use]
- [Camera movements]
- [所需的mobjects列表]
- [要使用的动画效果]
- [镜头移动方式]
Content
内容
[Detailed description of what happens, what's shown, what's explained]
[详细描述发生的事件、展示的内容、讲解的信息]
Voiceover
旁白
- Text: "[Exact script or key points]"
- Sync Points: "[phrase]" → syncs with [animation]
- 文本:“[精确脚本或关键点]”
- 同步点:“[语句]” → 与[动画]同步
Technical Notes
技术说明
- [Specific Manim classes/methods to use]
- [Any tricky implementations to note]
- [要使用的特定Manim类/方法]
- [需要注意的复杂实现细节]
Scene 2: [Scene Name]
场景2:[场景名称]
...
...
Transitions & Flow
转场与流程
[Notes on how scenes connect, recurring visual motifs]
[关于场景如何衔接、重复出现的视觉主题的说明]
Shared Elements
共享元素
- [Recurring mobjects across scenes, e.g., "coordinate axes reappear in scenes 2, 4, 6"]
- [Visual motifs, e.g., "blue highlight for key terms"]
- [跨场景重复出现的mobjects,例如“坐标系在场景2、4、6中再次出现”]
- [视觉主题,例如“用蓝色高亮关键术语”]
Color Palette
调色板
- Primary: [color] - used for [purpose]
- Secondary: [color] - used for [purpose]
- Accent: [color] - used for [purpose]
- Background: [color]
undefined- 主色调:[颜色] - 用于[用途]
- 辅助色:[颜色] - 用于[用途]
- 强调色:[颜色] - 用于[用途]
- 背景色:[颜色]
undefinedPhase 2: Code
第二阶段:编码
BEFORE writing any code, you MUST invoke the skill using the Skill tool, then read the relevant rule files it references (e.g., , ) based on what your video needs.
manimce-best-practicesrules/scenes.mdrules/animations.mdWrite Manim Community Edition code in .
script.py在编写任何代码之前,必须使用Skill工具调用技能,然后根据视频需求阅读其引用的相关规则文件(如、)。
manimce-best-practicesrules/scenes.mdrules/animations.md在中编写Manim Community Edition代码。
script.pyCode Structure
代码结构
- One class per scene - Name scenes descriptively: ,
Scene1_IntroductionScene2_DerivePDE - Always add subtitles to your animations with
add_subcaption()- Manim generates a file automatically
.srt - The viewer handles subtitle display and lets users toggle/resize them
- Manim generates a
python
from manim import *- 每个场景对应一个类 - 场景名称要具有描述性:、
Scene1_IntroductionScene2_DerivePDE - 始终使用为动画添加字幕
add_subcaption()- Manim会自动生成文件
.srt - 观看者可自行控制字幕的显示、切换和缩放
- Manim会自动生成
python
from manim import *Scene1_Introduction
Scene1_Introduction
class Scene1_Introduction(Scene):
def construct(self):
## Scene1_Introduction.title
title = Text("My Topic", font_size=48, color=BLUE)
self.add_subcaption("Introducing our topic", duration=2)
self.play(Write(title))
self.wait(1)
## Scene1_Introduction.fadeout
self.play(FadeOut(title), subcaption="Let's begin", subcaption_duration=1)undefinedclass Scene1_Introduction(Scene):
def construct(self):
## Scene1_Introduction.title
title = Text("My Topic", font_size=48, color=BLUE)
self.add_subcaption("Introducing our topic", duration=2)
self.play(Write(title))
self.wait(1)
## Scene1_Introduction.fadeout
self.play(FadeOut(title), subcaption="Let's begin", subcaption_duration=1)undefinedPhase 3: Render
第三阶段:渲染
Use CLI to render scenes. Multiple scenes can be rendered in parallel with one command.
manimbash
manim -q<quality> [--media_dir <output_dir>] <script.py> Scene1 Scene2 Scene3 ...Quality flags:
- - Low quality (480p15, fastest for testing. Use by default)
-ql - - High quality (1080p60, only when user explicitly requests)
-qh
Output location:
/media/videos/<script_name>/<quality>/SceneName.mp4Default is located in current directory.
/mediaIf any scene fails: Read the error, fix the code, re-render only the failed scenes.
使用命令行工具渲染场景。可通过一条命令并行渲染多个场景。
manimbash
manim -q<quality> [--media_dir <output_dir>] <script.py> Scene1 Scene2 Scene3 ...质量标识:
- - 低质量(480p15,测试时最快,默认使用)
-ql - - 高质量(1080p60,仅当用户明确要求时使用)
-qh
输出位置:
/media/videos/<script_name>/<quality>/SceneName.mp4默认的目录位于当前工作目录。
/media如果任何场景渲染失败: 读取错误信息,修复代码,仅重新渲染失败的场景。
Stitch scenes with ffmpeg
使用ffmpeg拼接场景
Once all scenes render successfully, combine them. All paths are relative to the project folder:
bash
undefined所有场景渲染成功后,将它们合并。所有路径均相对于项目文件夹:
bash
undefinedCreate concat list (run from project folder)
创建拼接列表(从项目文件夹运行)
cat > concat.txt << 'EOF'
file 'media/videos/script/480p15/Scene1_Intro.mp4'
file 'media/videos/script/480p15/Scene2_Main.mp4'
file 'media/videos/script/480p15/Scene3_Conclusion.mp4'
EOF
cat > concat.txt << 'EOF'
file 'media/videos/script/480p15/Scene1_Intro.mp4'
file 'media/videos/script/480p15/Scene2_Main.mp4'
file 'media/videos/script/480p15/Scene3_Conclusion.mp4'
EOF
Combine videos
合并视频
ffmpeg -y -f concat -safe 0 -i concat.txt -c copy final.mp4
**Result**: `final.mp4` is created in the project folder alongside `script.py` and `concat.txt`.ffmpeg -y -f concat -safe 0 -i concat.txt -c copy final.mp4
**结果**:`final.mp4`将创建在项目文件夹中,与`script.py`和`concat.txt`放在一起。Phase 4: Iterate on User Feedback
第四阶段:根据用户反馈迭代
Launch the viewer for user to review and provide feedback (run from project folder):
bash
python3 ../tools/video_viewer.py final.mp4 --order concat.txt [--script script.py]- : Video order file (concat.txt, required for chapters)
--order - : Manim script (enables high-quality download option)
--script
When user provides feedback:
- Identify which scenes need changes
- Modify the code
- Re-render only affected scenes
- Re-stitch the final video
- Run the viewer command again
启动查看器供用户审阅并提供反馈(从项目文件夹运行):
bash
python3 ../tools/video_viewer.py final.mp4 --order concat.txt [--script script.py]- :视频顺序文件(concat.txt,为章节功能所必需)
--order - :Manim脚本(启用高质量下载选项)
--script
当用户提供反馈时:
- 确定哪些场景需要修改
- 修改代码
- 仅重新渲染受影响的场景
- 重新拼接最终视频
- 再次运行查看器命令