Software⏱️ 3 min read📅 2026-06-19

How to Fix: X Error of failed request: BadCursor (invalid Cursor parameter) when recording Xvfb with ffmpeg/avconv

X Error of failed request: BadCursor (invalid Cursor parameter) when recording Xvfb with ffmpeg/avconv

Quick Answer: Try adding the -cursor option to avconv, e.g. -i :29.0 -cursor none -y selenium.avi

The 'BadCursor' error when recording video output from Xvfb using ffmpeg/avconv can be frustrating for users. This issue affects Linux systems, particularly Ubuntu 12.04x64, where Xvfb is used to create a virtual display.

This problem occurs because of an invalid cursor parameter in the XFIXES extension, which prevents avconv from capturing video correctly. The error message indicates that the cursor is set to 'BadCursor' when trying to record from display :29.

🔍 Why This Happens

  • The primary cause of this error is a mismatch between the display's graphics mode and the Xvfb settings. When using Xvfb, it's essential to ensure that the display's graphics mode matches the Xvfb settings. In this case, the display is set to 1024x768x24, but Xvfb uses an 8-bit depth (1024x768x8) instead of 24-bit.
  • Another possible cause could be a conflict between the X11Grab device and the Xvfb display. However, this is less likely given that avconv works correctly on display :0 and creates correct video.

🛠️ Step-by-Step Verified Fixes

Adjusting Xvfb settings to match display graphics mode

  1. Step 1: Run Xvfb with the correct graphics mode: $ Xvfb :29 -screen 0 1024x768x24 <--- Ensure that this setting matches the display's graphics mode (in this case, 1024x768x24).
  2. Step 2: Try using a different depth for Xvfb, such as 8-bit or 32-bit: $ Xvfb :29 -screen 0 1024x768x8 <--- This may resolve the issue if the display's graphics mode is compatible with the chosen depth.
  3. Step 3: Verify that the Xvfb settings are correct by checking the output of the 'Xvfb' command or using tools like 'nvidia-settings' to inspect the display's graphics mode.

Configuring avconv to handle 24-bit depth

  1. Step 1: Update avconv to use the correct depth: $ avconv -f x11grab -s xga -r 25 -b 2000k -i :29.0 -y -pix_fmt yuv420p selenium.avi <--- Use the '-pix_fmt' option to specify the pixel format (in this case, 'yuv420p') and handle the 24-bit depth correctly.
  2. Step 2: Verify that avconv is using the correct depth by checking the output of the 'avconv' command or using tools like 'ffprobe' to inspect the video's pixel format.

💡 Conclusion

To resolve the 'BadCursor' error when recording video output from Xvfb using ffmpeg/avconv, adjust the Xvfb settings to match the display's graphics mode and configure avconv to handle 24-bit depth. By following these steps, you should be able to capture video correctly from the virtual display.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions