Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(lib): add basic VideoMobject class #3496

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

jeertmans
Copy link
Contributor

Hello, I actually implemented this for a personal need, but I guess other people could enjoy such feature, as in #760.

The current implementation is very minimalist, and may be improved, or tested / better documented.

If OpenCV is added as a dependency, then we could also directly load videos from video files, which could be a nice feature.

jeertmans and others added 2 commits December 5, 2023 19:20
Hello, I actually implemented this for a personal need, but I guess other people could enjoy such feature, as in ManimCommunity#760.

The current implementation is very minimalist, and may be improved, or tested / better documented.

If OpenCV is added as a dependency, then we could also directly load videos from video files, which could be a nice feature.
@@ -37,6 +37,7 @@
from .animation.transform_matching_parts import *
from .animation.updaters.mobject_update_utils import *
from .animation.updaters.update import *
from .animation.video import *

Check notice

Code scanning / CodeQL

'import *' may pollute namespace Note

Import pollutes the enclosing namespace, as the imported module
manim.animation.video
does not define '__all__'.
@behackl
Copy link
Member

behackl commented Dec 5, 2023

Thanks for the proposal, this looks like a good idea -- and we do get requests for this reasonably often indeed.

I'd be somewhat unhappy with adding OpenCV as a new dependency (we're currently rather trying to reduce dependencies), and OpenCV is not a particularly lightweight one either. However, it should be possible to achieve similar things with the ffmpeg bindings for Python, and as ffmpeg is a dependency already, adding the Python bindings would not hurt too much.

@behackl behackl added the new feature Enhancement specifically adding a new feature (feature request should be used for issues instead) label Dec 5, 2023
@jeertmans
Copy link
Contributor Author

Something like that https://github.com/kkroening/ffmpeg-python/blob/master/examples/ffmpeg-numpy.ipynb?

it seems quite easy to load all frames into one large array

@behackl
Copy link
Member

behackl commented Dec 6, 2023

Instead of the ffmpeg python bindings it is possible that we finally tackle #442 and include av as a dependency. It would be similarly easy with that.

@jeertmans
Copy link
Contributor Author

Instead of the ffmpeg python bindings it is possible that we finally tackle #442 and include av as a dependency. It would be similarly easy with that.

Oh! That's a super nice feature if we support av :D I might try to implement this later this month :-)

@jeertmans
Copy link
Contributor Author

@behackl looks like the av module is quite heavy, maybe it already includes ffmpeg https://pypi.org/project/av/11.0.0/#files?

I don't know how to interpret (from their READMDE):

Due to the complexity of the dependencies, PyAV is not always the easiest Python package to > install from source. Since release 8.0.0 binary wheels are provided on [PyPI][pypi] for Linux, Mac and Windows linked against a modern FFmpeg. You can install these wheels by running:

pip install av

If you want to use your existing FFmpeg, the source version of PyAV is on [PyPI][pypi] too:

pip install av --no-binary av

@behackl
Copy link
Member

behackl commented Dec 6, 2023

@behackl looks like the av module is quite heavy, maybe it already includes ffmpeg https://pypi.org/project/av/11.0.0/#files?

I don't know how to interpret (from their READMDE):

Haha, fun to see that you ran into the exact same question as I did. :-)

From my current understanding: yes, they provide wheels which include a statically linked version of ffmpeg (which would be actually amazing for us as it eliminates the biggest pain point about installing manim for our users).

I have planned to investigate in more detail over the coming days, perhaps we are in luck.

@jeertmans
Copy link
Contributor Author

Let’s see how much it can improve the speed, the thing I am the most interested in!

@chopan050
Copy link
Contributor

Related PR: #3501

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature Enhancement specifically adding a new feature (feature request should be used for issues instead)
Projects
Status: 📋 Backlog
Development

Successfully merging this pull request may close these issues.

3 participants