0% found this document useful (0 votes)
154 views

How To Create A Virtual Background in Ubuntu For Discord Etc - Reader View

The document provides instructions for creating a virtual background in Ubuntu for video conferencing apps like Discord. It involves installing software like v4l2loopback to create a virtual camera, and OBS Studio which can replace a green screen background with a virtual image. Key steps include procuring a green screen, installing necessary software packages, cloning repositories for v4l2loopback and an OBS plugin, compiling them, and configuring OBS Studio to capture the webcam and apply filters to chroma key the green screen and add a virtual background image.

Uploaded by

nenhummail
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
154 views

How To Create A Virtual Background in Ubuntu For Discord Etc - Reader View

The document provides instructions for creating a virtual background in Ubuntu for video conferencing apps like Discord. It involves installing software like v4l2loopback to create a virtual camera, and OBS Studio which can replace a green screen background with a virtual image. Key steps include procuring a green screen, installing necessary software packages, cloning repositories for v4l2loopback and an OBS plugin, compiling them, and configuring OBS Studio to capture the webcam and apply filters to chroma key the green screen and add a virtual background image.

Uploaded by

nenhummail
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

3/30/22, 9:39 AM How to create a virtual background in Ubuntu for Discord etc :: Reader View

grenaud.github.io
/teaching/2021/01/15/virtual-background-discord.html

How to create a virtual background in Ubuntu for


Discord etc
3-4 minutes

Due to the COVID19 situation, I recently had to teach a class via Discord. My new “office”
is merely a desk in a kitchen, nothing glamorous. While I was teaching, I wanted to give
my family the privacy to come and go so I decided to set up a virtual screen. However,
Discord is not like Zoom, you cannot simply set up a virtual screen.

I am running Ubuntu and needed a way to hide my background in Discord. You after
reading a few blog posts, I decided to share what I learned.

The first step is to procure a green screen. I purchased a relatively cheap one on Alibaba.
The second thing is to set up a virtual camera in Ubuntu. The trick is to capture the
camera with the green screen and create a virtual camera that casts your image
with the virtual background. Believe me, it is less painful than it sounds. The solution is
to use two pieces of software, one that will create a virtual camera (v4l2loopback) and
OBS studio which will take your camera, replace the green screen with a virtual
background and broadcast to the virtual camera.

First, you need to install some software:

sudo add-apt-repository ppa:obsproject/obs-studio

sudo apt install ffmpeg

sudo apt update

cd ~/Downloads/

git clone https://github.com/umlaeute/v4l2loopback.git

make

sudo make install

sudo depmod -a

sudo modprobe v4l2loopback

The last command installs the virtual camera. This command may fail. This can be the
case if you’re not logged in as a user with sudo rights or if you have secure boot.

We need a few modules to interface between OBS studio and v4l2loopback:

sudo apt install qtbase5-dev

sudo apt install libobs-dev

cd ~/Downloads/

chrome-extension://ecabifbgmdmgdllomnfinbmaellmclnh/data/reader/index.html?id=274&url=https%3A%2F%2Ffanyv88.com%3A443%2Fhttps%2Fgrenaud.githu… 1/2
3/30/22, 9:39 AM How to create a virtual background in Ubuntu for Discord etc :: Reader View

git clone --recursive


https://github.com/obsproject/obs-studio.git

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

cd obs-v4l2sink

mkdir build && cd build

OBS_STUDIO_PROJECT_ROOT=$HOME/Download/obs-studio

OBS_V4L2SINK_PROJECT_ROOT=$HOME/Download/obs-v4l2sink

cmake -
DLIBOBS_INCLUDE_DIR="$OBS_STUDIO_PROJECT_ROOT/libobs" -
DCMAKE_INSTALL_PREFIX=/usr $OBS_V4L2SINK_PROJECT_ROOT

Finally, we will install OBS studio:

sudo apt install obs-studio

obs

Then, test the virtual camera: go to “Tools” and “V4L2 Video Output”. You need to set up
the path to V4L2 Device. In my case, this is /dev/video2.

In sources, add Video Capture (this is your webcam). Also, add “Image” as a source and
use it to set up the virtual image that you want.

Then we need to modify our webcam stream using “filters”. We will set up the filters by
selecting Video Capture and clicking “Filters”. Three filters are important:

1. “chroma key” is the actual filter that replaces the green for a virtual background, play
with similarity until it works and your face is still clearly visible
2. “color correction” can correct minor color problems
3. “Crop/pad” is very useful if your green screen does not cover a patch of the ceiling
or something.

And there you go you have a virtual camera like those professional gamers!

chrome-extension://ecabifbgmdmgdllomnfinbmaellmclnh/data/reader/index.html?id=274&url=https%3A%2F%2Ffanyv88.com%3A443%2Fhttps%2Fgrenaud.githu… 2/2

You might also like