Search code examples
pythonvideo-capture

Python - How to record an application window to a video?


I have a python application, and I need to save this window action to a video file.

This application can be minimized, or the user can put another window in the front, but I need steel saving this window actions

Is it possible ?

ok:

I'm using Gnome, pygtk, X11

I need save all live of my application to a video


Solution

  • Periodically use Window.get_snapshot to get snapshots of the window. Then compose these images into a video. A simple though inefficient mechanism I can think of to do this is for each frame, convert your Pixmap into a Pixbuf using Pixbuf.get_from_drawable. Then use Pixbuf.save to save each frame to a PNG. When the application has finished, compose all of these PNGs into a video using FFmpeg.