Recording Panda's display to a video format using FFmpeg

I was searching for a solution to directly capture footage within Panda3D. And while the base.movie function is nice (which saves an individual screenshot of every single frame), but I’d really prefer something that records in a video format wise.

A week or so ago, I’ve found this link containing a script that encodes into an AVI video:
http://pytan.hatenablog.com/entry/2015/07/21/223331

It works exactly what I wanted, but I have to fix some stuff, (like changing RGBA input into BGRA and changing codecs from AVI to H.264), but now I have a perfect solution I can use for recording stuff like cutscenes and machinimas within Panda itself without external software other than FFmpeg.

If any of this sounds useful to you, you can check out this gist I created here which records the Hello World demo from the manual into HelloWorld.mp4:

You can see the resulting output of the above script in YouTube here:

2 Likes

Thanks for sharing this :slight_smile:

Also, I believe that if your app render the scene to texture you don’t have to use the screenshot function, instead you can directly store the content of the texture.