Hi first thanks for this great script , second I had issue the script couldnt recocgnize the right Desiplay name anyway I use this fixed value to solve my issue -i :0.0+$X,$Y
ffmpeg -f x11grab -s "$W"x"$H" -framerate 60 -thread_queue_size 512 -i :0.0+$X,$Y \
I hope this helps someone else , and if you have issue with the new parameters , use this command to get your display number
ps -u $(id -u) -o pid= | xargs -I PID -r cat /proc/PID/environ 2> /dev/null | tr '\0' '\n' | grep ^DISPLAY=: | sort -u