green screen with OBS on Fedora

We have to compile stuff so

sudo dnf group install -y "Development Tools"
sudo dnf install -y kernel-devel kernel-headers dkms v4l-utils

install the v4l2loopback module with dkms

git clone https://github.com/umlaeute/v4l2loopback.git
cd v4l2loopback
export V4L2LOOPBACK_VERSION=`./currentversion.sh`
sudo mkdir /usr/src/v4l2loopback-$V4L2LOOPBACK_VERSION
sudo cp -av * /usr/src/v4l2loopback-$V4L2LOOPBACK_VERSION
sudo dkms install v4l2loopback/$V4L2LOOPBACK_VERSION

set v4l2loopback options

sudo bash -c 'cat << EOF > /etc/modprobe.d/v4l2loopback.conf 
options v4l2loopback exclusive_caps=1
EOF'

set v4l2loopback to autoload on boot

sudo bash -c 'cat << EOF > /etc/modules-load.d/v4l2loopback.conf
v4l2loopback
EOF'

load v4l2loopback

sudo modprobe v4l2loopback

check to see if the video device was created

v4l2-ctl --list-devices

You shoud see a "Dummy" video device similar to this

Dummy video device (0x0000) (platform:v4l2loopback-000):
    /dev/video0

Enable RPMfusion if you haven't already

sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm

Install Obs and development libraries

sudo dnf install qt5-qtbase-devel obs-studio obs-studio-devel

Clone the obs-v4l2sink repo

git clone https://github.com/CatxFish/obs-v4l2sink.git

Change directory

cd obs-v4l2sink

Create a patch file

cat << EOF > ./patch.diff
diff --git a/external/FindLibObs.cmake b/external/FindLibObs.cmake
index ab0a3de..7758ee3 100644
--- a/external/FindLibObs.cmake
+++ b/external/FindLibObs.cmake
@@ -95,7 +95,7 @@ if(LIBOBS_FOUND)

        set(LIBOBS_INCLUDE_DIRS ${LIBOBS_INCLUDE_DIR} ${W32_PTHREADS_INCLUDE_DIR})
        set(LIBOBS_LIBRARIES ${LIBOBS_LIB} ${W32_PTHREADS_LIB})
-       include(${LIBOBS_INCLUDE_DIR}/../cmake/external/ObsPluginHelpers.cmake)
+       include(/usr/lib64/cmake/LibObs/ObsPluginHelpers.cmake)

        # allows external plugins to easily use/share common dependencies that are often included with libobs (such as FFmpeg)
        if(NOT DEFINED INCLUDED_LIBOBS_CMAKE_MODULES)
EOF

Patch it

git apply patch.diff

Build it

mkdir build && cd build
cmake -DLIBOBS_INCLUDE_DIR="/usr/include/obs" -DCMAKE_INSTALL_PREFIX=/usr ..
make -j4

Install it

sudo make install

Move the plugin to the correct directory for Fedora

sudo mv /usr/lib/obs-plugins/v4l2sink.so /usr/lib64/obs-plugins/v4l2sink.so

Thanks to Tom Callaway for the help with obs-v4l2sink! -> https://spot.livejournal.com/327990.html

Now use Obs to create lulz

  • Thumb tack a green sheet on the wall behind you or whatever type of green screen you want to use
  • In the Obs Sources menu click the + button and select Video Capture Device (V4L2).
  • Give the video device a name and click OK
  • On the next window select the device you want to use to capture your face and tweak any settings
  • Now right click on the newly created video device in the Sources box and select Filters
  • Click the + button in the Effect Filters box and select Chroma Key and give it a name
  • Adjust the Similarity slider to get the desired effect and click close
  • Click the + button in the sources to add any photos, videos or windows you want to preset behind you
  • When you're happy with your scene select "Tools->V4L2 Video Output" from the top menu
  • Run v4l2-ctl --list-devices in a terminal to get the device name of the Dumy Video Device and enter it in the output window and press start
  • Now simply select the Dummy Video Device in whatever video conferencing software you're using
  • Impress your coworkers and friends with how clever and witty you are