I've been trying to grab the output of a second display server with FFmpeg, however when I open the video in VLC on my PC it appears to be a black screen. I've tried both with FFmpeg from apt and one I build myself but they both get the same output.

Here's the command I used for the video:

ffmpeg -y -framerate 30 -f x11grab -video_size 1024x576 -i :1 -vcodec qtrle out.mov

And here's the output from FFmpeg

ffmpeg version N-92272-g0e9c01f Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.10) 20160609
  configuration: --prefix=/home/nas/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/nas/ffmpeg_build/include --extra-ldflags=-L/home/nas/ffmpeg_build/lib --extra-libs='-lpthread -lm' --bindir=/home/nas/bin --enable-gpl --enable-libaom --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxcb --enable-nonfree
  libavutil      56. 20.100 / 56. 20.100
  libavcodec     58. 34.100 / 58. 34.100
  libavformat    58. 19.102 / 58. 19.102
  libavdevice    58.  4.106 / 58.  4.106
  libavfilter     7. 38.100 /  7. 38.100
  libswscale      5.  2.100 /  5.  2.100
  libswresample   3.  2.100 /  3.  2.100
  libpostproc    55.  2.100 / 55.  2.100
[x11grab @ 0x33a5a00] XFixes not available, cannot draw the mouse.
Input #0, x11grab, from ':1':
  Duration: N/A, start: 1540586402.265804, bitrate: N/A
    Stream #0:0: Video: rawvideo (BGR[0] / 0x524742), bgr0, 1024x576, 30 fps, 30 tbr, 1000k tbn, 1000k tbc
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> qtrle (native))
Press [q] to stop, [?] for help
Output #0, mov, to 'out.mov':
    encoder         : Lavf58.19.102
    Stream #0:0: Video: qtrle (rle  / 0x20656C72), rgb24, 1024x576, q=2-31, 200 kb/s, 30 fps, 15360 tbn, 30 tbc
      encoder         : Lavc58.34.100 qtrle
frame=  260 fps= 30 q=-0.0 Lsize=     424kB time=00:00:08.63 bitrate= 402.7kbits/s speed=1.01x
video:423kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.432202%
Exiting normally, received signal 2.

and here's the xdpyinfo for the display:

name of display:    :1
version number:    11.0
vendor string:    AT&T Laboratories Cambridge
vendor release number:    3332
maximum request size:  4194300 bytes
motion buffer size:  256
bitmap unit, bit order, padding:    32, LSBFirst, 32
image byte order:    LSBFirst
number of supported pixmap formats:    2
supported pixmap formats:
    depth 1, bits_per_pixel 1, scanline_pad 32
    depth 24, bits_per_pixel 32, scanline_pad 32
keycode range:    minimum 8, maximum 255
focus:  window 0x1800001, revert to Parent
number of extensions:    7
default screen number:    0
number of screens:    1

screen #0:
  dimensions:    1024x576 pixels (347x195 millimeters)
  resolution:    75x75 dots per inch
  depths (1):    24
  root window id:    0x25
  depth of root window:    24 planes
  number of colormaps:    minimum 1, maximum 1
  default colormap:    0x21
  default number of colormap cells:    256
  preallocated pixels:    black 0, white 16777215
  options:    backing-store YES, save-unders YES
  largest cursor:    1024x576
  current input event mask:    0x4a0003
    KeyPressMask             KeyReleaseMask           StructureNotifyMask
    SubstructureNotifyMask   PropertyChangeMask
  number of visuals:    1
  default visual id:  0x22
    visual id:    0x22
    class:    TrueColor
    depth:    24 planes
    available colormap entries:    256 per subfield
    red, green, blue masks:    0xff0000, 0xff00, 0xff
    significant bits in color specification:    8 bits

If any more information (or a video sample) is required please let me know and I will get them to use.

Any help would be appreciated

  • There's no "X server" running in a headless Linux, I believe. If I'm right there's nothing to capture with the commands you used. – user931000 Oct 26 '18 at 20:49
  • I start the server using tightvncserver, which starts the X server for me. I can see a desktop and GUI when connecting to it through VNC and I can take a screenshot with xwd -root -silent -display :1.0 | xwdtopnm |pnmtojpeg > screen.jpg – RetractedRedacted Oct 26 '18 at 20:59
  • Does ffplay show the display: ffplay -framerate 30 -f x11grab -video_size 1024x576 -i :1 ? – Gyan Oct 27 '18 at 5:18
  • No, FFplay also shows a black screen unfortunately – RetractedRedacted Oct 27 '18 at 6:24

Had the same issue on xfce4 and IceWM. Problem gone after applying this option

-draw_mouse 0

I didn't need mouse cursor so I just simply disabled it (although the right solution is dealing with various xfixes options in case if you need cursor :-)).


I had the same problem, and this link helped me solve it: https://bbs.archlinux.org/viewtopic.php?id=222780

Basically, by default Gnome uses OpenGL to render the screen, so x11grab doesn't capture it. Logout and the login with option "Gnome on Xorg". ffmpeg recording works this way.

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.