Posted: . At: 7:46 AM. This was 4 years ago. Post ID: 14602
Page permalink. WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters.
These cookies expire two weeks after they are set.



Sponsored



How to create a fake webcam stream on Linux.


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.

Testing fake webcam online.
Testing fake webcam online.

The screenshot above shows the result of testing my webcam online. But this really does work very well.


2 thoughts on “How to create a fake webcam stream on Linux.”

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.