git-sim icon indicating copy to clipboard operation
git-sim copied to clipboard

Webm output

Open TheKnarf opened this issue 2 years ago • 1 comments
trafficstars

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

TheKnarf avatar Jan 24 '23 09:01 TheKnarf

@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 avatar Jan 25 '23 08:01 initialcommit-io

Hi @TheKnarf,

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

initialcommit-io avatar Jan 27 '23 09:01 initialcommit-io

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.

TheKnarf avatar Jan 27 '23 14:01 TheKnarf

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 ?

abhijitnathwani avatar Jan 27 '23 18:01 abhijitnathwani

@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.

initialcommit-io avatar Jan 27 '23 18:01 initialcommit-io

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

abhijitnathwani avatar Jan 27 '23 18:01 abhijitnathwani

@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 avatar Jan 28 '23 11:01 abhijitnathwani

@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.

initialcommit-io avatar Jan 28 '23 18:01 initialcommit-io