1.8 KiB
V4L2
V4L2 is the second version of Video4Linux. It functions as a driver for webcams and tv tuner cards and other devices.
v4l2loopback
The following section is based on a gist by ioquatix.
v4l2loopback is a utility to create
a virtual video device.
One use of it is in OBS Virtual Camera.
To use v4l2loopback an according
package needs to be installed.
Some distributions have a package named v4l2loopback-dkms
in the package
manager, making the manual installation process unnecessary.
Afterwards v4l2loopback can be manually started by running:
modprobe v4l2loopback card_label='V4L2 Loopback' video_nr=7 exclusive_caps=1
video_nr=7
states the device path to use with v4l2loopback - in this case
/dev/video7
.
This can be changed according to the needs.
It is important that the device is not already in use by another application.
For an automatic start at boot via SystemD a service can be
created - as described in the SystemD entry.
For v4l2loopback create the file /etc/systemd/system/v4l2loopback.service
containing the following lines:
[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
Note the line starting with ExecStart=/bin/
is the same line described above
to change the device path.
Make sure to change it if needed.
Afterwards enable the service to start at every boot process by running:
sudo systemctl enable v4l2loopback