v4l2loopback on Linux: Setup, Persistence and Common Errors
Linux has no virtual camera built in. Applications open a device such as /dev/video0 and read frames from it, and the kernel expects real hardware behind that. v4l2loopback is a kernel module that creates a device which behaves like a camera but is fed by software instead.
It is the foundation for every virtual-camera workflow on Linux — OBS, ffmpeg pipelines and CamLooper all write into a loopback device. Here is how to set it up properly.
Install
Install the DKMS package so the module is rebuilt automatically whenever your kernel updates:
# Debian / Ubuntu
sudo apt install v4l2loopback-dkms
# Fedora / RHEL
sudo dnf install v4l2loopback
# Arch
sudo pacman -S v4l2loopback-dkms
DKMS matters here. Without it the module is compiled against the kernel you had at install time, and your virtual camera silently stops working after the next kernel upgrade.
Load the module
sudo modprobe v4l2loopback
Confirm the device exists:
lsmod | grep v4l2loopback
ls -l /dev/video*
Useful options when loading it:
sudo modprobe v4l2loopback \
devices=1 \
video_nr=10 \
card_label="Virtual Camera" \
exclusive_caps=1
video_nr=10pins the device to/dev/video10so it does not collide with a real webcamcard_labelsets the name apps display in their camera listexclusive_caps=1is the important one — it makes the device advertise capture capability only when something is writing to it. Chrome, Firefox and several Electron apps ignore loopback devices without it, which is why a camera can be visible inv4l2-ctlyet missing from your browser
Make it survive a reboot
modprobe lasts until you restart. Two files make it permanent:
# /etc/modules-load.d/v4l2loopback.conf
v4l2loopback
# /etc/modprobe.d/v4l2loopback.conf
options v4l2loopback devices=1 video_nr=10 card_label="Virtual Camera" exclusive_caps=1
The first loads the module at boot; the second supplies its options. People frequently write only the first and then wonder why their options disappeared.
Test it without any app
Push a looping video into the device with ffmpeg:
ffmpeg -stream_loop -1 -re -i video.mp4 \
-f v4l2 -pix_fmt yuv420p /dev/video10
-re paces the stream at real time (without it, ffmpeg writes as fast as it can and the result is unusable), -stream_loop -1 repeats forever, and yuv420p is the pixel format webcam consumers expect. Open a webcam test page in your browser and you should see the video.
Common errors
modprobe: ERROR: could not insert 'v4l2loopback': Required key not available
Secure Boot is rejecting the unsigned module. Either enrol a Machine Owner Key and sign the module, or disable Secure Boot in your firmware. Distributions that ship a signed build of the module avoid this entirely.
The module builds but no /dev/video device appears
Check dmesg | tail right after modprobe. A version mismatch between the module and the running kernel shows up here, and it is the usual sign that DKMS did not rebuild after an upgrade.
The camera exists but browsers cannot see it
Load the module with exclusive_caps=1. This is the single most common cause.
Flatpak apps cannot see the camera
The sandbox blocks device access until you grant it:
flatpak override --user --device=all com.obsproject.Studio
Skipping all of this
Everything above is a one-time setup, but it is still a terminal session and a reboot before you can play a video as your camera — and it is why "just use OBS" is harder advice on Linux than on Windows.
CamLooper's .deb and .rpm packages do this for you. They declare v4l2loopback-dkms as a dependency, install the modules-load.d and modprobe.d files shown above, and load the module during installation, so the camera is ready when the installer finishes and again after every reboot. No terminal, no reboot, and DKMS keeps it working across kernel upgrades.