Rendering Video – GoZen [2]

How will my video editor render frames in Godot and put them into a video file? In this article I’ll describe the main idea of how I’ll make GoZen work in a quick and hopefully easy to understand way. So yeah, this is a brief description but if you want a more detailed look and explanation of the code behind this, then be certain to let me know and I’ll look into making more detailed videos and/or articles! ^^

Progress

All by all, the development is having steady progress even though I have a very busy schedule being a stay at home dad. The GitHub page does not receive too many updates for now but it will get better after I finish this UI stuff for the timeline. ^^”

FFmpeg

FFmpeg is mainly known for it’s command line functionality, but many video editors use FFmpeg as it is more than just a command line tool. I decided to use FFmpeg as it looks like the most polished option and would be the easiest to work with. As many other people use FFmpeg, it will most likely be easier to figure out how to make it work by looking at other open source projects.

Rendering video

For rendering video you can do two things. First one is to generate all images of a video, put them in a folder, and then run FFmpeg to compile them into a video. This would be terrible for your disk because of all the reads but especially all the writes. Performance would also be quit bad. If you know that a 1 minute video at 30 fps would contain 1800 frames… yeah, imagine wanting to make a 10 minute or a 1 hour video … just not practical.

Piping

Using a named pipe allows us to send the frames directly to a running FFmpeg instance which can directly start working on the compiling of the frames. This saves disk space and is the way that other video editors also do it. This is also how I will do it for GoZen.

This is just rendering

I imagine that dynamically loading video frames will be harder to achieve. For the rendering now I’m using a python script, I’d like to fully integrate FFmpeg functionality in Godot later on through a GDExtension, this will also handle importing videos, let’s see how that goes. ^^”