If I am not mistaken, the VideoFFmpeg class will decode a video stream, when you would be looking for an encoder. I don’t think the BGE exposes anything like this.
Although, making screenshots might be laggy because of the jpeg encoding + file system access. An alternate solution would be using ImageRender and stream the rendered buffer to a thread and do the encoding and disk access there. Or in a subprocess even, to benefit from true multi-processing power (and ultimately avoid making your game too laggy). You basically have to implement a lag free encoding and storing yourself, either in Python or somehow see how to support this in the engine.
unfortunately i don’t have time to work on something like that. For the moment, i will just keep using ffmpeg in a terminal for screen capturing. Wondering if a built-in BGE ffmpeg solution could be faster as the picture is already is already processed.
@AeroLynx , why im not surprised to learn that there’s a built-in video capture in SpyOS 10 ?
You also have options to screencast on e.g. UBUNTU, that is nothing to do with SpyOS or not. I just found it very convenient for documentation at work, that it’s included.
If you need more options, please check my reply on stackexchange on the topic: