I had the bright idea that I might like to use something like OBS Studio to make my video calls fancier.
It works! And it wasn’t too hard to get working, but it also wasn’t simple and I had to hunt around a lot to figure out how to do it. This post is a summary of the various steps I used to get OBS Studio working on Linux and piping video into Zoom.
What This Is Not
This is not a discussion of how to use OBS Studio on Windows, or MacOS, any non-Ubuntu flavour of Linux, or anything else.
I’ll try to give you pointers for where to start looking for solutions if your problem involves Windows or Mac, but you won’t find the answer here. If you’re on a Debian derivative, this may work out for you, but if you’re on something like Arch it might be weirder.
Sorry. But at least you found out early, rather than wading through dozens of forum posts chasing a tantalising hint that ended up going nowhere. Been there, comrade.
My setup involves the following components, which may materially affect the results:
- Ubuntu 18.04 LTS
- PulseAudio, but also jackd
- Zoom client for Linux version 3.5 (specifically 3.5.361976.0301)
- A paid Zoom account
OBS Studio is available using APT in Ubuntu, so you can install it like this:
sudo apt install obs-studio
This installs version 25.0.4-0obsproject3~bionic at time of writing.
Add v4l2loopback driver
You need to add a new video output to the system that Zoom can use to pull the video in from. Think of it as a virtual camera, if you like.
Linux has a kernel driver called v4l2loopback that can do this for us. Install it with APT:
sudo apt install v4l2loopback-dkms
We need to load it using modprobe, and we’ll add some parameters to make it easier for us to identify it from inside programs like Zoom:
sudo modprobe v4l2loopback video_nr=10 card_label="OBS Video Source" exclusive_caps=1
This will create our new video device as /dev/video10.
The parameter to video_nr sets the number of the device created, so if you wanted /dev/video24 you would use video_nr=24.
The card_label should show up in Zoom (and other apps) as the name of the device, making it easier to select the right one.
exclusive_caps=1 is apparently necessary for some versions of Chrome to be able to use the device. It sets the device to OUTPUT only mode and it won’t start announcing CAPTURE capabilities until you connect a producer (like OBS Studio) to it.
I have yet to try using a device without exclusive_caps enabled to see how well it works, but if/when I do I’ll update this section.
To get OBS Studio to send output to our new video device, I used the v4l2sink plugin from https://github.com/CatxFish/obs-v4l2sink. This plugin was originally for Windows but after people asked in this issue thread, the author wrote a version for Linux.
That thread contains a bunch of other hacks to get things working, which you might find interesting. The method I’m documenting here I found the simplest (relatively speaking), but if you want to do some more complex things with multi-streaming, you might find the discussion useful.
Building The Module
Building the source was fairly straightforward. The procedure is documented in the code repo, but I’ll duplicate it here so you can get all the info in one place. Do check the code if a lot of time has passed since this was published, since it might have changed.
Install some pre-requisites
I have a lot of code building tools already installed, so you might encounter some other missing dependencies. Do let me know if there are more I should include here.
sudo apt install cmake qtbase5-dev
Create a holding directory
Let’s create a directory to hold all the code related to this little exercise. It’s neater that way.
Clone the code for OBS Studio
This grabs the code for OBS Studio as well as a bunch of components it depends on.
git clone --recursive https://github.com/obsproject/obs-studio.git
The resulting code will be in directory myobscode/obs-studio
Clone the plugin code
We’re still in the myobscode directory, so we just grab the code:
git clone https://github.com/CatxFish/obs-v4l2sink
Build the plugin
mkdir build && cd build
cmake -DLIBOBS_INCLUDE_DIR="../../obs-studio/libobs" -DCMAKE_INSTALL_PREFIX=/usr ..
I’ll explain what the cmake line is doing.
The -DLIBOBS_INCLUDE_DIR parameter includes the OBS Studio libraries we need to link against.
The -DCMAKE_INSTALL_PREFIX tells cmake that we will be installing this plugin into the APT installed OBS Studio which gets installed into the /usr directory tree.
Let’s compile the code, using 4 CPUs in parallel:
Install the plugin
sudo make install
If you used the install prefix of /usr as in the example above, the plugin will get installed into the APT packaged plugin location: /usr/lib/obs-plugins/
Now we’re ready to connect OBS Studio to Zoom.
Connect OBS Studio to Zoom
Setup OBS Studio
Run OBS Studio, either from commandline with obs or using the system launcher.
Click on the Tools menu, and you should see an item at the bottom of the list called v4l2sink. Click on that, and you’ll get a window like this:
I’ve turned on AutoStart so that OBS Studio immediately starts sending data to the video device when I start it. You’ll need to remember to start the sink manually if you don’t want this to happen.
The device path matches the one we chose for our v4l2loopback device earlier.
I chose format of YUY2 because that’s what worked.
Add Webcam to Scene
You’ll need to minimally configure a Scene and a Source in OBS Studio. The intricate details of setting up OBS Studio are beyond the scope of this article, but you’ll need at least one scene with a webcam in it. Here are the settings for my Logitech USB webcam.
Your scene should now be streaming out to the v4l2sink. Let’s tell Zoom to get its video from there.
Start Zoom Client
If you already have the Zoom client running, you’ll need to exit completely from it and start it again. Zoom only appears to scan for possible webcams when it starts.
Start Zoom, and then open the Settings menu.
Go to Video settings, and use the pulldown menu to select the OBS Video Source, and you should see your webcam output as mediated by OBS Studio.
Now you can explore the fun video effects and scene switching capabilities of OBS Studio!