I'm trying to record a headless, xpra display. (I've attempted both the xvfb and Xdummy options).

The issue is with ffmpeg's "x11grab". The command being used is:

/usr/bin/ffmpeg -y -framerate 2 -video_size 1920x1080 -f x11grab -i :102 -vcodec libx264 -crf 0 -preset ultrafast /output.mkv

The problem is that this just records a blank display. It's complete white except for the black X that you'd recognize on a linux system.

Ffmpeg works fine for recording "real" displays, and I can attach to the xpra session and see that there are in fact windows in the display. Also, piping an xwd output into xwud shows those same windows.

I've wasted all day on this! Anybody know any hacks that I can do to make x11grab work?


So after doing some heavy digging I've decided that it has something to do with the way xpra manages its active windows.

Piping xwd into xwud requires me to specify the child window id for xwd, otherwise it just displays a blank window frame. Visually, this is very dissimilar from the blank, white frame I get from ffmpeg but I think it's indicative of the same thing.

If I had to guess it has something to do with the planes, as evidenced by

 444  req->planeMask = (unsigned int)AllPlanes;
 445  req->format = ZPixmap;

^ the ffmpeg code for x11grab, from https://ffmpeg.org/doxygen/trunk/x11grab_8c_source.html

I've decided to scrap xpra and use the xvfb standalone. This allows me to use ffmpeg


Xpra is a compositing window manager, I quote: The window manager composites the window buffers into an image representing the screen and writes the result into the display memory.. In the xpra case, the display memory is on the client and until you attach your client it does not exist, and so there is nothing displayed on the vfb. That's just how xpra works.

If you want to use xpra and still pipe the vfb to ffmpeg using x11grab, you can start your vfb separately and then use xpra shadow to access the existing vfb via xpra. (xpra shadow mode is much less efficient... because it doesn't use compositing, it uses screenscraping like x11grab does)

As of version 0.16, there is a new option called sync-xvfb (in milliseconds) which can be used to also paint the virtual screen, which you can then capture.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.