[FFmpeg-user] x11grab segfault when display is closed

Matt Garman matthew.garman at gmail.com
Fri Jun 22 18:03:05 EEST 2018

I'm using a static git build, version N-46353-g40b7e6071-static[1] on
CentOS 7.3.  This server is used as a remote login launch point (or "jump
box").  What we'd like to do, for security/auditing purposes, is create
videos of user sessions.

I'm using a command like this:

# ./ffmpeg -an -f x11grab -framerate 10 -video_size 1280x1024 -i :13

If I stop ffmpeg before that display is closed, I get a nice video, exactly
as expected.

However, if ffmpeg is still running when the display (:13 in the above
command) is closed, ffmpeg segfaults.  This results in an unplayable video
file (presumably, ffmpeg doesn't get a chance to clean up and properly
close out the file).

Would this be considered a bug?  Not sure how hard it would be to recognize
that the display is no longer valid, and cleanly exit...

Is there any kind of workaround possible?


[1] # ./ffmpeg -version

ffmpeg version N-46353-g40b7e6071-static https://johnvansickle.com/ffmpeg/
Copyright (c) 2000-2018 the FFmpeg developers

built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516

configuration: --enable-gpl --enable-version3 --enable-static
--disable-debug --disable-ffplay --disable-indev=sndio
--disable-outdev=sndio --cc=gcc-6 --enable-fontconfig --enable-frei0r
--enable-gnutls --enable-gray --enable-libaom --enable-libfribidi
--enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame
--enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg
--enable-librubberband --enable-libsoxr --enable-libspeex
--enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab
--enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264
--enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg

libavutil      56. 18.102 / 56. 18.102

libavcodec     58. 20.103 / 58. 20.103

libavformat    58. 17.101 / 58. 17.101

libavdevice    58.  4.101 / 58.  4.101

libavfilter     7. 25.100 /  7. 25.100

libswscale      5.  2.100 /  5.  2.100

libswresample   3.  2.100 /  3.  2.100

libpostproc    55.  2.100 / 55.  2.100

More information about the ffmpeg-user mailing list