Skip to main content

Real-Time-Manim (RTM)

A Vulkan-accelerated, real-time rendering backend for ManimCE. RTM drives ManimCE's own Mobject / Animation model through a native Vulkan pipeline, so the same scene can be watched live in a window, seeked to any frame instantly, and recorded to MP4 several times faster than the default renderer.

About this page. This is the package overview, kept plain-text on purpose (PyPI renders neither images nor diagrams). The illustrated README, the manual and a source-level walkthrough live in the repository and its wiki.


Install

pip install real-time-manim

The Windows wheel bundles vulkan_core.dll and the macOS wheel bundles vulkan_core.dylib (Apple Silicon), so there is no build step. You need a Vulkan-capable GPU/driver, and ffmpeg on PATH to record video.

macOS needs MoltenVK at runtime — it provides the Vulkan layer on macOS:

brew install molten-vk

Intel Macs aren't covered by the bundled dylib: build it once and drop it next to the installed real_time_manim package:

bash native/build_mac.sh        # -> dist/release/vulkan_core.dylib

Quick start

from real_time_manim import Scene, Square, BLUE
from real_time_manim.vulkan_bind import MLWindow, Create, Wait
from real_time_manim.record import fast_record_scene

class Hello(Scene):
    def construct(self):
        win = MLWindow(960, 540)      # a real-time window
        win.scene = self              # required
        sq = Square(side_length=1.5, color=BLUE).set_fill(BLUE, 0.6)
        win.play(Create(sq), run_time=1.0)
        win.play(Wait(0.5))
        win.close()                   # required

fast_record_scene(Hello)              # -> ~/Downloads/output.mp4

MLWindow opens the live window; fast_record_scene / record_scene record to MP4. Recording starts and stops around the scene automatically, and the transient media/ folder is cleaned up afterwards.

No separate ManimCE install, and no import manim. RTM bundles ManimCE 0.21.0 and re-exports its whole namespace (Scene, every mobject and animation, the colours, the rate functions). Import real_time_manim — not manim — or class identity splits.


Highlights

  • Real-time window. MLWindow renders at 1920×1080 @ 60 fps with no export step between code and picture.
  • Fast recording. fast_record_scene(...) reads back frames straight into ffmpeg — around 1.9–2.8× faster than ManimCE Cairo (a 15-second scene: 4.6–6.6 s versus 12.8–13.9 s), windowless and at full speed by default. A static hold (wait) is drawn once and encoded for every frame, like ManimCE's frozen frame.
  • Parallel frames. jobs="auto" splits a long scene across worker processes and concatenates their segments losslessly.
  • Frame-accurate seeking. Any frame of a prepared scene is produced in O(1), which is what makes both the frame preview and the parallel recorder possible.
  • Full ManimCE. Existing scenes run unchanged, including code that still writes from manim import ....
  • Math without LaTeX. MathTex strings inside a convertible subset are compiled by an in-process Typst backend (RTM_TYPST=0 disables it); both Typst and LaTeX results are content-hashed and cached.
  • Animations. Every animation family is available: transforms, drawing, fading, movement/scaling, text, rotation, effects and grouping/timing — see the manual for the full list.

Recording

fast_record_scene(MyScene)                    # offline readback -> ~/Downloads/output.mp4
fast_record_scene(MyScene, "out.mp4", jobs=4) # 4 worker processes
record_scene(MyScene, "live.mp4")             # capture a visible window in real time

Both accept a Scene subclass, a Scene instance or a no-arg callable, and return a dict {out_path, windows, files, with_audio}. With out_path omitted the output lands at ~/Downloads/output.mp4. The native backend supports one window per process; _partN suffixes are reserved for a future multi-window backend.


Constraints

  • Output is fixed at 1920×1080 @ 60 fps; any other value is corrected and reported with a [rtm] forcing ... line.
  • One window per process, and win.scene = self plus win.close() are required.
  • There is no manim CLI — RTM is a library: MLWindow, the recorders, FrameServer, FramePreview.

How it works

Manim Scene
   |  MLWindow.play(...)
   v
type dispatch  (_send per mobject)
   |  ctypes FFI
   v
vulkan_core.dll  ->  Vulkan pipeline  ->  GPU
   |  optional framebuffer readback
   v
ffmpeg  ->  MP4

A Scene builds mobjects and calls MLWindow.play(...); the Python layer walks the mobject tree and dispatches each shape to a type-specific sender; those cross a ctypes boundary into vulkan_core.dll, which emits vertices and submits them to a Vulkan pipeline. Every frame is presented to the window, and can optionally be read back and piped to ffmpeg as an MP4.


Caches

Three different things are cached, and each is cleared differently:

what where what it saves clear it with
LaTeX / Typst results media/Tex (+ your tex_cache/) recompiling unchanged formulas clear_tex_cache()
text → SVG (Pango) media/texts/<hash>.svg re-running Pango layout (~2 ms per string) clear_media(), or a recorder's cleanup=True
parsed SVG → Manim mobjects process memory (SVG_HASH_TO_MOB_MAP) svgelements parsing + one VMobjectFromSVGPath per glyph (4–20 ms) process exit; Text(use_svg_cache=False) opts out

Formulas are content-hashed, so unchanged math is never recompiled:

from real_time_manim import restore_tex_cache, save_tex_cache, clear_tex_cache

restore_tex_cache("tex_cache")   # before: warm manim's SVG folder from a saved cache
# ... run your Tex / MathTex scenes ...
save_tex_cache("tex_cache")      # after: stash newly compiled SVGs

clear_tex_cache()                # wipe <media>/Tex and tex_cache/ (dry_run=True to preview)

Text is hashed by content and style — text, font, size, colour, t2c/t2f/ t2s/t2w, line spacing, ligatures — so a red and a blue copy are different files. The in-memory layer is capped (256 entries, FIFO) and only starts caching from the second build of a given string: repeated labels are ~2.5× cheaper to construct, while one-off strings (each DecimalNumber value) never pay for a copy they will not use. fast_record_scene(..., cleanup=True) deletes the whole media/ folder after recording, so the on-disk text cache lasts one render unless you pass cleanup=False:

from real_time_manim import clear_media

clear_media()                    # wipe the whole media/ tree, including media/texts

Documentation


License

MIT

Acknowledgments

  • ManimCE — the mathematical animation engine
  • stb_truetype — TrueType font rasterizer
  • Vulkan — the graphics API
  • Typst — the in-process math typesetting backend

Metadata

Release files for real-time-manim 2.0.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for real-time-manim 2.0.8
File Size Uploaded Provenance Actions
real_time_manim-2.0.8.tar.gz 1.3 MB Without provenance Details for real_time_manim-2.0.8.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for real-time-manim 2.0.8
File Interpreter ABI Platform Actions
real_time_manim-2.0.8-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details for real_time_manim-2.0.8-py3-none-win_amd64.whl

Total release size: 2.5 MB

Release files / real_time_manim-2.0.8.tar.gz

Download URL real_time_manim-2.0.8.tar.gz
Size 1.3 MB
Tags Source
SHA-256 checksum
How to use checksums
9f94c1f7371510fe05de544114346af7a21e8fe1095cdeabb4aaf3891ef8cb00
BLAKE2b-256 checksum
How to use checksums
1a9fcea6d7b9afb80cd25718a8fe82b8ac681ab79999da64c94b131c153bd827
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.4

Release files / real_time_manim-2.0.8-py3-none-win_amd64.whl

Download URL real_time_manim-2.0.8-py3-none-win_amd64.whl
Size 1.2 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
242c95671f4c3c1b6b67cee8c81e99b6afad6ad2d859d481ecb8ea4f557b66c4
BLAKE2b-256 checksum
How to use checksums
3232364c4f855241690b2f5c78789e2af6bf0e48ec949bf33dbb6d30952e7faa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.4

Security for real-time-manim 2.0.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page