LinuxCommandLibrary

manim

Render mathematical animations from Python scripts

TLDR

Render a scene from a Python script using the default settings

$ manim [path/to/file.py] [SceneName]
copy

Render with live preview (auto-opens the video file after rendering)
$ manim [[-pql|--preview --quality low]] [path/to/file.py] [SceneName]
copy

Render at high quality (1080p 60fps)
$ manim [[-pqh|--preview --quality high]] [path/to/file.py] [SceneName]
copy

Specify a custom output file name
$ manim [[-o|--output_file]] [output_file_name] [path/to/file.py] [SceneName]
copy

Render using a specific resolution and frame rate
$ manim [[-r|--resolution]] [1920,1080] [[-f|--fps]] [60] [path/to/file.py] [SceneName]
copy

List available scenes in a file without rendering
$ manim --list_scenes [path/to/file.py]
copy

Display help
$ manim --help
copy

SYNOPSIS

manim [OPTIONS] FILE [SCENE_NAMES...]

FILE: The path to the Python script containing Manim scene definitions.
[SCENE_NAMES...]: Optional. One or more names of specific Manim scene classes to render from the file. If omitted, all scenes marked for rendering will be processed.

PARAMETERS

-p, --preview
    Renders the scene and automatically opens the output video file upon completion.

-ql, --low_quality
    Renders in low quality (e.g., 480p, 15fps) for quick previews.

-qm, --medium_quality
    Renders in medium quality (e.g., 720p, 30fps).

-qh, --high_quality
    Renders in high quality (e.g., 1080p, 60fps).

-s, --save_last_frame
    Saves only the last frame of the animation as an image.

-o, --open
    Opens the output file(s) after rendering is complete.

-r WIDTHxHEIGHT, --resolution WIDTHxHEIGHT
    Sets the custom output resolution for the video (e.g., 1920x1080).

--transparent
    Renders the animation with a transparent background (requires specific output formats like .webm).

--config_file PATH
    Specifies an alternative configuration file to use for Manim settings.

--log_level LEVEL
    Controls the verbosity of log messages (e.g., DEBUG, INFO, WARNING, ERROR, CRITICAL).

--force_output
    Overwrites existing output files without prompting for confirmation.

DESCRIPTION

Manim is a free and open-source Python library used to create high-quality animations for educational videos, primarily focused on mathematical visualizations. It allows users to define scenes and objects programmatically, then renders them into video files. Its programmatic nature provides precise control over object transformations, timing, and aesthetics, making it popular for explaining complex mathematical or scientific concepts visually. It leverages Python for scripting and relies on tools like FFmpeg for video processing and LaTeX for rendering mathematical equations.

CAVEATS

Manim requires a Python environment and several external dependencies, including FFmpeg for video processing and a LaTeX distribution for mathematical typesetting, which must be installed separately. The learning curve can be steep for users unfamiliar with Python programming and object-oriented concepts. Rendering complex or long animations can be computationally intensive and time-consuming, requiring significant system resources.

TYPICAL USAGE EXAMPLE

To render a scene named MyScene from a file named my_animations.py and preview it in high quality, you would typically run:
manim -ph my_animations.py MyScene

CUSTOMIZATION

Manim's behavior can be extensively customized through configuration files (typically manim.cfg) or command-line arguments, allowing fine-tuning of rendering quality, output directory paths, and default animation settings.

HISTORY

Manim was initially developed by Grant Sanderson for his highly acclaimed YouTube channel, 3Blue1Brown, to create stunning mathematical visualizations. The original version was a private tool. Later, the Manim Community Edition was forked and open-sourced, transforming it into the widely adopted and actively maintained library it is today, driven by a dedicated community of developers.

SEE ALSO

python(1), ffmpeg(1), tex(1)

Copied to clipboard