3
fake webcam streams ubuntu18
Mehran Dehghanian edited this page 3 years ago
Install the important dependencies
sudo apt install v4l2loopback-dkms
sudo apt install ffmpeg
Install v4l2loopback
git clone https://github.com/umlaeute/v4l2loopback.git
cd v4l2loopback
make
sudo su
make install
sudo depmod -a
If you faced error for linux headers we should install them manually for ubuntu:
apt-get install linux-headers-$(uname -r)
for Debian:
apt-get update
apt-get install linux-image-amd64 linux-headers-amd64
Add Kernel Modules
sudo modprobe v4l2loopback card_label="My Fake Webcam" exclusive_caps=1
Link Video Stream To Fake Webcam
Find video feed in dev
ls -1 /dev/video*
Next up, we need to “fake” our webcam feed with :
ffmpeg -stream_loop -1 -re -i /path/to/video -vcodec rawvideo -threads 0 -f v4l2 /dev/videoX
Remove the fake webcam streams
Once you are done with the fake stream, remove the previously loaded kernel modules with:
sudo modprobe --remove v4l2loopback
This should disable the fake webcam.
sources: