You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So I've come up with a work around for grabbing the display output on x11 based systems using the v4l2 lookback
//install and enable
sudo apt install v4l2loopback-dkms
sudo modprobe v4l2loopback
//find which dev it is.
v4l2-ctl --list-devices
//generate the loopback; note the -i for input and /dev for output will be different for different machines
ffmpeg -video_size 1920x1080 -f x11grab -framerate 15 -i :1.0 -c:v rawvideo -pix_fmt yuyv422 -f v4l2 /dev/video4
//stream to ndi
v4l2ndi -d /dev/video4 -f
So this works for me, the gotcha was the pix_fmt, and getting it to the YUYV that v4l2ndi required. Without which would give the following error;
v4l2ndi -d /dev/video4 -f
Path: /dev/video4 Driver: v4l2 loopback
/dev/video4 support output
/dev/video4 support capture
/dev/video4 support read/write
/dev/video4 support streaming
Current pixel format: BGR4
Current frame width: 1920
Current frame height: 1080
Setting pixel format to: YUYV
Cannot set format
VIDIOC_S_FMT error 22, Invalid argument\n
If you have any ideas how we could add this without the need for the loopback that would be great, happy to jump into code or test if you can point me where to start?
The text was updated successfully, but these errors were encountered:
Nice workaround! I am not really sure how X11 grabbing could be directly integrated into v4l2 though. It would probably be easier to ignore v4l2 completely, and grab the frame from X11 and insert it directly into the NDI SDK.
So I've come up with a work around for grabbing the display output on x11 based systems using the v4l2 lookback
//install and enable
sudo apt install v4l2loopback-dkms
sudo modprobe v4l2loopback
//find which dev it is.
v4l2-ctl --list-devices
//generate the loopback; note the -i for input and /dev for output will be different for different machines
ffmpeg -video_size 1920x1080 -f x11grab -framerate 15 -i :1.0 -c:v rawvideo -pix_fmt yuyv422 -f v4l2 /dev/video4
//stream to ndi
v4l2ndi -d /dev/video4 -f
So this works for me, the gotcha was the pix_fmt, and getting it to the YUYV that v4l2ndi required. Without which would give the following error;
v4l2ndi -d /dev/video4 -f
Path: /dev/video4 Driver: v4l2 loopback
/dev/video4 support output
/dev/video4 support capture
/dev/video4 support read/write
/dev/video4 support streaming
Current pixel format: BGR4
Current frame width: 1920
Current frame height: 1080
Setting pixel format to: YUYV
Cannot set format
VIDIOC_S_FMT error 22, Invalid argument\n
If you have any ideas how we could add this without the need for the loopback that would be great, happy to jump into code or test if you can point me where to start?
The text was updated successfully, but these errors were encountered: