← Back to Skills Marketplace
hzsunzixiang

Manim Animation En

by hzsunzixiang · GitHub ↗ · v1.0.3 · MIT-0
cross-platform ✓ Security Clean
174
Downloads
1
Stars
0
Active Installs
4
Versions
Install in OpenClaw
/install manim-animation-en
Description
Create mathematical animations with synchronized voiceover narration and subtitles using Manim Community and manim-voiceover. Use when users want to create a...
README (SKILL.md)

Manim Animation: Animation + Voiceover + Subtitle Generator

Author: ericksun(孙自翔)

Overview

This skill uses Manim Community to generate mathematical/educational animations, with manim-voiceover plugin integration for TTS voice narration and synchronized subtitles. All processing runs locally — no paid API required.

Core Capabilities:

  • 🎬 Animation Generation: Create animations of math formulas, geometric shapes, charts, and more with Manim
  • 🎙️ Voice Narration: Integrate TTS via manim-voiceover plugin with automatic animation-voice sync
  • 📝 Subtitle System: In-scene subtitles (Manim Text) + SRT external subtitles (ffmpeg burn-in)
  • 🔄 One-Click Pipeline: Describe requirements → Generate code → Render video → Burn subtitles

TTS Engines (gTTS preferred):

  • gTTS (Recommended): Google free TTS, supports Chinese, no API Key needed
  • pyttsx3 (Fallback): Offline TTS, no network required
  • Azure/OpenAI/ElevenLabs (High quality): Requires paid API Key

Prerequisites

🔍 One-Click Environment Check

Before first use, run the environment check script to verify all dependencies are ready:

python3 {SKILL_DIR}/scripts/check_environment.py

This script checks:

  • ✅ Manim Community installation (manim command)
  • ✅ manim-voiceover + gTTS plugin
  • ✅ FFmpeg + libx264 encoder (hardcoded Manim dependency, required)
  • ✅ FFmpeg + libass (for SRT subtitle burn-in)
  • ✅ Python dependencies
  • ✅ Chinese font availability

Required System Tools

  • Manim Community: pip install manim
  • FFmpeg (with libx264 + libass): Manim hardcodes the libx264 encoder for video rendering; subtitle burn-in requires libass
    • macOS (Homebrew): brew install ffmpeg (includes x264 and libass by default)
    • macOS (Conda): conda install x264 -c conda-forge (⚠️ conda's ffmpeg does not include libx264 by default)
    • Linux: sudo apt install ffmpeg libx264-dev libass-dev
  • Python 3.9+ and pip

Required Python Packages

# Core
pip install manim

# Voiceover + TTS
pip install "manim-voiceover[gtts]"

Optional (Enhanced Features)

  • pyttsx3: Offline TTS (pip install "manim-voiceover[pyttsx3]")

⚡ Quick Install

pip install manim "manim-voiceover[gtts]"

# macOS (Homebrew) — Recommended, includes libx264 + libass
brew install ffmpeg

# macOS (Conda) — Requires additional x264 install, otherwise Manim render will fail with UnknownCodecError: libx264
conda install x264 -c conda-forge

# Verify ffmpeg supports libx264 and libass
ffmpeg -codecs 2>&1 | grep libx264     # Should show: encoders: libx264
ffmpeg -filters 2>&1 | grep subtitles  # Should show: subtitles filter

Workflow

Quick Start — One-Click Run

After the user describes their requirements, use the pipeline script for one-click execution:

python3 {SKILL_DIR}/scripts/run_pipeline.py \
    --scene_file \x3Cscene_file.py> \
    --scene_name \x3CSceneName> \
    --quality high \
    --burn_subtitles

Common Options:

Option Default Description
--scene_file Required Manim scene Python file
--scene_name Required Scene class name
--quality high Render quality: low/medium/high/production
--burn_subtitles False Whether to burn SRT subtitles with ffmpeg
--speed 1.35 Playback speed multiplier (e.g., 1.35 means 1.35x speed; set to 1.0 to disable)
--preview False Auto-open preview after rendering
--output_dir ./output Output directory

Complete Workflow (4 Steps)

Step 1: Understand User Requirements and Generate Manim Scene Code

Based on the user's description, generate a Manim scene Python file. Scene code should follow these patterns:

No-voiceover mode (animation only):

from manim import *

class MyScene(Scene):
    def construct(self):
        title = Text("Title", font_size=48, color=BLUE)
        self.play(Write(title))
        self.wait(1)

Voiceover mode (animation + voice + subtitles):

from manim import *
from manim_voiceover import VoiceoverScene
from manim_voiceover.services.gtts import GTTSService

class MyScene(VoiceoverScene):
    def _make_subtitle(self, text_str):
        """Create subtitle with dark background at bottom of screen."""
        sub = Text(text_str, font_size=22, color=WHITE, weight=BOLD)
        # Prevent subtitle from overflowing left/right edges
        max_width = config.frame_width - 1.0  # 0.5 margin each side
        if sub.width > max_width:
            sub.scale_to_fit_width(max_width)
        sub.to_edge(DOWN, buff=0.4)
        bg = BackgroundRectangle(sub, color=BLACK, fill_opacity=0.6, buff=0.15)
        return VGroup(bg, sub)

    def construct(self):
        self.set_speech_service(GTTSService(lang="en"))

        sub_text = "Welcome to the demo"
        with self.voiceover(text=sub_text) as tracker:
            sub = self._make_subtitle(sub_text)
            title = Text("Demo", font_size=48)
            self.play(Write(title), FadeIn(sub), run_time=tracker.duration)

        self.play(FadeOut(sub))
        self.wait(0.3)

Key Pattern — voiceover context manager:

with self.voiceover(text="Speech text") as tracker:
    # tracker.duration = TTS speech duration (seconds)
    # Animations within this block auto-sync with voice
    self.play(SomeAnimation(), run_time=tracker.duration)

with self.voiceover(text=...) as tracker does three things:

  1. Calls the TTS engine to generate speech audio
  2. Automatically calculates speech duration
  3. Provides tracker.duration to sync animations with voice

Subtitle Best Practices:

  • In-scene subtitles: Use the _make_subtitle() helper to display white bold text with dark background at the bottom of the screen
  • Overflow prevention: _make_subtitle() auto-detects subtitle width and scales proportionally (scale_to_fit_width) when exceeding frame bounds; uses font_size=22 for long text
  • Subtitle sync: FadeIn(sub) in the first self.play() within the voiceover block ensures subtitles appear in sync with voice — do not delay
  • FadeIn subtitle at the start of each voiceover block, FadeOut after it ends
  • Subtitle text should match the voiceover text

⚠️ Avoid Double Subtitles: If the scene code already uses _make_subtitle() to render in-scene subtitles, do not also use --burn_subtitles to burn SRT subtitles, otherwise two overlapping subtitle layers will appear. Choose only one approach:

  • Option A (Recommended): Render subtitles in code with _make_subtitle(), do not burn SRT
  • Option B: Do not render subtitles in code, burn SRT via --burn_subtitles

Step 2: Configure Rendering Parameters

Create manim.cfg in the same directory as the scene file:

[CLI]
quality = high_quality
preview = False

[ffmpeg]
video_codec = h264

Quality Reference Table:

Quality Flag Resolution FPS manim.cfg Value
Low -ql 480p 15 low_quality
Medium -qm 720p 30 medium_quality
High -qh 1080p 60 high_quality
Production -qp 2160p 60 production_quality

Step 3: Render Video

manim render \x3Cscene_file.py> \x3CSceneName>

Output path pattern: media/videos/\x3Cfile>/\x3Cresolution>/\x3CSceneName>.mp4

Step 4: Burn SRT Subtitles (Optional)

manim-voiceover automatically generates .srt subtitle files in the same directory as the video. Burn with ffmpeg:

ffmpeg -y -i \x3Cvideo.mp4> \
    -vf "subtitles=\x3Csubtitle.srt>:force_style='FontSize=22,PrimaryColour=&H00FFFFFF,OutlineColour=&H00000000,Outline=2,BackColour=&H80000000,BorderStyle=4,MarginV=30'" \
    -c:a copy \
    \x3Coutput_subtitled.mp4>

⚠️ Double Subtitle Pitfall: If the scene Python code already renders in-scene subtitles with _make_subtitle(), do not also burn SRT subtitles, otherwise two overlapping subtitle layers will appear.

Note: ffmpeg requires libass support. On macOS, brew install ffmpeg typically includes it. Conda environments may require conda install x264 -c conda-forge.

Step 5: Speed Up Video (Optional)

Use ffmpeg to speed up the video, default 1.35x:

SPEED=1.35
ffmpeg -y -i \x3Cinput.mp4> \
    -filter_complex "[0:v]setpts=PTS/${SPEED}[v];[0:a]atempo=${SPEED}[a]" \
    -map "[v]" -map "[a]" \
    \x3Coutput_fast.mp4>

Note: Speed-up should be the final output step. If the scene code has in-scene subtitles (_make_subtitle), the speed-up input should use the original video (not the SRT-burned version) to avoid double subtitles. The run_pipeline.py --speed parameter handles this logic automatically.

Manim Common Animation Reference

Create/Display Animations

  • Write(text) — Write text
  • Create(mobject) — Draw shapes
  • FadeIn(mobject) / FadeOut(mobject) — Fade in/out
  • DrawBorderThenFill(mobject) — Draw border then fill

Transform Animations

  • Transform(source, target) — Morph
  • ReplacementTransform(source, target) — Replacement morph
  • TransformMatchingShapes(source, target) — Shape-matching morph

Move/Scale

  • mobject.animate.to_edge(UP) — Move to edge
  • mobject.animate.shift(RIGHT * 2) — Translate
  • mobject.animate.scale(2) — Scale
  • Rotate(mobject, angle=PI) — Rotate

Common Objects

  • Text("Text", font_size=48, color=BLUE) — Text
  • MathTex(r"e^{i\pi}+1=0") — LaTeX formula
  • Circle(radius=1, color=RED) — Circle
  • Square(side_length=2, color=GREEN) — Square
  • Arrow(start, end) — Arrow
  • NumberPlane() — Coordinate plane
  • Axes(x_range, y_range) — Axes

Grouping and Layout

  • VGroup(obj1, obj2) — Vertical group
  • group.arrange(RIGHT, buff=0.5) — Horizontal arrangement
  • BackgroundRectangle(obj, color=BLACK, fill_opacity=0.6) — Background rectangle

Known Issues and Solutions

⚠️ Missing libx264 Codec (Most Common Issue)

Symptom: UnknownCodecError: libx264

Root Cause: Manim hardcodes the libx264 encoder in scene_file_writer.py (cannot be overridden via config/cfg), but conda environment's ffmpeg is compiled with --disable-gpl and does not include the GPL-licensed libx264.

Solution:

# Conda environment (most common scenario)
conda install x264 -c conda-forge
# After installation, conda-forge's ffmpeg will auto-relink the x264 library

# Verify
ffmpeg -codecs 2>&1 | grep libx264
# Output should include: encoders: libx264 libx264rgb

Note: brew install ffmpeg installs ffmpeg with built-in x264, but conda environments prioritize their own ffmpeg and will not use the Homebrew version.

setuptools Compatibility

manim-voiceover depends on pkg_resources, which may fail on Python 3.12+:

pip install "setuptools>=69.0,\x3C72.0"

ffmpeg Missing libass

SRT subtitle burn-in requires libass. macOS:

brew install ffmpeg
# Verify
ffmpeg -filters 2>&1 | grep subtitles

Linux:

sudo apt install libass-dev
# May need to recompile ffmpeg

gTTS Network Issues

gTTS requires access to Google TTS service. If network is unavailable, switch to pyttsx3 offline engine:

from manim_voiceover.services.pyttsx3 import Pyttsx3Service
self.set_speech_service(Pyttsx3Service())

Chinese Fonts

Manim uses system fonts to render Text objects. Ensure Chinese fonts are available:

  • macOS: PingFang SC (built-in)
  • Linux: sudo apt install fonts-noto-cjk
  • Specify font: Text("Text", font="PingFang SC")

Related Resources

  • GitHub Repository: https://github.com/hzsunzixiang/manim-animation-skill
  • Manim Technical Guide: references/manim_guide.md — Detailed Manim + voiceover + subtitle technical documentation
  • Environment Check Script: scripts/check_environment.py — One-click dependency check
  • Render Pipeline Script: scripts/run_pipeline.py — One-click render + subtitle burn-in
Usage Guidance
This package appears to do what it says: generate and render Manim animations with optional TTS/subtitles. Before installing/using it: (1) ensure ffmpeg is installed with libx264 and libass as recommended (render/burn-in will fail otherwise); (2) be aware gTTS sends the narration text to Google's TTS service — avoid sending sensitive text to that engine or pick the offline pyttsx3 option; (3) carefully review any scene_file.py (especially if agent-generated or obtained from others) before rendering, because running manim executes arbitrary Python code; run in a sandbox or isolated environment if you have concerns; (4) the included scripts perform input validation and avoid shell=True usage, which is good, but they assume standard Unix tools (grep, fc-list, system_profiler) that may behave differently on Windows. If you accept those caveats, the skill is coherent and proportionate for its purpose.
Capability Analysis
Type: OpenClaw Skill Name: manim-animation-en Version: 1.0.3 The manim-animation-en skill bundle provides a legitimate environment for creating mathematical animations using Manim and manim-voiceover. It includes well-structured Python scripts (check_environment.py and run_pipeline.py) for dependency verification and video processing. These scripts demonstrate security awareness by using list-based subprocess calls and implementing input validation (e.g., validate_scene_name and validate_file_path) to prevent shell injection. The SKILL.md instructions are strictly focused on the stated purpose of animation generation and do not contain any malicious directives, data exfiltration logic, or obfuscated code. External network access is limited to the disclosed use of Google TTS for speech synthesis.
Capability Assessment
Purpose & Capability
The name/description (Manim animations with voiceover/subtitles) aligns with the required tools and files: SKILL.md, reference guide, environment check, and a pipeline script all target manim, manim-voiceover, and ffmpeg. No unrelated environment variables, binaries, or config paths are requested.
Instruction Scope
Runtime instructions are scoped to generating/managing Manim scene files, rendering with manim, burning SRT subtitles with ffmpeg, and using gTTS/pyttsx3 as TTS. The included scripts use subprocess.run with argument lists and input validation to avoid shell injection. Important security note: rendering runs manim on a Python scene file — any scene_file.py (including agent-generated or third-party files) is executed as Python code, so users should review or sandbox scene files before running the pipeline. Also, gTTS is a network TTS (text is sent to Google) — privacy consideration.
Install Mechanism
No install spec in the registry (instruction-only skill). SKILL.md recommends installing manim and manim-voiceover via pip and ffmpeg via package managers (brew/apt/conda). No arbitrary downloads or obscure installers are proposed. The install guidance is proportional to the toolchain.
Credentials
The skill does not request secrets, API keys, or environment variables. It documents optional paid TTS providers that would require their own API keys, but these are optional and not required for default operation. No config paths or credentials for unrelated services are requested.
Persistence & Privilege
Skill flags show always:false and normal invocation behavior. The skill does not request permanent presence or attempt to modify other skills or system-wide agent settings. Included scripts read/write within the working/media directories consistent with rendering workflows.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install manim-animation-en
  3. After installation, invoke the skill by name or use /manim-animation-en
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.3
Add required_tools (manim, ffmpeg with libx264+libass, python3), required_packages, and network_access metadata to SKILL.md frontmatter. Addresses OpenClaw finding about missing binary declarations.
v1.0.2
- No changes in this version; no file modifications detected. - All features, dependencies, and workflow remain as previously documented.
v1.0.1
Security fix: remove shell=True command injection risk in run_pipeline.py and check_environment.py. Use subprocess argument lists instead of shell strings, add input validation for scene_name and file paths, replace os.system with subprocess.run.
v1.0.0
manim-animation-en v1.0.0 - Initial release of the skill to generate mathematical/educational animations with synchronized voiceover narration and subtitles using Manim Community and manim-voiceover. - Supports both on-screen and external SRT subtitles, with flexible TTS engine options (gTTS recommended). - Provides a one-click pipeline for code generation, rendering, and subtitle burn-in. - Includes comprehensive instructions for environment setup, required system tools, and workflow best practices. - Offers a robust pattern for Manim scene code with voice and subtitle synchronization.
Metadata
Slug manim-animation-en
Version 1.0.3
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 4
Frequently Asked Questions

What is Manim Animation En?

Create mathematical animations with synchronized voiceover narration and subtitles using Manim Community and manim-voiceover. Use when users want to create a... It is an AI Agent Skill for Claude Code / OpenClaw, with 174 downloads so far.

How do I install Manim Animation En?

Run "/install manim-animation-en" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Manim Animation En free?

Yes, Manim Animation En is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does Manim Animation En support?

Manim Animation En is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Manim Animation En?

It is built and maintained by hzsunzixiang (@hzsunzixiang); the current version is v1.0.3.

💬 Comments