Skip to content

Instantly share code, notes, and snippets.

@redragonx
Forked from ioquatix/README.md
Created January 3, 2021 23:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save redragonx/a6103fd30d705732bbfe1b5014b3e9d3 to your computer and use it in GitHub Desktop.
Save redragonx/a6103fd30d705732bbfe1b5014b3e9d3 to your computer and use it in GitHub Desktop.
How to setup v4l2 loopback for use with OBS.

Firstly, you need to install v4l2loopback and obs-v4l2sink. On arch linux with yay:

yay -Syu obs-v4l2sink v4l2loopback-dkms

Then, set up a systemd service:

koyoko% cat /etc/systemd/system/v4l2loopback.service 
[Unit]
Description=V4L2 Loopback

[Service]
Type=simple
RemainAfterExit=yes
ExecStart=/bin/modprobe v4l2loopback card_label='V4L2 Loopback' video_nr=7 exclusive_caps=1
ExecStop=/bin/rmmod v4l2loopback

[Install]
WantedBy=default.target

Then start it:

sudo systemd start v4l2loopback

You should have now /dev/video7 which is your loopback device.

Start up OBS and select Tools -> v4l2sink. Enter in the details:

  • Auto Start (your choice)
  • Device Path: /dev/video7
  • Video Format: YUV420 (works for me)

To check it by Chromium, you can use any video conferencing website, you should be able to select a camera called "V4L2 Loopback".

You can also use VLC to check the output. Use File -> Open capture device and enter /dev/video7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment