Using the internal ffmpeg to screen capture

since BGE uses ffmpeg , i was wondering if its possible to render to a video the running game

how can i use that ? Can the ‘capture’ parameter be the standalone player’s window ? Please help

before i simply used the bge.render to take a screenshot at each frame but it was laggy

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.

1 Like

On Windows 10, you can use built in video capture. Press Win + G, and it will pop up a dialog which lets you capture the screencontent.

1 Like

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 ? :smiley:

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: