I made a VideoMobject #4261
kmwadman
started this conversation in
Suggestions and Proposals
Replies: 1 comment 1 reply
-
this looks much more comprehensive than my quick and dirty approach: https://gist.github.com/uwezi/faec101ed5d7c20222b33eee4b6c7d63#file-20240309_opencv-py |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I sat down and created a VideoMobject that seems to work pretty well. I had made a video_handler class myself a while ago and spent some time with Claude 4 today to create a proper VideoMobject. I have confirmed that the video behaves the way I would expect under a lot of animation scenarios, but I would suspect that there are some things that don't work and some choices that don't really match the quality of code that the team is looking for. It works for my use case, but I'm not sure this is ready for a PR. I figured I would share it out regardless, and maybe someone with a little bit more experience with the project can determine if it's worth incorporating something like this into the repo itself.
`
"""Mobjects representing video content."""
from future import annotations
all = ["VideoMobject"]
import pathlib
from typing import TYPE_CHECKING, Any
import cv2
import numpy as np
from PIL import Image
from PIL.Image import Resampling
from manim import logger
from manim.constants import QUALITIES, DEFAULT_QUALITY
from manim.mobject.types.image_mobject import AbstractImageMobject
from manim.utils.images import change_to_rgba_array
if TYPE_CHECKING:
from typing_extensions import Self
import numpy.typing as npt
class VideoState:
"""Shared state object for video playback that can be synchronized across copies.
class VideoMobject(AbstractImageMobject):
"""A mobject that displays video frames, updating at a specified frame rate.
`
Beta Was this translation helpful? Give feedback.
All reactions