manim-video
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseManim 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 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.
self.wait()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。大脑会按视觉显著性分层处理信息。
留足缓冲时间。每段动画结束后都需要添加。观众需要时间消化刚出现的内容。不要从一个动画直接跳到下一个。关键内容展示后留2秒停顿绝非浪费时间。
self.wait()统一视觉语言。所有场景使用相同的配色方案、一致的字体大小、匹配的动画速度。如果一个技术上正确的视频每个场景都使用随机不同的颜色,那在美学上就是失败的。
Prerequisites
前置条件
Run to verify all dependencies. Requires: Python 3.10+, Manim Community Edition v0.20+ (), LaTeX ( on Linux, on macOS), and ffmpeg. Reference docs tested against Manim CE v0.20.1.
scripts/setup.shpip install manimtexlive-fullmactex运行以验证所有依赖项。需要:Python 3.10+、Manim Community Edition v0.20+()、LaTeX(Linux系统用,macOS系统用)以及ffmpeg。参考文档基于Manim CE v0.20.1测试。
scripts/setup.shpip install manimtexlive-fullmactexModes
模式
| Mode | Input | Output | Reference |
|---|---|---|---|
| Concept explainer | Topic/concept | Animated explanation with geometric intuition | |
| Equation derivation | Math expressions | Step-by-step animated proof | |
| Algorithm visualization | Algorithm description | Step-by-step execution with data structures | |
| Data story | Data/metrics | Animated charts, comparisons, counters | |
| Architecture diagram | System description | Components building up with connections | |
| Paper explainer | Research paper | Key findings and methods animated | |
| 3D visualization | 3D concept | Rotating surfaces, parametric curves, spatial geometry | |
| 模式 | 输入 | 输出 | 参考文档 |
|---|---|---|---|
| 概念讲解 | 主题/概念 | 带有几何直观的动画讲解 | |
| 公式推导 | 数学表达式 | 分步动画证明 | |
| 算法可视化 | 算法描述 | 带数据结构的分步执行演示 | |
| 数据故事 | 数据/指标 | 动画图表、对比、计数器 | |
| 架构图 | 系统描述 | 逐步构建的组件及连接关系 | |
| 论文讲解 | 研究论文 | 关键发现与方法的动画展示 | |
| 3D可视化 | 3D概念 | 旋转曲面、参数曲线、空间几何 | |
Stack
技术栈
Single Python script per project. No browser, no Node.js, no GPU required.
| Layer | Tool | Purpose |
|---|---|---|
| Core | Manim Community Edition | Scene rendering, animation engine |
| Math | LaTeX (texlive/MiKTeX) | Equation rendering via |
| Video I/O | ffmpeg | Scene stitching, format conversion, audio muxing |
| TTS | ElevenLabs / Qwen3-TTS (optional) | Narration voiceover |
每个项目对应单个Python脚本。无需浏览器、Node.js或GPU。
| 层级 | 工具 | 用途 |
|---|---|---|
| 核心 | Manim Community Edition | 场景渲染、动画引擎 |
| 数学 | LaTeX (texlive/MiKTeX) | 通过 |
| 视频输入输出 | ffmpeg | 场景拼接、格式转换、音频混流 |
| 文本转语音 | ElevenLabs / Qwen3-TTS(可选) | 旁白配音 |
Pipeline
流程
PLAN --> CODE --> RENDER --> STITCH --> AUDIO (optional) --> REVIEW- PLAN — Write with narrative arc, scene list, visual elements, color palette, voiceover script
plan.md - CODE — Write with one class per scene, each independently renderable
script.py - RENDER — for draft,
manim -ql script.py Scene1 Scene2 ...for production-qh - STITCH — ffmpeg concat of scene clips into
final.mp4 - AUDIO (optional) — Add voiceover and/or background music via ffmpeg. See
references/rendering.md - REVIEW — Render preview stills, verify against plan, adjust
PLAN --> CODE --> RENDER --> STITCH --> AUDIO (optional) --> REVIEW- 规划 — 编写文件,包含叙事脉络、场景列表、视觉元素、配色方案、旁白脚本
plan.md - 编码 — 编写文件,每个场景对应一个类,每个类可独立渲染
script.py - 渲染 — 草稿版用,生产版用
manim -ql script.py Scene1 Scene2 ...-qh - 拼接 — 使用ffmpeg将场景片段拼接为
final.mp4 - 音频处理(可选) — 通过ffmpeg添加旁白和/或背景音乐。详见
references/rendering.md - 审核 — 渲染预览静帧,对照规划进行验证和调整
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
配色方案
| Palette | Background | Primary | Secondary | Accent | Use case |
|---|---|---|---|---|---|
| Classic 3B1B | | | | | General math/CS |
| Warm academic | | | | | Approachable |
| Neon tech | | | | | Systems, architecture |
| Monochrome | | | | | Minimalist |
| 配色 | 背景色 | 主色调 | 辅助色 | 强调色 | 适用场景 |
|---|---|---|---|---|---|
| 经典3B1B | | | | | 通用数学/计算机科学内容 |
| 温暖学术风 | | | | | 通俗易懂的内容 |
| 霓虹科技风 | | | | | 系统、架构类内容 |
| 单色极简风 | | | | | 极简风格内容 |
Animation Speed
动画速度
| Context | run_time | self.wait() after |
|---|---|---|
| Title/intro appear | 1.5s | 1.0s |
| Key equation reveal | 2.0s | 2.0s |
| Transform/morph | 1.5s | 1.5s |
| Supporting label | 0.8s | 0.5s |
| FadeOut cleanup | 0.5s | 0.3s |
| "Aha moment" reveal | 2.5s | 3.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
字体大小规范
| Role | Font size | Usage |
|---|---|---|
| Title | 48 | Scene titles, opening text |
| Heading | 36 | Section headers within a scene |
| Body | 30 | Explanatory text |
| Label | 24 | Annotations, axis labels |
| Caption | 20 | Subtitles, 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 for full recommendations.
references/visual-design.mdpython
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 for readability.
font_size=18所有文本均使用等宽字体。Manim的Pango渲染器在任何字号下,比例字体的字距都会出现问题。详见中的完整推荐。
references/visual-design.mdpython
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 . See for the comprehensive template.
plan.mdreferences/scene-planning.md在编写任何代码前,先写。完整模板详见。
plan.mdreferences/scene-planning.mdStep 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: or
self.add_subcaption("text", duration=N)onsubcaption="text"self.play() - Shared color constants at file top for cross-scene consistency
- set in every scene
self.camera.background_color - 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 # productionbash
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.mp4bash
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.mp4Step 5: Review
步骤5:审核
bash
manim -ql --format=png -s script.py Scene2_CoreConcept # preview stillbash
manim -ql --format=png -s script.py Scene2_CoreConcept # 预览静帧Critical Implementation Notes
关键实现注意事项
Raw Strings for LaTeX
LaTeX使用原始字符串
python
undefinedpython
undefinedWRONG: MathTex("\frac{1}{2}")
错误写法:MathTex("\frac{1}{2}")
RIGHT:
正确写法:
MathTex(r"\frac{1}{2}")
undefinedMathTex(r"\frac{1}{2}")
undefinedbuff >= 0.5 for Edge Text
边缘文本的buff值≥0.5
python
label.to_edge(DOWN, buff=0.5) # never < 0.5python
label.to_edge(DOWN, buff=0.5) # 不要小于0.5FadeOut Before Replacing Text
替换文本前先淡出
python
self.play(ReplacementTransform(note1, note2)) # not Write(note2) on toppython
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 animatepython
self.play(Create(circle)) # 必须先添加
self.play(circle.animate.set_color(RED)) # 再执行动画Performance Targets
性能指标
| Quality | Resolution | FPS | Speed |
|---|---|---|---|
| 854x480 | 15 | 5-15s/scene |
| 1280x720 | 30 | 15-60s/scene |
| 1920x1080 | 60 | 30-120s/scene |
Always iterate at . Only render for final output.
-ql-qh| 画质等级 | 分辨率 | FPS | 渲染速度 |
|---|---|---|---|
| 854x480 | 15 | 5-15秒/场景 |
| 1280x720 | 30 | 15-60秒/场景 |
| 1920x1080 | 60 | 30-120秒/场景 |
始终用迭代。仅在最终输出时使用渲染。
-ql-qhReferences
参考文档
| File | Contents |
|---|---|
| Core animations, rate functions, composition, |
| Text, shapes, VGroup/Group, positioning, styling, custom mobjects |
| 12 design principles, opacity layering, layout templates, color palettes |
| LaTeX in Manim, TransformMatchingTex, derivation patterns |
| Axes, plotting, BarChart, animated data, algorithm visualization |
| MovingCameraScene, ThreeDScene, 3D surfaces, camera control |
| Narrative arcs, layout templates, scene transitions, planning template |
| CLI reference, quality presets, ffmpeg, voiceover workflow, GIF export |
| LaTeX errors, animation errors, common mistakes, debugging |
| When to animate vs show static, decomposition, pacing, narration sync |
| ValueTracker, add_updater, always_redraw, time-based updaters, patterns |
| Turning research papers into animations — workflow, templates, domain patterns |
| SurroundingRectangle, Brace, arrows, DashedLine, Angle, annotation lifecycle |
| Pre-code, pre-render, post-render checklists, spatial layout, color, tempo |
| 文件 | 内容 |
|---|---|
| 核心动画、速率函数、组合、 |
| 文本、图形、VGroup/Group、定位、样式、自定义对象 |
| 12条设计原则、透明度分层、布局模板、配色方案 |
| Manim中的LaTeX使用、TransformMatchingTex、推导模式 |
| 坐标轴、绘图、BarChart、动画数据、算法可视化 |
| MovingCameraScene、ThreeDScene、3D曲面、相机控制 |
| 叙事脉络、布局模板、场景过渡、规划模板 |
| CLI参考、画质预设、ffmpeg、旁白工作流、GIF导出 |
| LaTeX错误、动画错误、常见问题、调试方法 |
| 何时用动画vs静态展示、分解方法、节奏、旁白同步 |
| ValueTracker、add_updater、always_redraw、基于时间的更新器、模式 |
| 将研究论文转化为动画的工作流、模板、领域模式 |
| SurroundingRectangle、Brace、箭头、DashedLine、Angle、注释生命周期 |
| 编码前、渲染前、渲染后检查清单、空间布局、颜色、节奏 |
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
假设反转法
- List what's "standard" about how this topic is visualized (left-to-right, 2D, discrete steps, formal notation)
- Pick the most fundamental assumption
- Reverse it (right-to-left derivation, 3D embedding of a 2D concept, continuous morphing instead of steps, zero notation)
- Explore what the reversal reveals that the standard approach hides
- 列出该主题可视化的“标准”做法(从左到右、2D展示、分步演示、正式符号)
- 挑选最核心的假设
- 反转该假设(从右到左推导、将2D概念嵌入3D空间、用连续变形替代分步演示、零符号)
- 探索反转后能揭示哪些标准方式隐藏的内容