home / blog

ffmpeg x11grab compilation

For the x11grab input device to be compiled you need to run ./configure with –enable-x11grab.

When you’ve run ./configure x11grab should be listed in the indev section like this.

Enabled indevs:
dv1394			lavfi			v4l2
fbdev			oss			x11_grab_device

If x11grab was not listed, then it is most likely Xfixes.h and/or XShm.h files are not in your compiler include path. These are validated in the ./configure script, and x11grab is disabled if they are not available. This is the check inside the configure script:

enabled x11grab                         &&
check_header X11/Xlib.h                 &&
check_header X11/extensions/XShm.h      &&
check_header X11/extensions/Xfixes.h    &&
check_func XOpenDisplay -lX11           &&
check_func XShmCreateImage -lX11 -lXext &&
check_func XFixesGetCursorImage -lX11 -lXext -lXfixes

On ubuntu 11.10 the libraries are available, but the headers are not installed. XShm.h is in the libxext-dev package and Xfixes.h is in libxfixes-dev

sudo apt-get install libxfixes-dev
sudo apt-get install libxext-dev

When compiling for RHEL 4u4 I discovered the headers were available, but in non-standard locations not on the default compiler/linker include paths. It was necessary to point ./configure in the right direction.

# first locate the headers.
find / -name "Xfixes.h"
/usr/foo/bar/X11/extensions/Xfixes.h

# next locate the libs
find / -name "libXfixes.so"
/lib/foo/bar/libXfixes.so


# call configure with the compiler + linker locations
./configure \
 other options ... \
 --extra-cflags="-I/usr/foo/bar" \
 --extra-ldflags="-L../lib/foo/bar"
This entry was posted in geek and tagged , . Bookmark the permalink.

Leave a Reply

Your email address will not be published.