XLib and Xvfb: capture screen
Ilya Anfimov
ilan at tzirechnoy.com
Wed Feb 8 14:42:09 UTC 2017
On Wed, Feb 08, 2017 at 01:16:18PM +0300, Alex Sviridov wrote:
> Hi all
>
> This is my c++ code which I use to capture screen:
> Display* display = XOpenDisplay(NULL);
> Window root = DefaultRootWindow(display);
> XWindowAttributes attributes = {0};
> XGetWindowAttributes(display, root, &attributes);
> int width, height;
> width = attributes.width;
> height = attributes.height;
> XImage* img = XGetImage(display, root, 0, 0 , width, height,
> AllPlanes, ZPixmap);
> ...
> XDestroyImage(img);
> XCloseDisplay(display);
>
> When I run it without Xvfb I get a normal screen picture. However, when I
> use it in Xvfb is not not normal. For example I tried to capture youtube
> in firefox as a result I see some green/blue image with you tube pieces.
>
> This question was asked on stackoverflow
> [1]http://stackoverflow.com/questions/42110050/xlib-and-xvfb-capture-screen
> and there can be seen the result image.
>
> How to fix it?
Try
Section "Extensions"
Option "XVideo" "Disable"
EndSection
in xorg.conf, or -extensionXVideo in Xvfb command line.
More information about the xorg
mailing list