ffmpeg x11 screen recording crash

I have a single line script to record screencasts on my laptop using ffmpeg. It was working fine last month, but today I updated the packages and each time I try to record the screen, the X server crashes into tty.

Here's the ffmpeg script:

#!/bin/sh
ffmpeg -video_size 1920x1080 -framerate 30 -f x11grab -i :0.0 -loglevel error -preset ultrafast -vcodec libx264 -qp 0 -pix_fmt yuv420p -f mp4 ./test.mp4


Here is what Xorg.0.log records:

Code:
[    28.201] (**) TPPS/2 IBM TrackPoint: (accel) selected scheme none/0
[    28.201] (**) TPPS/2 IBM TrackPoint: (accel) acceleration factor: 2.000
[    28.201] (**) TPPS/2 IBM TrackPoint: (accel) acceleration threshold: 4
[    28.202] (II) event7  - TPPS/2 IBM TrackPoint: is tagged by udev as: Mouse
[    28.204] (II) event7  - TPPS/2 IBM TrackPoint: device is a pointer
[    28.860] (II) modeset(0): EDID vendor "LGD", prod id 1079
[    28.860] (II) modeset(0): Printing DDC gathered Modelines:
[    28.860] (II) modeset(0): Modeline "1920x1080"x0.0  138.46  1920 1968 2000 2106  1080 1083 1088 1095 +hsync -vsync (65.7 kHz eP)
[   651.478] (EE) Segmentation fault at address 0x0
[   651.478] (EE)
Fatal server error:
[   651.479] (EE) Caught signal 11 (Segmentation fault). Server aborting
[   651.479] (EE)
[   651.479] (EE)
Please consult the The X.Org Foundation support
     at http://wiki.x.org
 for help.
[   651.479] (EE) Please also check the log file at "/var/log/Xorg.0.log" for additional information.
[   651.479] (EE)
[   651.480] (II) AIGLX: Suspending AIGLX clients for VT switch
[   651.497] (EE) Server terminated with error (1). Closing log file.

Some logs that may be useful (ffmpeg version, x11 version...)

Code:
$ uname -a
FreeBSD X260 13.2-RELEASE-p1 FreeBSD 13.2-RELEASE-p1 GENERIC amd64
$ pkg info | grep ffmpeg
ffmpeg-6.0_1,1                 Realtime audio/video encoder/converter and streaming server
$ pkg info | grep xorg-server
xorg-server-21.1.8_4,1         X.Org X server and related programs
$ pkg info | grep 264
libx264-0.164.3095             H.264/MPEG-4 AVC Video Encoding (Library)

I tried to record some ffmpeg logs but Xorg crashes before the log file can get anything.

I appreciate any idea on how to solve this issue. It's really strange, I think that most probably I'm missing something that has changed between updates, and maybe there are not-met dependencies or another flow to grab the X11 screen from ffmpeg but I can't seem to find it.
 
I haven't recorded screen for awhile, but remember that I had to rebuild multimedia/ffmpeg with adjusted options every time after binary packages were updated. I'm using the same script for recording.

[update] Have you tried recording a smaller portion of the screen?
 
I have tried to record a smaller portion too with no luck. I've also been reading some of the other forum posts about screen recording with ffmpeg, and I've checked that multimedia/ffmpeg has the "XCB" option on. Maybe there are other options that have been turned off and cause the issue, that idk for now.

I'm trying your script and multimedia/peek and I'll report if anything changes.
 
You may try disabling OPTIMIZED_CFLAGS.
Although I'm not sure whether enabling XVIDEO matters, it may help too.
 
Back
Top