$ wl-screenrec -f /tmp/out.mp4
0 fps
0 fps
// SIGINT
^C^C0 fps
^C^C0 fps
^C^C^C^C0 fps
0 fps
// SIGTERM
0 fps
0 fps
// SIGKILL
zsh: killed wl-screenrec -f /tmp/out.mp4
(Note that I'm testing my Wayland compositor and wlr_screencopy_v1. SHM is supported and DMABUF is not yet. I guess that 0 fps is the result of it.)
I checked the code. This is because EventQueue::blocking_dispatch() here blocks until an event is received and quit_flag is not checked. I recommend using a child thread to process events and using the main thread just to supervise it, for example, using select! of crossbeam with a channel for signals and one for results of the child threads.