How to screen cast with ffmpeg

I am trying to use ffmpeg and grab the input on one display and cast it to a rtmp server.
I do have three monitors connected

s@localhost:~> xrandr --query | grep '\bconnected\b'                  
HDMI-A-0 **connected** primary 3840x2160+3840+0 (normal left inverted right x axis y axis) 953mm x 543mm 
DisplayPort-0 **connected** 3840x2160+0+0 (normal left inverted right x axis y axis) 953mm x 543mm 
DisplayPort-1 **connected** 1920x1080+3454+2160 (normal left inverted right x axis y axis) 1039mm x 584mm

I try to grab the third screen DisplayPort-1

When I try to test the ffmpeg command


ffmpeg -video_size 1920x1080 -framerate 60 -f x11grab -i :3.0 -preset ultrafast -vcodec libx264 -tune zerolatency -r 60 -listen 1 rtmp://localhost:1935/

or

[FONT=monospace]


ffmpeg -video_size  1920x1080 -framerate 60 -f x11grab -i :[FONT=monospace]DisplayPort-1 -preset ultrafast -vcodec  libx264 -tune zerolatency -r 60 -listen 1 rtmp://localhost:1935/

[/FONT]

all I get is a

@localhost:~>
 ffmpeg -video_size 1920x1080 -framerate 60 -f x11grab -i :DisplayPort-1.0 -preset ultrafast -vcodec libx264 -tune zerolatency -r 60 -listen 1 rtmp://localhost:1935/ 
ffmpeg version 4.3.2 Copyright (c) 2000-2021 the FFmpeg developers 
  built with gcc 10 (SUSE Linux) 
  configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --incdir=/usr/include/ffmpeg --extra-cflags='-O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tabl
es -fstack-clash-protection -Werror=return-type -flto=auto -ffat-lto-objects -g' --optflags='-O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protecti
on -Werror=return-type -flto=auto -ffat-lto-objects -g' --disable-htmlpages --enable-pic --disable-stripping --enable-shared --disable-static --enable-gpl --enable-version3 --enable-libsmbclient --disable-openssl --
enable-avresample --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcelt --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libdc1394 --enabl
e-libdrm --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-lib
pulse --enable-librav1e --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libssh --enable-libsrt --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvmaf --enable-libvorbis --enab
le-libv4l2 --enable-libvpx --enable-libwebp --enable-libxml2 --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lto --enable-lv2 --enable-libmfx --enable-vaapi --enable-vdpau --enable-version3 --enable-libfd
k-aac-dlopen --enable-nonfree --enable-libvo-amrwbenc --enable-libx264 --enable-libx265 --enable-librtmp --enable-libxvid 
  libavutil      56. 51.100 / 56. 51.100 
  libavcodec     58. 91.100 / 58. 91.100 
  libavformat    58. 45.100 / 58. 45.100 
  libavdevice    58. 10.100 / 58. 10.100 
  libavfilter     7. 85.100 /  7. 85.100 
  libavresample   4.  0.  0 /  4.  0.  0 
  libswscale      5.  7.100 /  5.  7.100 
  libswresample   3.  7.100 /  3.  7.100 
  libpostproc    55.  7.100 / 55.  7.100 
[x11grab @ 0x55c85e4e6b40] Cannot open display :DisplayPort-1.0, error 5. 
:DisplayPort-1.0: Input/output error          

I tried to use OBS, but it produces a significant lag and I cannot that.

I also need a password on the RTMP server.
[/FONT]

apparantly you can only crop an area

s@localhost:~> ffmpeg -video_size 1920x1080 -framerate 60 -f x11grab -i :0.0+7680,1080 -preset ultrafast -vcodec libx264 -tune zerolatency -r 60 -f mpegts -listen 1 rtmp://localhost:1935/test/
ffmpeg version 4.3.2 Copyright (c) 2000-2021 the FFmpeg developers 
  built with gcc 10 (SUSE Linux) 
  configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --incdir=/usr/include/ffmpeg --extra-cflags='-O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tabl
es -fstack-clash-protection -Werror=return-type -flto=auto -ffat-lto-objects -g' --optflags='-O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protecti
on -Werror=return-type -flto=auto -ffat-lto-objects -g' --disable-htmlpages --enable-pic --disable-stripping --enable-shared --disable-static --enable-gpl --enable-version3 --enable-libsmbclient --disable-openssl --
enable-avresample --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcelt --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libdc1394 --enabl
e-libdrm --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-lib
pulse --enable-librav1e --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libssh --enable-libsrt --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvmaf --enable-libvorbis --enab
le-libv4l2 --enable-libvpx --enable-libwebp --enable-libxml2 --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lto --enable-lv2 --enable-libmfx --enable-vaapi --enable-vdpau --enable-version3 --enable-libfd
k-aac-dlopen --enable-nonfree --enable-libvo-amrwbenc --enable-libx264 --enable-libx265 --enable-librtmp --enable-libxvid 
  libavutil      56. 51.100 / 56. 51.100 
  libavcodec     58. 91.100 / 58. 91.100 
  libavformat    58. 45.100 / 58. 45.100 
  libavdevice    58. 10.100 / 58. 10.100 
  libavfilter     7. 85.100 /  7. 85.100 
  libavresample   4.  0.  0 /  4.  0.  0 
  libswscale      5.  7.100 /  5.  7.100 
  libswresample   3.  7.100 /  3.  7.100 
  libpostproc    55.  7.100 / 55.  7.100 
[x11grab @ 0x55e1be79cb40] Stream #0: not enough frames to estimate rate; consider increasing probesize
Input #0, x11grab, from ':0.0+7680,1080':
  Duration: N/A, start: 1618293803.440706, bitrate: 3981312 kb/s 
    Stream #0:0: Video: rawvideo (BGR[0] / 0x524742), bgr0, 1920x1080, 3981312 kb/s, 60 fps, 1000k tbr, 1000k tbn, 1000k tbc 
RTMP_Connect0, failed to connect socket. 111 (Connection refused)
rtmp://localhost:1935/test/: Unknown error occurred 

But then it still needs a server

apparantly you need to start a separate server.

recommended ffserver and mkvserer_MK2 are obsolete and with NGINX no libnginx-mod-rtmp package is available for openSUSE?

https://software.opensuse.org/package/libnginx-mod-rtmp

  •  		 			:'(