Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could we add screen grabbing to this? #6

Open
crazy-logic opened this issue Jan 16, 2022 · 1 comment
Open

Could we add screen grabbing to this? #6

crazy-logic opened this issue Jan 16, 2022 · 1 comment

Comments

@crazy-logic
Copy link

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?

@lplassman
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants