# Manim Video

> Create production-quality Manim Community Edition explainer videos, math animations, algorithm visualizations, paper/PDF explainers, data stories, and architecture diagrams. Use when a user asks for 3Blue1Brown-style programmatic animation, Manim scene planning/coding/rendering, Docker-based Manim setup, or troubleshooting Manim renders.

- **Type:** Skill
- **Install:** `agentstack add skill-apliroai-manim-video-lab-manim-video-lab`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [ApliroAI](https://agentstack.voostack.com/s/apliroai)
- **Installs:** 0
- **Category:** [Cloud & Infrastructure](https://agentstack.voostack.com/c/cloud-infrastructure)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [ApliroAI](https://github.com/ApliroAI)
- **Source:** https://github.com/ApliroAI/manim-video-lab

## Install

```sh
agentstack add skill-apliroai-manim-video-lab-manim-video-lab
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Manim Video Lab Production Pipeline

## Scope

Create 3Blue1Brown-style explainer videos, algorithm visualizations, equation derivations, architecture diagrams, research-paper explainers, and data stories using Manim Community Edition.

## Attribution

Use this skill as an independent workflow helper built with gratitude for Manim, the open-source mathematical animation engine originally written by Grant Sanderson and now maintained by the Manim Community. Do not imply affiliation with or endorsement by Grant Sanderson, 3Blue1Brown, or the Manim Community.

## 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.

**Design for first-render excellence.** The draft should be visually clear and aesthetically cohesive before review. Use the bounded review loop to verify rendered evidence and make targeted fixes, not to rescue vague planning.

**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.

For premium, dynamic, research-teaser-style output, read `references/director-packet.md` before coding, then run `references/preflight-gates.md`. Use `references/cinematic-directing.md`, choose a scene architecture from `references/source-backed-patterns.md`, and apply `references/codegen-craft.md` while writing Manim code. Together they define the directing contract, stable scaffolds, semantic beats, protected overlays, attention handoffs, live dependency motion, source anchors, deterministic gates, implementation craft, and final hero landings.

## Prerequisites

Docker is the default runtime. Run `scripts/setup.sh` on macOS/Linux/WSL/Git Bash or `scripts\setup.ps1` on Windows PowerShell from this skill folder to build and verify the local `manim-video-runtime:v0.20.1` image from the pinned `manimcommunity/manim:v0.20.1` base plus ffmpeg. The host only needs Docker plus Bash or PowerShell; Python, Manim, LaTeX, and ffmpeg run inside the container. Reference docs tested against Manim CE v0.20.1.

Use local `manim`, `pdflatex`, or `ffmpeg` only when the user explicitly requests a host install or Docker is unavailable.

## Portable Skill Contract

This is an Agent Skills-compatible folder, not a Codex-only folder. The portable core is:

```
SKILL.md + scripts/ + references/
```

Keep this folder together when installing into any agent or tool:

```
manim-video/
  Dockerfile
  SKILL.md
  scripts/      # Bash and PowerShell Docker wrappers
  references/
  agents/        # optional OpenAI/Codex UI metadata; safe for other tools to ignore
```

Install the folder as `manim-video` so the directory name matches `name: manim-video` in this file.

For cross-client project installs, copy the whole folder to `.agents/skills/manim-video/`. For user-level cross-client installs, use `~/.agents/skills/manim-video/`. For Claude Code, `.claude/skills/manim-video/` and `~/.claude/skills/manim-video/` are also valid. For Codex, use `${CODEX_HOME:-$HOME/.codex}/skills/manim-video/`. For Antigravity, OpenCode, VS Code/Copilot, Goose, Amp, and similar tools, use `.agents/skills/` when supported or the tool's configured skills directory.

Agents should read `SKILL.md`, load only the relevant `references/*.md` files, and run the Docker wrappers from the project directory.

Render wrapper:

```bash
/path/to/manim-video/scripts/manim.sh -ql script.py Scene1
```

Windows PowerShell:

```powershell
& "C:\path\to\manim-video\scripts\manim.ps1" -ql script.py Scene1
```

ffmpeg wrapper:

```bash
mkdir -p outputs
/path/to/manim-video/scripts/ffmpeg.sh -y -f concat -safe 0 -i concat.txt -c copy outputs/final.mp4
```

Windows PowerShell:

```powershell
New-Item -ItemType Directory -Force outputs
& "C:\path\to\manim-video\scripts\ffmpeg.ps1" -y -f concat -safe 0 -i concat.txt -c copy outputs/final.mp4
```

The wrappers mount the current project directory into the container at `/manim`. Set `MANIM_PROJECT_DIR=/path/to/project` or `$env:MANIM_PROJECT_DIR = "C:\path\to\project"` when the shell cannot run from the project directory. Set `MANIM_BASE_IMAGE=manimcommunity/manim:stable` and rerun `scripts/setup.sh --rebuild` or set `$env:MANIM_BASE_IMAGE = "manimcommunity/manim:stable"` and run `scripts\setup.ps1 -Rebuild` to rebuild from the latest Manim release. Set `MANIM_DOCKER_IMAGE=your-image` to use a fully custom runtime.

The Bash and PowerShell wrappers accept the same Manim/ffmpeg arguments. For Windows, map later `/path/to/manim-video/scripts/*.sh` examples to `C:\path\to\manim-video\scripts\*.ps1`.

## 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/graphs-and-data.md` |
| **Data story** | Data/metrics | Animated charts, comparisons, counters | `references/graphs-and-data.md` |
| **Architecture diagram** | System description | Components building up with connections | `references/mobjects.md` |
| **Paper explainer** | Research paper or attached PDF | Source-grounded claim, method, evidence, visuals, and limitations animated | `references/paper-explainer.md` |
| **3D visualization** | 3D concept | Rotating surfaces, parametric curves, spatial geometry | `references/camera-and-3d.md` |

## Stack

Single Python script per project. Docker supplies the render stack. No browser, Node.js, GPU, or host LaTeX install required.

| Layer | Tool | Purpose |
|-------|------|---------|
| Core | Manim Community Edition in Docker | Scene rendering, animation engine |
| Math | Container LaTeX | Equation rendering via `MathTex` |
| Video I/O | Container ffmpeg | Scene stitching, format conversion, audio muxing |
| TTS | ElevenLabs / Qwen3-TTS (optional) | Narration voiceover |

## Pipeline

```
PLAN --> GATE --> CODE --> RENDER --> STITCH --> AUDIO (optional) --> REVIEW
```

1. **PLAN** — Write `plan.md` with narrative arc, continuity architecture, scene list, visual elements, color palette, voiceover script, and a director packet for complex scenes
2. **GATE** — For ambitious output, run the contract, prompt-preservation, LMIR, operator, camera/pacing, assertion, and source-anchor gates in `references/preflight-gates.md`; fix `plan.md` before coding if gates fail
3. **CODE** — Write `script.py` with one class per justified scene segment, not one class per beat; keep each class independently renderable and source-anchored to the packet; for premium scenes, apply `references/codegen-craft.md`
4. **RENDER** — `/path/to/manim-video/scripts/manim.sh -ql script.py Scene1 Scene2 ...` or `scripts\manim.ps1 -ql script.py Scene1 Scene2 ...` for draft, `-qh` for production
5. **STITCH** — `/path/to/manim-video/scripts/ffmpeg.sh` or `scripts\ffmpeg.ps1` concat of scene clips into `outputs/final.mp4`
6. **AUDIO** (optional) — Add voiceover and/or background music via the ffmpeg wrapper. See `references/rendering.md`
7. **REVIEW** — Run the feedback loop in `references/review-loop.md`: direct video review when available, or ffmpeg frame extraction fallback

## Project Structure

```
project-name/
  plan.md                # Narrative arc, scene breakdown
  script.py              # All scenes in one file
  concat.txt             # Temporary ffmpeg scene list
  outputs/               # Final/shareable exports
    final.mp4
  media/                 # Auto-generated by Manim
    videos/script/480p15/
```

### Artifact Hygiene

Docker runs with `--rm`, so the container is removed after each wrapper command. Files written under the mounted `/manim` directory are local project files and persist after Docker exits.

Keep generated files organized:
- Put final/shareable videos under `outputs/`, not loose in the project root.
- After an accepted single-scene render, copy the chosen Manim render from `media/videos/...` into `outputs/` and present that `outputs/...` file as the primary final path.
- Treat `media/` as Manim's generated render cache/output, not the canonical final location; it can be deleted and regenerated.
- Treat `review-frames/`, `concat.txt`, and `audio_concat.txt` as temporary review/stitching artifacts. Remove or overwrite them before final handoff so stale review frames do not accumulate.
- Do not copy videos into hidden tool or agent cache directories such as `.gemini/.../brain`, `.codex/`, `.agents/`, or UI-specific artifact stores unless the host tool explicitly requires an embedded artifact. If a host tool creates a secondary artifact copy, disclose it as secondary and keep `outputs/` as the user-facing source of truth.
- Do not delete `script.py`, `plan.md`, source assets, narration files, or final files under `outputs/` unless the user explicitly asks.

## 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

Prefer monospace fonts for labels, captions, code, and body text. Manim's Pango renderer can produce inconsistent proportional-font kerning in Docker, especially at small sizes. See `references/visual-design.md` for full recommendations.

```python
MONO = "Noto Sans Mono"  # Docker-safe; define once at top of file

Text("Fourier Series", font_size=48, font=MONO, weight=BOLD)  # title
Text("n=1: sin(x)", font_size=20, font=MONO)                  # labels
MathTex(r"\nabla L")                                            # math (uses LaTeX)
```

Minimum `font_size=18` for readability.

### Purposeful Continuity And Variation

Do not randomize style just to avoid sameness. Preserve semantic color, spatial roles, and motion vocabulary across connected scenes. Vary only when the meaning changes:
- **Color** changes only when the concept or role changes; the same concept keeps the same color.
- **Layout** changes only for a new scene family, comparison, density failure, or semantic reset.
- **Animation entry** matches the visual function: `Create` for geometry, `Transform*` for continuity, `FadeIn` for supporting context, `Write` for notation/text.
- **Visual weight** follows the beat: quiet setup, active mechanism, readable payoff.

## Workflow

### Step 1: Plan (plan.md)

Before any code, write `plan.md`. See `references/scene-planning.md` for the comprehensive template. Decide continuity architecture early: use one continuous canvas by default, and split scenes only with a specific reason and state handoff. For ambitious or "world-class" animations, also use `references/director-packet.md`, `references/preflight-gates.md`, `references/cinematic-directing.md`, `references/source-backed-patterns.md`, and `references/codegen-craft.md`; define a beat list with focus, mechanism, camera, memory, landing, selected pattern stack, source anchor requirements, and pre-code gate results for each complex scene.

### Step 2: Code (script.py)

Use one class per justified scene segment. Do not split every beat into a class. Prefer one continuous class when the same scaffold, symbols, or comparison should stay in memory; split only for a domain shift, hard reset, renderer/API reason, runtime isolation, or density failure with a state handoff. Every class should still be independently renderable.

```python
from manim import *

BG = "#1C1C1C"
PRIMARY = "#58C4DD"
SECONDARY = "#83C167"
ACCENT = "#FFFF00"
MONO = "Noto Sans Mono"

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
- **Scene exits** — carry, park, or transform context forward when continuity matters. Use `self.play(FadeOut(Group(*self.mobjects)))` only for final cleanup or a director-packet semantic reset.

### Step 3: Render

```bash
/path/to/manim-video/scripts/manim.sh -ql script.py Scene1_Introduction Scene2_CoreConcept  # draft
/path/to/manim-video/scripts/manim.sh -qh script.py Scene1_Introduction Scene2_CoreConcept  # production
```

### Step 4: Stitch

```bash
cat > concat.txt = 0.5 for Edge Text
```python
label.to_edge(DOWN, buff=0.5)  # never < 0.5
```

### FadeOut Before Replacing Text
```python
self.play(ReplacementTransform(note1, note2))  # not Write(note2) on top
```

### Never Animate Non-Added Mobjects
```python
self.play(Create(circle))  # must add first
self.play(circle.animate.set_color(RED))  # then animate
```

## 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/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`

…

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [ApliroAI](https://github.com/ApliroAI)
- **Source:** [ApliroAI/manim-video-lab](https://github.com/ApliroAI/manim-video-lab)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-apliroai-manim-video-lab-manim-video-lab
- Seller: https://agentstack.voostack.com/s/apliroai
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
