manim-skill

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Project 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
plan.md
and skip to Phase 2. Otherwise, you MUST carefully plan the video structure before writing code.
Before writing any Manim code, wrtie
plan.md
:
markdown
undefined
如果用户已在Claude Code中使用过规划模式或提供了详细需求,请将内容写入
plan.md
并直接进入第二阶段。否则,在编写代码前必须仔细规划视频结构。
在编写任何Manim代码之前,先撰写
plan.md
markdown
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
  • 主色调:[颜色] - 用于[用途]
  • 辅助色:[颜色] - 用于[用途]
  • 强调色:[颜色] - 用于[用途]
  • 背景色:[颜色]
undefined

Phase 2: Code

第二阶段:编码

BEFORE writing any code, you MUST invoke the
manimce-best-practices
skill using the Skill tool, then read the relevant rule files it references (e.g.,
rules/scenes.md
,
rules/animations.md
) based on what your video needs.
Write Manim Community Edition code in
script.py
.
在编写任何代码之前,必须使用Skill工具调用
manimce-best-practices
技能,然后根据视频需求阅读其引用的相关规则文件(如
rules/scenes.md
rules/animations.md
)。
script.py
中编写Manim Community Edition代码。

Code Structure

代码结构

  1. One class per scene - Name scenes descriptively:
    Scene1_Introduction
    ,
    Scene2_DerivePDE
  2. Always add subtitles to your animations with
    add_subcaption()
    • Manim generates a
      .srt
      file automatically
    • The viewer handles subtitle display and lets users toggle/resize them
python
from manim import *
  1. 每个场景对应一个类 - 场景名称要具有描述性:
    Scene1_Introduction
    Scene2_DerivePDE
  2. 始终使用
    add_subcaption()
    为动画添加字幕
    • Manim会自动生成
      .srt
      文件
    • 观看者可自行控制字幕的显示、切换和缩放
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)
undefined
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)
undefined

Phase 3: Render

第三阶段:渲染

Use
manim
CLI to render scenes. Multiple scenes can be rendered in parallel with one command.
bash
manim -q<quality> [--media_dir <output_dir>] <script.py> Scene1 Scene2 Scene3 ...
Quality flags:
  • -ql
    - Low quality (480p15, fastest for testing. Use by default)
  • -qh
    - High quality (1080p60, only when user explicitly requests)
Output location:
/media/videos/<script_name>/<quality>/SceneName.mp4
Default
/media
is located in current directory.
If any scene fails: Read the error, fix the code, re-render only the failed scenes.
使用
manim
命令行工具渲染场景。可通过一条命令并行渲染多个场景。
bash
manim -q<quality> [--media_dir <output_dir>] <script.py> Scene1 Scene2 Scene3 ...
质量标识:
  • -ql
    - 低质量(480p15,测试时最快,默认使用)
  • -qh
    - 高质量(1080p60,仅当用户明确要求时使用)
输出位置:
/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
undefined

Create 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]
  • --order
    : Video order file (concat.txt, required for chapters)
  • --script
    : Manim script (enables high-quality download option)
When user provides feedback:
  1. Identify which scenes need changes
  2. Modify the code
  3. Re-render only affected scenes
  4. Re-stitch the final video
  5. Run the viewer command again
启动查看器供用户审阅并提供反馈(从项目文件夹运行):
bash
python3 ../tools/video_viewer.py final.mp4 --order concat.txt [--script script.py]
  • --order
    :视频顺序文件(concat.txt,为章节功能所必需)
  • --script
    :Manim脚本(启用高质量下载选项)
当用户提供反馈时:
  1. 确定哪些场景需要修改
  2. 修改代码
  3. 仅重新渲染受影响的场景
  4. 重新拼接最终视频
  5. 再次运行查看器命令