manim-video

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Manim Video Production Pipeline

Manim视频制作流程

When to use

使用场景

Use when users request: animated explanations, math animations, concept visualizations, algorithm walkthroughs, technical explainers, 3Blue1Brown style videos, or any programmatic animation with geometric/mathematical content. Creates 3Blue1Brown-style explainer videos, algorithm visualizations, equation derivations, architecture diagrams, and data stories using Manim Community Edition.
适用于用户需要以下内容的场景:动画讲解、数学动画、概念可视化、算法演示、技术讲解、3Blue1Brown风格视频,或任何包含几何/数学内容的程序化动画。可使用Manim Community Edition制作3Blue1Brown风格的讲解视频、算法可视化、公式推导、架构图以及数据故事。

Creative Standard

创作标准

This is educational cinema. Every frame teaches. Every animation reveals structure.
Before writing a single line of code, articulate the narrative arc. What misconception does this correct? What is the "aha moment"? What visual story takes the viewer from confusion to understanding? The user's prompt is a starting point — interpret it with pedagogical ambition.
Geometry before algebra. Show the shape first, the equation second. Visual memory encodes faster than symbolic memory. When the viewer sees the geometric pattern before the formula, the equation feels earned.
First-render excellence is non-negotiable. The output must be visually clear and aesthetically cohesive without revision rounds. If something looks cluttered, poorly timed, or like "AI-generated slides," it is wrong.
Opacity layering directs attention. Never show everything at full brightness. Primary elements at 1.0, contextual elements at 0.4, structural elements (axes, grids) at 0.15. The brain processes visual salience in layers.
Breathing room. Every animation needs
self.wait()
after it. The viewer needs time to absorb what just appeared. Never rush from one animation to the next. A 2-second pause after a key reveal is never wasted.
Cohesive visual language. All scenes share a color palette, consistent typography sizing, matching animation speeds. A technically correct video where every scene uses random different colors is an aesthetic failure.
这是教育性的影像内容。每一帧都要传递知识,每一段动画都要展现结构。
在编写任何代码之前,先明确叙事脉络。要纠正哪种误解?“顿悟时刻”是什么?怎样的视觉故事能让观众从困惑走向理解?用户的需求只是起点——要以教学为目标去诠释它。
先几何后代数。先展示图形,再呈现公式。视觉记忆的编码速度快于符号记忆。当观众先看到几何规律再看到公式时,公式会显得更有说服力。
首版渲染质量必须达标。输出内容必须视觉清晰、风格统一,无需反复修改。如果内容显得杂乱、节奏不当,或是像“AI生成的幻灯片”,那就是不合格的。
透明度分层引导注意力。永远不要让所有元素都以全亮度显示。核心元素透明度设为1.0,背景元素设为0.4,结构元素(坐标轴、网格)设为0.15。大脑会按视觉显著性分层处理信息。
留足缓冲时间。每段动画结束后都需要添加
self.wait()
。观众需要时间消化刚出现的内容。不要从一个动画直接跳到下一个。关键内容展示后留2秒停顿绝非浪费时间。
统一视觉语言。所有场景使用相同的配色方案、一致的字体大小、匹配的动画速度。如果一个技术上正确的视频每个场景都使用随机不同的颜色,那在美学上就是失败的。

Prerequisites

前置条件

Run
scripts/setup.sh
to verify all dependencies. Requires: Python 3.10+, Manim Community Edition v0.20+ (
pip install manim
), LaTeX (
texlive-full
on Linux,
mactex
on macOS), and ffmpeg. Reference docs tested against Manim CE v0.20.1.
运行
scripts/setup.sh
以验证所有依赖项。需要:Python 3.10+、Manim Community Edition v0.20+(
pip install manim
)、LaTeX(Linux系统用
texlive-full
,macOS系统用
mactex
)以及ffmpeg。参考文档基于Manim CE v0.20.1测试。

Modes

模式

ModeInputOutputReference
Concept explainerTopic/conceptAnimated explanation with geometric intuition
references/scene-planning.md
Equation derivationMath expressionsStep-by-step animated proof
references/equations.md
Algorithm visualizationAlgorithm descriptionStep-by-step execution with data structures
references/graphs-and-data.md
Data storyData/metricsAnimated charts, comparisons, counters
references/graphs-and-data.md
Architecture diagramSystem descriptionComponents building up with connections
references/mobjects.md
Paper explainerResearch paperKey findings and methods animated
references/scene-planning.md
3D visualization3D conceptRotating surfaces, parametric curves, spatial geometry
references/camera-and-3d.md
模式输入输出参考文档
概念讲解主题/概念带有几何直观的动画讲解
references/scene-planning.md
公式推导数学表达式分步动画证明
references/equations.md
算法可视化算法描述带数据结构的分步执行演示
references/graphs-and-data.md
数据故事数据/指标动画图表、对比、计数器
references/graphs-and-data.md
架构图系统描述逐步构建的组件及连接关系
references/mobjects.md
论文讲解研究论文关键发现与方法的动画展示
references/scene-planning.md
3D可视化3D概念旋转曲面、参数曲线、空间几何
references/camera-and-3d.md

Stack

技术栈

Single Python script per project. No browser, no Node.js, no GPU required.
LayerToolPurpose
CoreManim Community EditionScene rendering, animation engine
MathLaTeX (texlive/MiKTeX)Equation rendering via
MathTex
Video I/OffmpegScene stitching, format conversion, audio muxing
TTSElevenLabs / Qwen3-TTS (optional)Narration voiceover
每个项目对应单个Python脚本。无需浏览器、Node.js或GPU。
层级工具用途
核心Manim Community Edition场景渲染、动画引擎
数学LaTeX (texlive/MiKTeX)通过
MathTex
渲染公式
视频输入输出ffmpeg场景拼接、格式转换、音频混流
文本转语音ElevenLabs / Qwen3-TTS(可选)旁白配音

Pipeline

流程

PLAN --> CODE --> RENDER --> STITCH --> AUDIO (optional) --> REVIEW
  1. PLAN — Write
    plan.md
    with narrative arc, scene list, visual elements, color palette, voiceover script
  2. CODE — Write
    script.py
    with one class per scene, each independently renderable
  3. RENDER
    manim -ql script.py Scene1 Scene2 ...
    for draft,
    -qh
    for production
  4. STITCH — ffmpeg concat of scene clips into
    final.mp4
  5. AUDIO (optional) — Add voiceover and/or background music via ffmpeg. See
    references/rendering.md
  6. REVIEW — Render preview stills, verify against plan, adjust
PLAN --> CODE --> RENDER --> STITCH --> AUDIO (optional) --> REVIEW
  1. 规划 — 编写
    plan.md
    文件,包含叙事脉络、场景列表、视觉元素、配色方案、旁白脚本
  2. 编码 — 编写
    script.py
    文件,每个场景对应一个类,每个类可独立渲染
  3. 渲染 — 草稿版用
    manim -ql script.py Scene1 Scene2 ...
    ,生产版用
    -qh
  4. 拼接 — 使用ffmpeg将场景片段拼接为
    final.mp4
  5. 音频处理(可选) — 通过ffmpeg添加旁白和/或背景音乐。详见
    references/rendering.md
  6. 审核 — 渲染预览静帧,对照规划进行验证和调整

Project Structure

项目结构

project-name/
  plan.md                # Narrative arc, scene breakdown
  script.py              # All scenes in one file
  concat.txt             # ffmpeg scene list
  final.mp4              # Stitched output
  media/                 # Auto-generated by Manim
    videos/script/480p15/
project-name/
  plan.md                # 叙事脉络、场景拆分
  script.py              # 所有场景在一个文件中
  concat.txt             # ffmpeg场景列表
  final.mp4              # 拼接后的输出文件
  media/                 # Manim自动生成
    videos/script/480p15/

Creative Direction

创作指导

Color Palettes

配色方案

PaletteBackgroundPrimarySecondaryAccentUse case
Classic 3B1B
#1C1C1C
#58C4DD
(BLUE)
#83C167
(GREEN)
#FFFF00
(YELLOW)
General math/CS
Warm academic
#2D2B55
#FF6B6B
#FFD93D
#6BCB77
Approachable
Neon tech
#0A0A0A
#00F5FF
#FF00FF
#39FF14
Systems, architecture
Monochrome
#1A1A2E
#EAEAEA
#888888
#FFFFFF
Minimalist
配色背景色主色调辅助色强调色适用场景
经典3B1B
#1C1C1C
#58C4DD
(蓝色)
#83C167
(绿色)
#FFFF00
(黄色)
通用数学/计算机科学内容
温暖学术风
#2D2B55
#FF6B6B
#FFD93D
#6BCB77
通俗易懂的内容
霓虹科技风
#0A0A0A
#00F5FF
#FF00FF
#39FF14
系统、架构类内容
单色极简风
#1A1A2E
#EAEAEA
#888888
#FFFFFF
极简风格内容

Animation Speed

动画速度

Contextrun_timeself.wait() after
Title/intro appear1.5s1.0s
Key equation reveal2.0s2.0s
Transform/morph1.5s1.5s
Supporting label0.8s0.5s
FadeOut cleanup0.5s0.3s
"Aha moment" reveal2.5s3.0s
场景类型run_time动画后等待时长
标题/开场出现1.5秒1.0秒
关键公式展示2.0秒2.0秒
变形/转换1.5秒1.5秒
辅助标签0.8秒0.5秒
淡出清理0.5秒0.3秒
“顿悟时刻”展示2.5秒3.0秒

Typography Scale

字体大小规范

RoleFont sizeUsage
Title48Scene titles, opening text
Heading36Section headers within a scene
Body30Explanatory text
Label24Annotations, axis labels
Caption20Subtitles, fine print
文本角色字体大小用途
标题48场景标题、开场文本
小标题36场景内的章节标题
正文30解释性文本
标签24注释、坐标轴标签
说明文字20字幕、小字内容

Fonts

字体选择

Use monospace fonts for all text. Manim's Pango renderer produces broken kerning with proportional fonts at all sizes. See
references/visual-design.md
for full recommendations.
python
MONO = "Menlo"  # define once at top of file

Text("Fourier Series", font_size=48, font=MONO, weight=BOLD)  # titles
Text("n=1: sin(x)", font_size=20, font=MONO)                  # labels
MathTex(r"\nabla L")                                            # math (uses LaTeX)
Minimum
font_size=18
for readability.
所有文本均使用等宽字体。Manim的Pango渲染器在任何字号下,比例字体的字距都会出现问题。详见
references/visual-design.md
中的完整推荐。
python
MONO = "Menlo"  # 在文件顶部定义一次

Text("Fourier Series", font_size=48, font=MONO, weight=BOLD)  # 标题
Text("n=1: sin(x)", font_size=20, font=MONO)                  # 标签
MathTex(r"\nabla L")                                            # 数学公式(使用LaTeX)
最小字体大小为18以保证可读性。

Per-Scene Variation

场景差异化

Never use identical config for all scenes. For each scene:
  • Different dominant color from the palette
  • Different layout — don't always center everything
  • Different animation entry — vary between Write, FadeIn, GrowFromCenter, Create
  • Different visual weight — some scenes dense, others sparse
不要对所有场景使用相同配置。每个场景需做到:
  • 使用配色方案中的不同主色调
  • 不同布局 — 不要总是居中所有元素
  • 不同动画入场方式 — 在Write、FadeIn、GrowFromCenter、Create中切换
  • 不同视觉密度 — 有的场景内容密集,有的场景内容稀疏

Workflow

工作流程

Step 1: Plan (plan.md)

步骤1:规划(plan.md)

Before any code, write
plan.md
. See
references/scene-planning.md
for the comprehensive template.
在编写任何代码前,先写
plan.md
。完整模板详见
references/scene-planning.md

Step 2: Code (script.py)

步骤2:编码(script.py)

One class per scene. Every scene is independently renderable.
python
from manim import *

BG = "#1C1C1C"
PRIMARY = "#58C4DD"
SECONDARY = "#83C167"
ACCENT = "#FFFF00"
MONO = "Menlo"

class Scene1_Introduction(Scene):
    def construct(self):
        self.camera.background_color = BG
        title = Text("Why Does This Work?", font_size=48, color=PRIMARY, weight=BOLD, font=MONO)
        self.add_subcaption("Why does this work?", duration=2)
        self.play(Write(title), run_time=1.5)
        self.wait(1.0)
        self.play(FadeOut(title), run_time=0.5)
Key patterns:
  • Subtitles on every animation:
    self.add_subcaption("text", duration=N)
    or
    subcaption="text"
    on
    self.play()
  • Shared color constants at file top for cross-scene consistency
  • self.camera.background_color
    set in every scene
  • Clean exits — FadeOut all mobjects at scene end:
    self.play(FadeOut(Group(*self.mobjects)))
每个场景对应一个类,每个类可独立渲染。
python
from manim import *

BG = "#1C1C1C"
PRIMARY = "#58C4DD"
SECONDARY = "#83C167"
ACCENT = "#FFFF00"
MONO = "Menlo"

class Scene1_Introduction(Scene):
    def construct(self):
        self.camera.background_color = BG
        title = Text("Why Does This Work?", font_size=48, color=PRIMARY, weight=BOLD, font=MONO)
        self.add_subcaption("Why does this work?", duration=2)
        self.play(Write(title), run_time=1.5)
        self.wait(1.0)
        self.play(FadeOut(title), run_time=0.5)
关键模式:
  • 每个动画都加字幕:使用
    self.add_subcaption("text", duration=N)
    或在
    self.play()
    中添加
    subcaption="text"
  • 在文件顶部定义共享颜色常量,保证跨场景一致性
  • 每个场景都设置
    self.camera.background_color
  • 干净退场 — 场景结束时淡出所有对象:
    self.play(FadeOut(Group(*self.mobjects)))

Step 3: Render

步骤3:渲染

bash
manim -ql script.py Scene1_Introduction Scene2_CoreConcept  # draft
manim -qh script.py Scene1_Introduction Scene2_CoreConcept  # production
bash
manim -ql script.py Scene1_Introduction Scene2_CoreConcept  # 草稿版
manim -qh script.py Scene1_Introduction Scene2_CoreConcept  # 生产版

Step 4: Stitch

步骤4:拼接

bash
cat > concat.txt << 'EOF'
file 'media/videos/script/480p15/Scene1_Introduction.mp4'
file 'media/videos/script/480p15/Scene2_CoreConcept.mp4'
EOF
ffmpeg -y -f concat -safe 0 -i concat.txt -c copy final.mp4
bash
cat > concat.txt << 'EOF'
file 'media/videos/script/480p15/Scene1_Introduction.mp4'
file 'media/videos/script/480p15/Scene2_CoreConcept.mp4'
EOF
ffmpeg -y -f concat -safe 0 -i concat.txt -c copy final.mp4

Step 5: Review

步骤5:审核

bash
manim -ql --format=png -s script.py Scene2_CoreConcept  # preview still
bash
manim -ql --format=png -s script.py Scene2_CoreConcept  # 预览静帧

Critical Implementation Notes

关键实现注意事项

Raw Strings for LaTeX

LaTeX使用原始字符串

python
undefined
python
undefined

WRONG: MathTex("\frac{1}{2}")

错误写法:MathTex("\frac{1}{2}")

RIGHT:

正确写法:

MathTex(r"\frac{1}{2}")
undefined
MathTex(r"\frac{1}{2}")
undefined

buff >= 0.5 for Edge Text

边缘文本的buff值≥0.5

python
label.to_edge(DOWN, buff=0.5)  # never < 0.5
python
label.to_edge(DOWN, buff=0.5)  # 不要小于0.5

FadeOut Before Replacing Text

替换文本前先淡出

python
self.play(ReplacementTransform(note1, note2))  # not Write(note2) on top
python
self.play(ReplacementTransform(note1, note2))  # 不要直接在上方Write(note2)

Never Animate Non-Added Mobjects

不要对未添加的对象执行动画

python
self.play(Create(circle))  # must add first
self.play(circle.animate.set_color(RED))  # then animate
python
self.play(Create(circle))  # 必须先添加
self.play(circle.animate.set_color(RED))  # 再执行动画

Performance Targets

性能指标

QualityResolutionFPSSpeed
-ql
(draft)
854x480155-15s/scene
-qm
(medium)
1280x7203015-60s/scene
-qh
(production)
1920x10806030-120s/scene
Always iterate at
-ql
. Only render
-qh
for final output.
画质等级分辨率FPS渲染速度
-ql
(草稿)
854x480155-15秒/场景
-qm
(中等)
1280x7203015-60秒/场景
-qh
(生产)
1920x10806030-120秒/场景
始终用
-ql
迭代。仅在最终输出时使用
-qh
渲染。

References

参考文档

FileContents
references/animations.md
Core animations, rate functions, composition,
.animate
syntax, timing patterns
references/mobjects.md
Text, shapes, VGroup/Group, positioning, styling, custom mobjects
references/visual-design.md
12 design principles, opacity layering, layout templates, color palettes
references/equations.md
LaTeX in Manim, TransformMatchingTex, derivation patterns
references/graphs-and-data.md
Axes, plotting, BarChart, animated data, algorithm visualization
references/camera-and-3d.md
MovingCameraScene, ThreeDScene, 3D surfaces, camera control
references/scene-planning.md
Narrative arcs, layout templates, scene transitions, planning template
references/rendering.md
CLI reference, quality presets, ffmpeg, voiceover workflow, GIF export
references/troubleshooting.md
LaTeX errors, animation errors, common mistakes, debugging
references/animation-design-thinking.md
When to animate vs show static, decomposition, pacing, narration sync
references/updaters-and-trackers.md
ValueTracker, add_updater, always_redraw, time-based updaters, patterns
references/paper-explainer.md
Turning research papers into animations — workflow, templates, domain patterns
references/decorations.md
SurroundingRectangle, Brace, arrows, DashedLine, Angle, annotation lifecycle
references/production-quality.md
Pre-code, pre-render, post-render checklists, spatial layout, color, tempo

文件内容
references/animations.md
核心动画、速率函数、组合、
.animate
语法、时间模式
references/mobjects.md
文本、图形、VGroup/Group、定位、样式、自定义对象
references/visual-design.md
12条设计原则、透明度分层、布局模板、配色方案
references/equations.md
Manim中的LaTeX使用、TransformMatchingTex、推导模式
references/graphs-and-data.md
坐标轴、绘图、BarChart、动画数据、算法可视化
references/camera-and-3d.md
MovingCameraScene、ThreeDScene、3D曲面、相机控制
references/scene-planning.md
叙事脉络、布局模板、场景过渡、规划模板
references/rendering.md
CLI参考、画质预设、ffmpeg、旁白工作流、GIF导出
references/troubleshooting.md
LaTeX错误、动画错误、常见问题、调试方法
references/animation-design-thinking.md
何时用动画vs静态展示、分解方法、节奏、旁白同步
references/updaters-and-trackers.md
ValueTracker、add_updater、always_redraw、基于时间的更新器、模式
references/paper-explainer.md
将研究论文转化为动画的工作流、模板、领域模式
references/decorations.md
SurroundingRectangle、Brace、箭头、DashedLine、Angle、注释生命周期
references/production-quality.md
编码前、渲染前、渲染后检查清单、空间布局、颜色、节奏

Creative Divergence (use only when user requests experimental/creative/unique output)

创意拓展(仅在用户要求实验性/创意性/独特输出时使用)

If the user asks for creative, experimental, or unconventional explanatory approaches, select a strategy and reason through it BEFORE designing the animation.
  • SCAMPER — when the user wants a fresh take on a standard explanation
  • Assumption Reversal — when the user wants to challenge how something is typically taught
如果用户要求创意性、实验性或非常规的讲解方式,请先选定策略并理清思路,再设计动画。
  • SCAMPER — 当用户希望对标准讲解方式进行创新时
  • 假设反转 — 当用户希望挑战常规教学方式时

SCAMPER Transformation

SCAMPER改造法

Take a standard mathematical/technical visualization and transform it:
  • Substitute: replace the standard visual metaphor (number line → winding path, matrix → city grid)
  • Combine: merge two explanation approaches (algebraic + geometric simultaneously)
  • Reverse: derive backward — start from the result and deconstruct to axioms
  • Modify: exaggerate a parameter to show why it matters (10x the learning rate, 1000x the sample size)
  • Eliminate: remove all notation — explain purely through animation and spatial relationships
对标准的数学/技术可视化内容进行改造:
  • 替换:替换标准视觉隐喻(如将数轴改为蜿蜒路径,矩阵改为城市网格)
  • 组合:融合两种讲解方式(同时展示代数和几何内容)
  • 反转:反向推导——从结果出发解构到公理
  • 修改:放大某个参数以展示其重要性(如将学习率放大10倍,样本量放大1000倍)
  • 简化:移除所有符号——仅通过动画和空间关系进行讲解

Assumption Reversal

假设反转法

  1. List what's "standard" about how this topic is visualized (left-to-right, 2D, discrete steps, formal notation)
  2. Pick the most fundamental assumption
  3. Reverse it (right-to-left derivation, 3D embedding of a 2D concept, continuous morphing instead of steps, zero notation)
  4. Explore what the reversal reveals that the standard approach hides
  1. 列出该主题可视化的“标准”做法(从左到右、2D展示、分步演示、正式符号)
  2. 挑选最核心的假设
  3. 反转该假设(从右到左推导、将2D概念嵌入3D空间、用连续变形替代分步演示、零符号)
  4. 探索反转后能揭示哪些标准方式隐藏的内容