showlab/Code2Video: Generate Educational Videos from Manim Code
showlab/Code2Video: Generate Educational Videos from Manim Code
Educational content creation remains a bottleneck for developers, educators, and technical communicators. Recording screencasts, editing animations, and ensuring visual clarity consumes hours that could go toward actual teaching. Pixel-based text-to-video models promise automation but often produce incoherent results for technical subjects—equations blur, diagrams misalign, and the underlying logic becomes unverifiable. showlab/Code2Video addresses this gap by treating executable code, not pixels, as the primary medium for video generation. This article examines how this ICML 2026-accepted framework uses a tri-agent system and Manim code to produce reproducible, knowledge-dense educational videos.
What is showlab/Code2Video?
showlab/Code2Video is an open-source, agentic framework developed by Show Lab at the National University of Singapore. Led by Yanzhe Chen, Kevin Qinghong Lin, and Mike Zheng Shou, the project reimagines educational video generation through a code-centric paradigm rather than conventional diffusion-based video synthesis.
The framework's core insight: Manim code—the same animation engine Grant Sanderson uses for 3Blue1Brown videos—serves as both the authoring language and the rendered output. This makes every video frame deterministic, editable, and inspectable. As of the latest commit (May 31, 2026), the repository has accumulated 1,862 stars and 262 forks, with an MIT License permitting broad commercial and academic use. The primary implementation language is Python↗ Bright Coding Blog.
The project was accepted to ICML 2026 and previously to the DL4C Workshop at NeurIPS 2025. Its accompanying benchmark, MMMC (Massive Multi-Topic Manim Collection), covers 117 curated learning topics inspired by 3Blue1Brown content, establishing the first systematic evaluation suite for code-driven video generation.
Unlike end-to-end neural video generators, showlab/Code2Video does not hallucinate pixels. It plans, codes, critiques, and executes—producing videos where every visual element has a programmatic source of truth.
Key Features
🎬 Code-Centric Paradigm
The framework treats executable Manim code as the unified medium for temporal sequencing and spatial organization. This eliminates the opacity of latent video representations. Editors can inspect, version-control, and modify the source code directly—something impossible with pure neural outputs.
🤖 Modular Tri-Agent Design
Three specialized agents collaborate in a pipeline:
- Planner: Expands knowledge points into structured storyboards, determining narrative flow and visual pacing.
- Coder: Synthesizes debuggable Manim code. The README notes that Claude-4-Opus achieves the best code quality for this stage.
- Critic: Refines layout using anchor-based optimization, with Gemini-2.5-pro-preview-05-06 recommended for visual aesthetics assessment.
This separation of concerns mirrors professional animation workflows—pre-production, production, and post-production—while automating each stage.
📚 MMMC Benchmark
The first dedicated benchmark for code-driven video generation, MMMC provides ground-truth human-made videos and metadata for 117 topics spanning mathematics, computer science, and physics. It enables quantitative comparison across efficiency, aesthetic quality, and—critically—end-to-end knowledge transfer.
🧪 Multi-Dimensional Evaluation
The framework assesses outputs on three axes: TeachQuiz (does the video actually teach?), AES (aesthetic and structural quality), and efficiency metrics (token usage, execution time). This reflects the authors' recognition that educational video quality cannot be reduced to pixel fidelity alone.
Use Cases
1. Technical Course Production
Instructors creating MOOCs or internal training can generate explainer videos for concepts like "Linear transformations and matrices" or "Pure Fourier Series" without manual animation. The Manim output matches the visual clarity that makes 3Blue1Brown effective.
2. Algorithm Visualization
The README highlights the Hanoi Problem as a benchmark topic. Recursive algorithms, graph traversals, and dynamic programming solutions all benefit from precise, code-generated animations where state transitions are mathematically exact rather than approximated.
3. Research Communication
ML practitioners can illustrate architecture diagrams, attention mechanisms, or training dynamics. The [INTERNAL_LINK: machine-learning-visualization-tools] ecosystem increasingly values reproducible figures; showlab/Code2Video extends this to full motion.
4. Documentation and Developer Advocacy
API documentation, SDK tutorials, and open-source project explainers gain production value without video editing expertise. The framework's parallel generation support (PARALLEL_GROUP_NUM) enables batch production of topic series.
5. Benchmarking and Methodology Research
The MMMC dataset and evaluation scripts provide a standardized testbed for researchers comparing video generation approaches—particularly those exploring hybrid neuro-symbolic methods.
Installation & Setup
The setup process involves three stages: dependency installation, API credential configuration, and agent execution.
Step 1: Install Requirements
cd src/
pip install -r requirements.txt
The framework depends on Manim Community v0.19.0. The README explicitly links to the official Manim installation guide, which varies by operating system. Do not skip this—the rendering backend requires correct LaTeX and FFmpeg setup.
Step 2: Configure API Keys
Create and populate api_config.json with credentials for three services:
| API Type | Purpose | Recommended Model |
|---|---|---|
| LLM API | Planner & Coder | Claude-4-Opus |
| VLM API | Planner Critic (layout/aesthetics) | gemini-2.5-pro-preview-05-06 |
| Visual Assets API | Icon enrichment | ICONFINDER_API_KEY |
The ICONFINDER_API_KEY enables automatic icon collection for visual enrichment. Note the README's update (October 11, 2025): due to ICONFINDER issues, auto-collected icons are temporarily available via the MMMC HuggingFace dataset.
Step 3: Run Generation Agents
Two scripts cover different use cases:
Single topic generation:
sh run_agent_single.sh --knowledge_point "Linear transformations and matrices"
Batch benchmark execution:
sh run_agent.sh
The batch script processes topics from long_video_topics_list.json, with MAX_CONCEPTS controlling scope (-1 for all) and PARALLEL_GROUP_NUM enabling concurrent execution.
Real Code Examples
The README provides shell-level invocation examples rather than internal Python APIs. These represent the actual documented interface:
Example 1: Single Knowledge Point Generation
# Inside run_agent_single.sh, the key parameter is KNOWLEDGE_POINT
sh run_agent_single.sh --knowledge_point "Linear transformations and matrices"
This executes the full tri-agent pipeline: the Planner decomposes the topic into scenes, the Coder generates Manim code, and the Critic iterates on layout. Output lands in CASES/TEST-single/ by default, with FOLDER_PREFIX customizable.
Example 2: Batch Benchmark Execution
# run_agent.sh with default parameters processes the full MMMC topic list
sh run_agent.sh
Critical parameters inside run_agent.sh:
# API: which LLM backend to invoke
API="claude-4-opus" # or your configured endpoint
# FOLDER_PREFIX: organizes output under CASES/
FOLDER_PREFIX="TEST-LIST"
# MAX_CONCEPTS: -1 for all 117 topics, or limit for testing
MAX_CONCEPTS=-1
# PARALLEL_GROUP_NUM: concurrent agent groups
PARALLEL_GROUP_NUM=4
The parallel execution design acknowledges that educational video generation is compute-intensive—multiple LLM calls, Manim rendering, and VLM critique loops benefit from concurrency.
Example 3: Evaluation Pipeline
# Knowledge transfer evaluation
python3 eval_TQ.py
# Aesthetic and structural quality evaluation
python3 eval_AES.py
These scripts implement the paper's proposed metrics. eval_TQ.py likely measures whether generated videos enable learning (via quiz performance), while eval_AES.py assesses visual quality against human-made 3Blue1Brown references.
Advanced Usage & Best Practices
Model Selection Matters: The README's explicit quality rankings—Claude-4-Opus for code, Gemini-2.5-pro for visual critique—are based on empirical testing. Substituting cheaper models likely degrades output. Budget accordingly.
Icon Fallback Strategy: Given documented ICONFINDER instability, pin your workflow to the HuggingFace-hosted MMMC assets or maintain local icon caches in assets/icons/.
Parallelism Tuning: PARALLEL_GROUP_NUM should match your API rate limits and local rendering capacity. Manim is CPU/GPU-intensive; oversubscription causes thrashing.
Version Control Outputs: Since videos derive from code, commit the generated Manim scripts alongside rendered MP4s. This enables diff-based review of content changes—impossible with pure video files.
Evaluation-Driven Iteration: Run eval_TQ.py and eval_AES.py before human review. The framework's systematic metrics reduce subjective quality debates in team settings.
Comparison with Alternatives
| Dimension | showlab/Code2Video | Veo3 | Wan2.2 |
|---|---|---|---|
| Output medium | Executable Manim code | Neural video pixels | Neural video pixels |
| Editability | Full source code access | None (black-box) | None (black-box) |
| Reproducibility | Deterministic rendering | Stochastic sampling | Stochastic sampling |
| Knowledge fidelity | High (programmatic accuracy) | Variable | Variable |
| Aesthetic ceiling | Bounded by Manim/3B1B style | Higher visual variety | Higher visual variety |
| Use case fit | Technical education | General video generation | General video generation |
The README's comparison table (Hanoi Problem, LLM, Fourier Series) illustrates a consistent pattern: Veo3 and Wan2.2 produce visually plausible but often technically incorrect animations, while showlab/Code2Video maintains structural fidelity. The trade-off is aesthetic range—Manim's mathematical visual style is distinctive but not universally appropriate.
FAQ
What LLM do I need? Claude-4-Opus is recommended for the Coder agent; any configured LLM will run, but output quality varies.
Is this free to use? Yes, MIT License. You pay for API calls to your chosen LLM/VLM providers.
Can I use my own icons?
Yes—place them in assets/icons/ or configure ICONFINDER_API_KEY.
Does it work offline? Partially. Manim rendering is local, but agent planning requires LLM API access.
How long does generation take?
The README does not specify; efficiency metrics are collected per-run via eval_AES.py.
What's the video resolution?
The Hanoi example references Hanoi_4K_SpeedUp.gif—4K output is achievable.
Where do I report issues? The GitHub repository at https://github.com/showlab/Code2Video.
Conclusion
showlab/Code2Video occupies a specific, valuable niche: educational video generation where correctness trumps visual spectacle. Its code-centric approach—executable Manim as the single source of truth—solves the reproducibility crisis inherent in neural video models. The tri-agent architecture (Planner, Coder, Critic) and MMMC benchmark demonstrate serious systems thinking rather than a wrapper around existing APIs.
This framework suits technical educators, course platform engineers, and research communicators who need precise, version-controlled animations. It is less appropriate for creative storytelling or scenarios requiring photorealism.
The 1,862-star traction and ICML 2026 acceptance suggest the research community recognizes this direction. For practitioners ready to explore code-driven video generation, start with the repository's single-topic script and scale via batch execution.
Explore the code, dataset, and paper at https://github.com/showlab/Code2Video — and star the repository for updates.
Outils recommandés
Explore on the BrightCoding network
Hand-picked resources from our other sites.
peteromallet/desloppify: Agent Harness for Systematic Code Improvement
peteromallet/desloppify is a Python-based agent harness that combines mechanical code detection with LLM-driven subjective review to help AI coding agents syste...
OWASP/Nettacker: Automate Penetration Testing and Network Audits
OWASP Nettacker is an open-source Python framework for automated penetration testing with modular scanning, drift detection, and CLI/API/Web UI interfaces. 5,31...
abus-aikorea/voice-pro: Open-Source AI Dubbing with Whisper, F5-TTS & Gradio
Voice-Pro is a free, open-source Gradio WebUI that integrates Whisper ASR, F5-TTS/CosyVoice voice cloning, and multilingual translation into a single local appl...
Continuez votre lecture
Why Alexandrie is the Ultimate Markdown Note-Taking App
Why CrossPaste is the Ultimate Game Changer for Clipboard Management
Why Chandra is the Ultimate OCR Tool for Handwriting and Tables
Stop Coding Alone: OPC-Skills Gives Your AI Agent Superpowers
Commentaires 0
Aucun commentaire pour l'instant. Soyez le premier à réagir !