How to skip online classes with Linux

UPDATE: since 26.1, OBS officially provides virtual cam support for Linux. Just make sure to Install and load v4l2loopback


With this covid-19 lockdown situation, most of us have to attend lectures from home online. So I came up with a nice solution to show that I’m present at the online meeting while I play Xonotic in the background.

Now Install v4l2loopback

Btw, I use Arch so I’ll do

❯ sudo pacman -S v4l2loopback-dkms

If you don’t use Arch or Arch based distro then check if it’s in your distro’s repo, if not then compile it (its Ez) or add some kinda ppa or third party repo

Now check for video input devices in /dev

❯ ls /dev/video*
/dev/video0  /dev/video1

Now load v4l2loopback

❯ sudo modprobe v4l2loopback

Now again check of new device

❯ ls /dev/video*
/dev/video0  /dev/video1  /dev/video2

as you can see, /dev/video2 is new so it must be our new dummy webcam

Now pre record video of you sitting and paying attention to what your teacher is teaching. Make that video some what blurry and also reduce FPS so that your teacher wont notice that the video is looping.

Now feed that video to our dummy webcam

❯ while true ; do
ffmpeg -re -i good_student.mp4 -map 0:v -f v4l2 /dev/video2
done

I don’t know how to loop with ffmpeg So I’m using while loop. If you know better way then please correct. (send email)

Now open whatever your meeting app you use and choose our dummy webcam. I’m gonna use zoom

Zoom_Choose_Webcam

Zoom_Fake_Meeting

After your work is done, you can just remove the module with

❯ sudo rmmod v4l2loopback

Now what if your teacher calls your name and you don’t have real webcam to switch ? Fear not, DroidCam got you covered, Just follow this awesome tutorial by Mental Outlaw if you have Android phone