What's the idiomatic way to write a video file

How to create a video file from frames?
For frame I mean calculate colour of each pixels from many moving geometrical shape. Then save the animation in a mp4 or other formats alike. I've been looking around for a while and couldn't find where to start.:frowning:

Your problem is best broken up into two subproblems:

  • You need a graphics/drawing/rendering library. Look for "2D" ones, which are more likely to be good at geometric shapes (lines, polygons) whereas ones focusing on 3D may not have such algorithms built in.
  • You need a video encoder library.

Then, you instruct the drawing library to draw into an in-memory buffer for each frame, and pass those buffers to the video encoder.

I don't have specific recommendations myself; I'm working on graphics but a different enough case that I can't point you at the right crates. But I hope this helps you know what parts you need.

1 Like

I've got an example project for VP9:

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.