Creating a webcam stream of your desktop, instead of an actual webcam is very easy on Linux. The v412loopback package provides a kernel module that will emulate a webcam, using any video input you wish to give it.
Install it like this.
┌──[jason@192.168.1.2]─[~] └──╼ ╼ $ sudo apt install v4l2loopback-dkms |
Then, load the kernel module.
┌─[jason@jason-desktop]─[~] └──╼ $sudo modprobe v4l2loopback |
Now, create a webcam stream, using your Linux desktop. This is how to stream your desktop to the Internet on Youtube.
┌─[jason@jason-desktop]─[~] └──╼ $ffmpeg -f x11grab -r 15 -s 1280x720 -i :1 -vcodec rawvideo -pix_fmt yuv420p -vf hflip -threads 0 -f v4l2 /dev/video0 |
This would be very useful for anyone who wants to show off stuff on the Internet on their desktop and wants to use a Youtube stream to do it. This is a lot of fun. If the video is flipped horizontally, then use the -vf hflip parameter to flip it to the right orientation.
The screenshot above shows the result of testing my webcam online. But this really does work very well.
Step 1 is misspelled
Fixed. The package name is correct now, I just checked in Ubuntu 20.04.