| name | manim-video |
| description | Production pipeline for mathematical and technical animations using Manim
Community Edition. Creates 3Blue1Brown-style explainer videos, algorithm
visualizations, equation derivations, architecture diagrams, and data
stories. 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.
|
| version | 1.0.0 |
Manim Video Production Pipeline
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.
Prerequisites
Requires: Python 3.12+ (matching media-tooling package requirement), Manim Community Edition v0.20+ (pip install "manim>=0.20"), LaTeX (texlive-full on Linux, mactex on macOS), and ffmpeg. Reference docs tested against Manim CE v0.20.1.
Install the optional animations group:
pip install "media-tooling[animations]"
Modes
| Mode | Input | Output | Reference |
|---|
| Concept explainer | Topic/concept | Animated explanation with geometric intuition | references/scene-planning.md |
| Equation derivation | Math expressions | Step-by-step animated proof | references/equations.md |
| Algorithm visualization | Algorithm description | Step-by-step execution with data structures | references/animations.md |
| Data story | Data/metrics | Animated charts, comparisons, counters | references/animations.md |
| Architecture diagram | System description | Components building up with connections | references/mobjects.md |
| Paper explainer | Research paper | Key findings and methods animated | references/scene-planning.md |
| 3D visualization | 3D concept | Rotating surfaces, parametric curves, spatial geometry | Manim docs (ThreeDScene, Surface) |
| Custom | Free-form request | User-directed animation pipeline | references/production-quality.md |
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 MathTex |
| Video I/O | ffmpeg | Scene stitching, format conversion, audio muxing |
| TTS | Provider-specific TTS (optional) | Narration audio generated outside Manim |
Pipeline
PLAN --> CODE --> RENDER --> STITCH --> AUDIO (optional) --> REVIEW
- PLAN — Write
plan.md with narrative arc, scene list, visual elements, color palette, voiceover script. See references/scene-planning.md for the comprehensive template.
- CODE — Write
script.py with one class per scene, each independently renderable.
- RENDER —
manim -ql script.py Scene1 Scene2 ... for draft, -qh for production. See references/rendering.md for CLI reference and quality presets.
- STITCH — ffmpeg concat of scene clips into
final.mp4.
- AUDIO (optional) — Add pre-rendered narration and/or background music via ffmpeg. See
references/rendering.md.
- REVIEW — Render preview stills, verify against plan, adjust. See
references/production-quality.md for checklists.
Worker/subagent use
If the harness supports workers, use them after the global plan.md exists and
only for disjoint scene or review work. The main thread owns the narrative arc,
shared palette, typography constants, final script.py integration, stitching,
and user-facing review.
Use workers to isolate scene-specific scratch context and handoffs, not to
increase concurrent rendering.
Good worker scopes:
- implement one named scene class from the plan
- render/check one scene and report visual defects
- prototype one optional animation motif in a scratch file
Each worker prompt should include the relevant plan excerpt, shared constants,
target scene name, output directory, and constraints from this skill. Ask the
worker to return only files changed, render commands run, output paths,
screenshots/stills produced, and integration notes. Keep failed experiments and
long aesthetic reasoning out of the main thread unless they affect the final
design.
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/
Creative Direction
Color Palettes
| Palette | Background | Primary | Secondary | Accent | Use 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 |
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 |
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 |
Fonts
Use monospace fonts for all text. Manim's Pango renderer produces broken kerning with proportional fonts at all sizes.
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")
Minimum font_size=18 for readability.
Easing Rules
Cubic easing only for entry/exit/draw animations. Never linear. Linear easing produces mechanical, robotic motion that breaks visual immersion.
Exception: Continuous-motion animations (e.g., Rotating) use rate_func=linear correctly — a spinning gear should not ease in/out.
self.play(FadeIn(mob), rate_func=smooth)
self.play(Create(mob), rate_func=rush_from)
self.play(FadeOut(mob), rate_func=rush_into)
self.play(Rotating(gear, angle=TAU, run_time=4, rate_func=linear))
self.play(FadeIn(mob), rate_func=linear)
Recommended cubic rate functions: smooth (ease in/out), rush_into (ease in cubic), rush_from (ease out cubic), double_smooth. See references/animations.md for the full list including pattern functions like there_and_back_with_pause.
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
Workflow
Step 1: Plan (plan.md)
Before any code, write plan.md. See references/scene-planning.md for the comprehensive template.
Step 2: Code (script.py)
One class per scene. Every scene is independently renderable.
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.wait(0.3)
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)))
Step 3: Render
manim -ql script.py Scene1_Introduction Scene2_CoreConcept
manim -qh script.py Scene1_Introduction Scene2_CoreConcept
Step 4: Stitch
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
manim -ql --format=png -s script.py Scene2_CoreConcept
Critical Implementation Notes
Raw Strings for LaTeX
MathTex(r"\frac{1}{2}")
buff >= 0.5 for Edge Text
label.to_edge(DOWN, buff=0.5)
Use ReplacementTransform for Text Changes
self.play(ReplacementTransform(note1, note2))
Never Animate Non-Added Mobjects
circle = Circle()
self.play(circle.animate.set_color(RED))
self.add(circle)
self.play(circle.animate.set_color(RED))
self.play(Create(circle))
self.play(circle.animate.set_color(RED))
Performance Targets
| Quality | Resolution | FPS | Speed |
|---|
-ql (draft) | 854x480 | 15 | 5-15s/scene |
-qm (medium) | 1280x720 | 30 | 15-60s/scene |
-qh (production) | 1920x1080 | 60 | 30-120s/scene |
Always iterate at -ql. Only render -qh for final output.
References
| File | Contents |
|---|
references/animations.md | Core animations, rate functions, composition, .animate syntax, timing patterns |
references/mobjects.md | Text, shapes, VGroup/Group, positioning, styling, custom mobjects |
references/scene-planning.md | Narrative arcs, layout templates, scene transitions, planning template |
references/production-quality.md | Pre-code, pre-render, post-render checklists, spatial layout, color, tempo |
references/rendering.md | CLI reference, quality presets, ffmpeg, voiceover workflow, GIF export |
references/equations.md | LaTeX in Manim, TransformMatchingTex, derivation patterns |
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 Transformation
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)
- Adapt: borrow a technique from a different domain (physics metaphor for economics, music notation for signal processing)
- Modify: exaggerate a parameter to show why it matters (10x the learning rate, 1000x the sample size)
- Put to other use: repurpose a visual for a new audience (expert diagram → beginner walkthrough)
- Eliminate: remove all notation — explain purely through animation and spatial relationships
- Reverse: derive backward — start from the result and deconstruct to axioms
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