Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
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 
Description=V4L2 Loopback

ExecStart=/bin/modprobe v4l2loopback card_label='V4L2 Loopback' video_nr=7 exclusive_caps=1
ExecStop=/bin/rmmod v4l2loopback


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