Efficiently embed video clips in Manim scenes and Manim Slides presentations.
Instead of decoding video frames one-by-one into ImageMobjects, manim_videos
renders a transparent placeholder during Manim's normal pass and then uses
MoviePy to composite the target video onto the
rendered partial movie file in a single post-processing step.
Note: This package is only tested against Manim Community Edition, but may work with ManimGL.
Install manim-videos with:
pip install manim-videosThen add the VideoMixin to your scene class, and add your video to your scene using the VideoMObject class and OverlayVideo animation:
from manim import *
from manim_videos import VideoMixin, VideoMObject, OverlayVideo
class MyScene(VideoMixin, Scene):
def construct(self):
vid = VideoMObject("my_video.mp4")
self.play(OverlayVideo(vid))Which can be rendered and previewed using the following command:
manim -pql my_scene.py MySceneSee the documentation for more!