I am trying to record video output from Xvfb using ffmpeg or avconv. I start Xvfb with:

$ Xvfb :29 -screen 0 1024x768x24

When I later try to record display :29 with avconv (same output for ffmpeg):

$ avconv -f x11grab -s xga -r 25 -b 2000k -i :29.0 -y selenium.avi

I get the following error:

avconv version 0.8.4-4:0.8.4-0ubuntu0.12.04.1, Copyright (c) 2000-2012 the Libav developers
  built on Nov  6 2012 16:51:33 with gcc 4.6.3
[x11grab @ 0x1915b80] device: :29.0 -> display: :29.0 x: 0 y: 0 width: 1024 height: 768
[x11grab @ 0x1915b80] shared memory extension  found
X Error of failed request:  BadCursor (invalid Cursor parameter)
  Major opcode of failed request:  142 (XFIXES)
  Minor opcode of failed request:  25 (XFixesGetCursorImageAndName)
  Resource id in failed request:  0x200001
  Serial number of failed request:  14
  Current serial number in output stream:  14

avconv works for display :0 and creates correct video. Also I can connect to display :29 with x11vnc/vncviewer. I noticed that with 1024x768x8 (8 bits rather than 24) avconv doesn't fail, but the output video is completely black.

Am I missing some important option or setting? I am running Linux 3.2.0-36-generic (Ubuntu 12.04x64).

2 Answers 2


This was most likely fixed by Isaac Dooley in FFmpeg with commit 469a65b, fixing bug #1738 x11grab BadCursor. You will have to compile ffmpeg since the static builds do not include x11grab support. There is an easy-to-follow compile guide for all supported Ubuntu versions at: Compile FFmpeg on Ubuntu.

avconv does not contain this fix (and many others) since libav ignores most FFmpeg activity.

Also see HOWTO: Proper Screencasting on Linux.

  • @TomaszNurkiewicz I forgot to address the "black video" issue. If recent ffmpeg works, and the black video is still present, then please update your question with your ffmpeg command and the complete ffmpeg console output.
    – llogan
    Jan 23, 2013 at 22:07

I have exactly the same problem. Please do the following sequence, that should work for you.

  1. $ Xvfb :2 -screen 0 1024x768x24 &

  2. $ export DISPLAY=:2

  3. $ xeyes &
    Note: If there is no X application (ex: xeyes) running, you will get BadCusor error.

  4. $ avconv -f x11grab -s xga -r 25 -b 2000k -i :29.0 -y selenium.avi

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .