7

I've found some guides which say that this used to be complicated, but is now as simple as

sudo apt install obs-studio && sudo apt install v4l2loopback-dkms

This does indeed give me a "Start Virtual Camera" button on OBS Studio. When I click it, I am prompted for a password. And that's it. Nothing else happens. The button still says "Start Virtual Camera" (it should change to "Stop Virtual Camera"). And no virtual camera is detected by Firefox, Zoom, or Cheese.

Am I doing something wrong?

6
  • Related: askubuntu.com/a/1227239
    – Raffa
    Apr 20, 2021 at 23:25
  • That's a much more complex situation than mine, though, @Raffa.
    – TRiG
    Apr 21, 2021 at 8:50
  • run lsmod and verify the v4l2loopback module has been loaded as It's required
    – tomodachi
    Apr 26, 2021 at 16:43
  • Have you tried launching OBS studio as root? Not as a solution, but what effect does running as root have? Apr 30, 2021 at 17:17
  • So, launching OBS from the terminal as sudo obs at least made the error messages visible, and searching on the error messages led me to a guide on disabling secure boot to enable modprobe: askubuntu.com/a/1198351/652. And that worked. So thanks, @AnkurASharma.
    – TRiG
    Apr 30, 2021 at 18:17

6 Answers 6

9

In my case (Ubuntu 21.04), this is related to the Secure Boot. Ange1ique's answer here worked for me. I will copy it to here, and add a clarification in case it helps others:

  • uninstall v4l2loopback with: sudo apt-get remove --auto-remove v4l2loopback-dkms

  • install v4l2loopback again with: sudo apt-get install v4l2loopback-dkms

  • You will get a message about 'Configuring Secure Boot', which offers you the opportunity to create a key for this module. Read carefully and continue with tab(s) and an enter. Set the key/password and reboot.

  • On rebooting enter the key/password in the Enroll MOK section, and continue the restart.

  • enter this in the terminal: sudo modprobe v4l2loopback (don't know if this is necessary, but this time I didn't get an error)

  • now install OBS or just run it if already installed.

3

It turned out that disabling secure boot allowed modprobe to get the virtual camera to work. There may be another way to work this without disabling secure boot, but that worked for me. https://askubuntu.com/a/1198351/652 is the guide to disabling secure boot.

1

I found a solution months ago on an OBS forum for the same problem which involved reinstalling OBS from ppa.

sudo apt update
flatpak remove com.obsproject.Studio
sudo add-apt-repository ppa:obsproject/obs-studio
sudo apt install obs-studio v4l-utils v4l2loopback-utils v4l2loopback-dkms

I also added some packages at the end to be sure no v4l2loopback package is left behind. In the case you don't have OBS installed with flatpak, just make sure these packages are installed and up to date:

sudo apt update
sudo apt install v4l-utils v4l2loopback-utils
2
  • Uninstalled OBS & v4l2loopback, then followed the steps above to add the PPA and reinstall. End result: exactly the same. The "Start Virtual Camera" button launches a password prompt but has no other effect.
    – TRiG
    Apr 27, 2021 at 10:06
  • Ok, I'll try to replicate the problem on a fresh installed computer. Doing following the same steps I wrote here.
    – Figaro
    Apr 27, 2021 at 21:58
1

Sometimes applications like Firefox or OBS Studio, after exit, keep the kernel module v4l2loopback open.

# 1. Install 
sudo apt install v4l2loopback-dkms v4l2loopback-utils

# 2. Check
sudo lsmod | grep v4l2
sudo v4l2-ctl --all
sudo v4l2-ctl --list-devices
sudo v4l2-ctl --list-formats


# 3. Manually remove module
sudo modprobe -r v4l2loopback

# 4. Try again using virtual camera
0

The accepted answer did not work for me. Here's what did.

The problem is you're missing the v4l2 library, or Video4Linux2. But you can't install v4l2, because you're missing the kernel headers for your linux version. Now if you're like me you're wondering, shouldn't something called "kernel headers" come preinstalled? That is a great question. I don't know the answer.

1. Install from PPA

First, you need to have installed OBS from the PPA. Uninstall whatever OBS you're running (remove and purge as required by your package manger) and install thus:

sudo apt-add-repository ppa:obsproject/obs-studio
sudo apt-get update
sudo apt-get install ffmpeg obs-studio

(OBS needs ffmpeg, so don't miss this)

2. Install Kernel Headers

Next, install your kernel headers. To find your kernel headers, run:
apt search linux-headers-$(uname -r)

In my case, the output looked like this

Sorting... Done
Full Text Search... Done
linux-headers-5.19.0-76051900-generic/jammy 5.19.0-76051900.202207312230~1663791054~22.04~28340d4 amd64 [upgradable from: 5.19.0-76051900.202207312230~1660780566~22.04~9d60db1]
  Linux kernel headers for version 5.19.0 on 64 bit x86 SMP

In my case, my headers are called linux-headers-5.19.0-76051900-generic So:

sudo apt install <your headers>

3. Install v4l2

Then you can install the library
sudo apt install v4l-utils v4l2loopback-utils v4l2loopback-dkms

4. Test

Reboot and open OBS. You should see the virtual camera button appear. Click the button and look for the virtual camera in wherever source you're streaming to.

0

Install missing linux library

It seems that you can follow all the listed answers but it still doesn't work because your missing a linux library.

I found this in the depths of github here.

sudo apt update && \
sudo apt -y install linux-modules-extra-$(uname -r) && \
sudo apt -y install dkms

The key is the library linux-modules-extra-** which is customized to your OS. After that, you can do just the normal installation steps:

sudo apt install v4l2loopback-dkms
sudo modprobe v4l2loopback

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .