git-sim
git-sim copied to clipboard
Webm output
It would be nice with support for outputting .webm videos.
@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?
Hi @TheKnarf,
Just following up to see if you can provide those details.
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.
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 ?
@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.
Sure @initialcommit-io ! I'll give it a try and let you know how it goes
@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.
@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.