How to do this in Wayland

Snyder, Alexander J alexander at snyderfamily.co
Wed Feb 19 18:17:47 MST 2025


On Wayland, x11grab won't work because there is no direct access to the
display like in Xorg. Instead, you'll need to use PipeWire and wf-recorder
or obs-v4l2sink.

Solution Using PipeWire (wf-recorder and v4l2loopback)

1. Install required dependencies (if not already installed):

sudo apt install wf-recorder v4l2loopback-utils v4l2loopback-dkms


2. Load the v4l2loopback module (if not already loaded):

sudo modprobe v4l2loopback devices=1 video_nr=10 card_label="Virtual
Camera" exclusive_caps=1

This creates /dev/video10, which you will use as your virtual camera.


3. Capture the second monitor and send it to /dev/video10:

wf-recorder -o HDMI-A-1 -f - | ffmpeg -i - -f v4l2 -vcodec rawvideo
-pix_fmt yuv420p /dev/video10

Replace HDMI-A-1 with your monitor's correct name. Find your available
outputs with:

swaymsg -t get_outputs



4. Verify the virtual camera in Zoom:

Start Zoom, and in the camera settings, select "Virtual Camera."





---

Alternative Solution Using obs-v4l2sink (If You Use OBS)

If you're using OBS, you can install the obs-v4l2sink plugin to achieve the
same effect by redirecting an OBS scene to a virtual camera.

---
Thanks,
Alexander

Sent from my Google Pixel 7 Pro

On Wed, Feb 19, 2025, 17:51 Jim via PLUG-discuss <
plug-discuss at lists.phxlinux.org> wrote:

> I have Kubuntu 24.04 installed.  I managed to get Wayland working so I
> can use Waydroid.  Sometimes I need to capture what's displayed on the
> system's second monitor and use that as a second webcam so I can send
> that video to Zoom.
>
> Using Xorg, this works.
>
> ffmpeg -f x11grab -r 25 -s 1920x1080 -i :0.0+1920,0 -vcodec rawvideo
> -pix_fmt yuv420p -threads 0 -f v4l2 /dev/video0
>
>
> How do I do this using Wayland?
>
> Thank you
>
> ---------------------------------------------------
> PLUG-discuss mailing list: PLUG-discuss at lists.phxlinux.org
> To subscribe, unsubscribe, or to change your mail settings:
> https://lists.phxlinux.org/mailman/listinfo/plug-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.phxlinux.org/pipermail/plug-discuss/attachments/20250219/e71c0107/attachment.htm>


More information about the PLUG-discuss mailing list