Fastest method for screen capturing on Linux

lurscher picture lurscher · Nov 20, 2012 · Viewed 12.8k times · Source

This question is similar to this one

Fastest method of screen capturing

but for linux/X11.

To be more specific, i need a method to capture the pixel images of one window (the programmatic equivalent of alt-print screen in windows) running on a X11 diplay.

Notes and requirements:

1) Even if a new window is placed on top of the window that is being captured, the pixel image should still point to the original application window without any occlusion

2) it is not needed that the application window to be seen by the user, i just need to store the pixel buffers/images for video purposes

other alternatives that i've explored are:

1) xvfb - it works but it does does CPU rendering, which is slow and wasteful of a good GPU

2) x11 inside many lxc - theoretically could work but is complex to setup, and i'm not sure it will scale well with many windows being captured

suggestions and ideas are welcome

Answer

n. 'pronouns' m. picture n. 'pronouns' m. · Nov 22, 2012

This is not possible with pure X11.

You can get what you want with compositing, but only on servers which support it (most modern ones do). This actually has nothing to do with window managers. A WM is just another client, albeit with some special abilities, but those are unrelated to compositing. You can use the same compositing API.

man xcomposite should get you started.