I wanted a slicker-looking live video presence than what I could achieve with Zoom1 and its wonderful virtual background feature. Some time ago I learned about OBS Studio, but it presents a steep learning curve and it took me quite some time to find the energy to sit down and start climbing that curve. When I finally did so, I learned about a simple idea: you can create a virtual camera device the captures the output from OBS Studio, then makes that available to other applications as just another video source. This means that I could create cool scenes and transitions in OBS Studio, then use them in a live video, such as a conference talk or real-time video training session. That sounded great to me! When I tried to learn how to do it, unfortunately, it seemed I needed Windows or Mac OS to do it… and I have been running Pop!_OS Linux since the summer of 2018.
I Found It!
I spent an hour watching tutorial videos on YouTube about getting OBS Studio up and running on Linux. I had previously installed it and played around with it, but I hadn’t learned much about how really to use it, so I finally took the time to do that today. In the process, I stumbled upon a Linux plugin to enable the virtual camera device in OBS Studio. I tried it and it worked! I found it relatively painless to build and install and get working. Since I had to cobble a couple of things together to make it room and I needed to tweak something slightly, I thought I’d do my duty as a FOSS citizen and put the instructions together here, hoping that the next person who needs it can find it all in one place. Enjoy!
I found, built, and installed the following:
- A video loopback device, which creates the virtual camera device that Linux can present to applications as just another video source.
- A video sink plugin for OBS Studio, which connects the output from OBS Studio to the video loopback device.
I think of these two things as acting like an HDMI cable from OBS Studio to the Linux video subsystem: it allows you to capture output from OBS Studio in exactly the same way as you’d capture video from an internal webcam or an external camera connected by an HDMI/USB adapter.
I found projects on Github for each of these two pieces of software, installed them, and they just worked! The whole thing took about 15 minutes.
I’m running Pop!_OS 19.10, which is pretty close to Ubuntu 19.10. I have OBS Studio 25.0.8.
Video Loopback Device
I followed the instructions at https://github.com/umlaeute/v4l2loopback to install the video loopback device. I found these instructions easy to follow, but I didn’t like that the resulting virtual camera device appeared in Linux as “Dummy output device (0x0000)”, so I’ve added here the instructions to giving your virtual camera device a user-friendly name.
Before I started, I listed my video devices, so that I could more-easily detect whether something changed after building this project.
Otherwise, I cloned the project, built it, installed it, then loaded the resulting kernel module.
# I choose to put third-party projects here $ cd $HOME/ThirdParty # Note: if you choose someone else's fork, then clone that repository instead! $ git clone https://github.com/umlaeute/v4l2loopback.git # The directory that git creates $ cd v4l2loopback $ make # Installs new kernel module called v4l2loopback $ sudo make install # Load modules that v4l2loopback might need $ sudo depmod -a # You can choose any name you like for the card_label argument below $ sudo modprobe v4l2loopback card_label="Virtual Cam"
After this, I checked that I had a new virtual camera device.
Hey, I saw a new video device at
/dev/video2! Good. I used that device pathname to tell the OBS Studio plugin where to broadcast its video.
I opened Zoom, found the setting for which video source to use, then chose “Virtual Cam”. The option existed, which showed me that I had created a virtual camera device, but it showed nothing, because nothing was sending video to it.
OBS Studio Video Sink
I found https://github.com/CatxFish/obs-v4l2sink, but then I noticed no commits since October 2018, which made me nervous. I browsed the forks and found one with a recent commit, then decided to take a chance on building that version.
I followed the instructions at https://github.com/AndyHee/obs-v4l2sink. (I tried to, but they referred to
CatxFish’s version of the project, which I didn’t notice until I found a compile error. I have issued a pull request to update the README. I’m trying.) To build this plugin, I need to have the libraries from OBS Studio itself, which adds a step. I also need the QT Base 5 development libraries, which adds another step.
# I choose to put third-party projects here $ cd $HOME/ThirdParty # Install QT 5 development libraries $ sudo apt install qtbase5-dev # I need the OBS Studio libraries $ git clone --recursive https://github.com/obsproject/obs-studio.git # Choose the desired fork! $ git clone https://github.com/AndyHee/obs-v4l2sink.git $ cd obs-v4l2sink $ mkdir build && cd build # In my case, OBS_STUDIO_PROJECT_ROOT=$HOME/ThirdParty/obs-studio # In my case, OBS_V4L2SINK_PROJECT_ROOT=$HOME/ThirdParty/obs-v4l2sink $ cmake -DLIBOBS_INCLUDE_DIR="$OBS_STUDIO_PROJECT_ROOT/libobs" -DCMAKE_INSTALL_PREFIX=/usr $OBS_V4L2SINK_PROJECT_ROOT $ make -j4 $ sudo make install
Next, I opened OBS Studio to tell it which video device to send its output to.
- Choose Tools > V4L2 Video Output.
- Enter the device pathname for “Path to V4L2 Device”. In my case, this is
- Press Start.
Now OBS Studio is sending a video signal to the virtual camera device!
I opened Zoom, started a meeting, selected the Virtual Cam video source, and it just worked!
Cleaning Up Before Moving On
I have to remember to tell OBS Studio to start sending output to
/dev/video2, but otherwise, this just works. The OBS Studio plugin has an option to start the video automatically, but I haven’t decided whether I want this yet. I’ll decide that later.
That’s it! Enjoy.
DistroTube, “Open Broadcaster Software (OBS) In Linux”. The tutorial I found most helpful (so far) and in whose comments I stumbled upon the virtual camera device plugin for OBS Studio on Linux.
Yes, I’m aware of the various security/privacy problems with Zoom. I don’t know how to solve that problem and I don’t have a good alternative on Linux. If you want to suggest one, I’m happy to hear about it!↩