Linux: Camera with blur effects

Nicola Landro
2 min readDec 1, 2021

During video call at home maybe you want to blur your background or to sobstitute it, we can do it also on linux simply without specific feature of program used for the video call.

VLC test

This post explain how to create a virtual camera on linux with blur effect by using v4l2loopback and Linux-Fake-Background-Webcam.

Requirements

Create a folder in which clone the requirements

mkdir CAMERA_EFFECTS

v4l2loopback, on open suse you just run `sudo zypper install v4l2loopback-kmp-default` but on ubuntu based/mint you must compile it with following:

cd CAMERA_EFFECTS
git clone https://github.com/umlaeute/v4l2loopback.git
cd v4l2loopback
make
sudo make install
sudo depmod -a

Linux-Fake-Background-Webcam

cd CAMERA_EFFECTS
git clone https://github.com/fangfufu/Linux-Fake-Background-Webcam.git
cd Linux-Fake-Background-Webcam
python3.8 -m pip install --upgrade pip
python3.8 -m pip install requirements.txt

Run

Connect your USB camera.

Create fake camera:

sudo modprobe v4l2loopback devices=1 exclusive_caps=1 video_nr=2 card_label="fake-cam"

Exec fake script with blur option only:

cd CAMERA_EFFECTS
cd Linux-Fake-Background-Webcam
python3.8 fake.py --no-background --no-foreground --background-blur 50 --background-blur-sigma-frac 5

Test with VLC

Open VLC and connect to your camera with index 2 and you can see the results

VLC menu of acquisition

Now you can use whit Zoom, Teams and what you want.

Automatize

To automatize the process I create a set_virtual_camera.sh (with chmod +x set_virtual?camera.sh) with this lines:

#!/bin/bashsudo modprobe v4l2loopback devices=1 exclusive_caps=1 video_nr=2 card_label="fake-cam"cd Linux-Fake-Background-Webcam && python3.8 fake.py --no-background --no-foreground --background-blur 50 --background-blur-sigma-frac 5

Conclusions

It is easy to create this effect and also to automatize the configuration. You can also expand by background images and for ground images to be more friendly but I prefer only a blur effect.

Enjoy your video call and use Linux!

--

--

Nicola Landro

Linux user and Open Source fun. Deep learning PhD. , Full stack web developer, Mobile developer, cloud engineer and Musitian.