How To Create A Virtual Background in Ubuntu For Discord Etc - Reader View
How To Create A Virtual Background in Ubuntu For Discord Etc - Reader View
grenaud.github.io
/teaching/2021/01/15/virtual-background-discord.html
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.
cd ~/Downloads/
make
sudo depmod -a
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.
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
cd obs-v4l2sink
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
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