How To Use OBS Studio With Zoom

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.

The Basics

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

Using APT

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.

Adding v4l2sink

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.

mkdir myobscode
cd myobscode

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

cd obs-v4l2sink
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:

make -j4

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:

Screenshot of v4l2sink properties

Screenshot of v4l2sink properties

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.

OBS Studio webcam source config

OBS Studio webcam source config. Hanging green material behind you is left as an exercise.

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.

Select OBS Studio video source for Zoom

Select OBS Studio video source for Zoom

Now you can explore the fun video effects and scene switching capabilities of OBS Studio!

Beware giant kittens!

Beware giant kittens!

 

Bookmark the permalink.

3 Comments

  1. Pingback: Remote Work Makes Us All Content Creators - Gestalt IT

  2. Thomas Balatsos

    hello from greece. I am a teacher and i would like to stream from obs to zoom. i follow your tutorial and im stack there
    cmake -DLIBOBS_INCLUDE_DIR=”../../obs-studio/libobs” -DCMAKE_INSTALL_PREFIX=/usr ..

    — The C compiler identification is GNU 7.5.0
    — The CXX compiler identification is unknown
    — Check for working C compiler: /usr/bin/cc
    — Check for working C compiler: /usr/bin/cc — broken
    CMake Error at /usr/share/cmake-3.10/Modules/CMakeTestCCompiler.cmake:52 (message):
    The C compiler

    “/usr/bin/cc”

    is not able to compile a simple test program.

    It fails with the following output:

    Change Dir: /home/balatsa/myobscode/obs-v4l2sink/build/CMakeFiles/CMakeTmp

    Run Build Command:”/usr/bin/make” “cmTC_ad30a/fast”
    /usr/bin/make -f CMakeFiles/cmTC_ad30a.dir/build.make CMakeFiles/cmTC_ad30a.dir/build
    make[1]: Entering directory ‘/home/balatsa/myobscode/obs-v4l2sink/build/CMakeFiles/CMakeTmp’
    Building C object CMakeFiles/cmTC_ad30a.dir/testCCompiler.c.o
    /usr/bin/cc -o CMakeFiles/cmTC_ad30a.dir/testCCompiler.c.o -c /home/balatsa/myobscode/obs-v4l2sink/build/CMakeFiles/CMakeTmp/testCCompiler.c
    Linking C executable cmTC_ad30a
    /usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_ad30a.dir/link.txt –verbose=1
    /usr/bin/cc CMakeFiles/cmTC_ad30a.dir/testCCompiler.c.o -o cmTC_ad30a
    /usr/bin/ld: cannot find Scrt1.o: ??? ??????? ?????? ?????? ? ?????????
    /usr/bin/ld: cannot find crti.o: ??? ??????? ?????? ?????? ? ?????????
    collect2: error: ld returned 1 exit status
    CMakeFiles/cmTC_ad30a.dir/build.make:97: recipe for target ‘cmTC_ad30a’ failed
    make[1]: *** [cmTC_ad30a] Error 1
    make[1]: Leaving directory ‘/home/balatsa/myobscode/obs-v4l2sink/build/CMakeFiles/CMakeTmp’
    Makefile:126: recipe for target ‘cmTC_ad30a/fast’ failed
    make: *** [cmTC_ad30a/fast] Error 2

    CMake will not be able to correctly generate this project.
    Call Stack (most recent call first):
    CMakeLists.txt:2 (project)

    CMake Error at CMakeLists.txt:2 (project):
    No CMAKE_CXX_COMPILER could be found.

    Tell CMake where to find the compiler by setting either the environment
    variable “CXX” or the CMake cache entry CMAKE_CXX_COMPILER to the full path
    to the compiler, or to the compiler name if it is in the PATH.

    — Configuring incomplete, errors occurred!
    See also “/home/balatsa/myobscode/obs-v4l2sink/build/CMakeFiles/CMakeOutput.log”.
    See also “/home/balatsa/myobscode/obs-v4l2sink/build/CMakeFiles/CMakeError.log”.

    what am i doing wrong;

    sorry for my english

    Thank you in advance

  3. Your development environment is broken. You’ll need to re-install the C-compiler.

    You can see the system trying to tell you this in the error message:

    The C compiler
    
    “/usr/bin/cc”
    
    is not able to compile a simple test program.
    

    Try this:

    apt install --reinstall gcc g++

    and then try running cmake again.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.