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

Webm output #13

Closed
TheKnarf opened this issue Jan 24, 2023 · 8 comments · Fixed by #40
Closed

Webm output #13

TheKnarf opened this issue Jan 24, 2023 · 8 comments · Fixed by #40

Comments

@TheKnarf
Copy link

It would be nice with support for outputting .webm videos.

@initialcommit-io
Copy link
Contributor

@TheKnarf Thanks for the suggestion. Currently Manim only supports exporting to .mp4 or .gif.

Can you let me know your use case for .webm exports and why the currently exported .mp4 can't just be converted to .webm after it is generated?

@initialcommit-io
Copy link
Contributor

Hi @TheKnarf,

Just following up to see if you can provide those details.

@TheKnarf
Copy link
Author

TheKnarf commented Jan 27, 2023

Using a converter is obviously possible.
But it would be more ergonomic for the use of the tool to get the format one wants directly.

.webm files are useually about 1/10th of the size of .mp4 files, and so that would be my preferred filetype to use on the web if I where to embed some output of git-sim online. I plan to use git-sim together with Docusaurus to document our git workflow.

@abhijitnathwani
Copy link
Contributor

I have seen webm widely used in webpages to embed videos. @TheKnarf put up a nice use case.
@initialcommit-io we do have ffmpeg installed as part of manim dependencies. May be we can accept an argument to output as webm and internally convert the MP4 to webm using ffmpeg ?

@initialcommit-io
Copy link
Contributor

@TheKnarf Sounds like a cool use case - ok we'll give it a try!

@abhijitnathwani Good suggestion - do you want to try your hand at implementing this with calls to ffmpeg? I think a global option like --video-format=webm would work well.

@abhijitnathwani
Copy link
Contributor

Sure @initialcommit-io ! I'll give it a try and let you know how it goes

@abhijitnathwani
Copy link
Contributor

abhijitnathwani commented Jan 28, 2023

@initialcommit-io I have the bare bones working for the webm output. You can find the code in the branch here.
One question for you, the mp4 to webm conversion takes a few seconds to run. While ffmpeg is running, the user doesn't see any messages so he/she is kinda lost at what is happening. How do we address this better? One option would be to use some progress to display, via some python libraries

On another note, we need to add some logging so that we can also enable verbose mode to the dev can follow the flow. We can also replace the print with logging.info/debug/error.

@initialcommit-io
Copy link
Contributor

@abhijitnathwani Looks good! As for logging, it's a good point and we should switch to an actual logging facility instead of just print statements like you said, and I also do like the idea of the --verbose flag to enable detailed output.

For now, I think you can just add a print statement that says "Converting video output to .webm format..." Then feel free to submit the PR for merging.

Then we can address logging in a new issue if you want to open an issue for that. It would also be cool to do a separate issue for showing progress bars (not sure if we could get one for the Manim generation itself), but lets try and keep each of these functionalities as its own separate GitHub issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants