Fake Webcam (Chrome & Firefox)
Here's a way setup a fake webcam from the command-line on Linux.
Dependencies
- Linux (I'm using Ubuntu)
- FFMpeg (video streaming tool)
- v4l2loopback (enables a fake video device)
Installing v4l2loopback (Fake Webcam)
# 1. Install v4l2loopback kernel module from apt
sudo apt install v4l2loopback-dkms
# 2. Enable the "fake webcam", via v4l2loopback kernel module
sudo modprobe v4l2loopback devices=1 card_label="My Fake Webcam" exclusive_caps=1
Video File (Looped) as Fake Webcam
# Link video file (on loop) to the "fake webcam"
ffmpeg -stream_loop -1 -re -i ./MYFILE.mp4 -vcodec rawvideo -pix_fmt yuv420p -threads 0 -f v4l2 /dev/video0
Desktop Video as Fake Webcam
# Link desktop video stream to the "fake webcam"
ffmpeg -f x11grab -r 15 -s 1280x720 -i :0.0+0,0 -vcodec rawvideo -pix_fmt yuv420p -threads 0 -f v4l2 /dev/video0
The great part about this is that it works for both Firefox and Chrome! As it fakes the webcam at the kernel level.
Test your fake webcam here: https://webcamtests.com/
Chrome Test (Desktop Feed)
Firefox Test (Desktop Feed)
Disable Fake Webcam
If you need to disable it...
# To disable the fake webcam, simply remove it from the kernel
sudo modprobe --remove v4l2loopback
Anyway, hope someone finds this useful!
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…