I would like to capture (a part of) my linux desktop (ubuntu 20.04), stream it as a webcam to a windows 10 guest VM running in Virtualbox.
I found Using desktop as fake webcam on linux which got me pretty far.
So I installed v4l2loopback (
apt install v4l2loopback-dkms), then ran
Then I ran the ffmpeg command:
ffmpeg -f x11grab -framerate 25 -video_size 1280x720 -i :1.0+0,0 -f v4l2 /dev/video0
This works in that I can open /dev/video0 in VLC (Media > Open Capture Device> open /dev/video0) and see the stream.
It also works in that Virtualbox is able to see the /dev/video0 device. This is by navigating to "Devices > Webcams". I had to install the virtual box extension pack (
sudo apt install virtualbox-ext-pack).
Virtual box names the webcam device as "Dummy video device (0x0000", which matches the output of
v4l2-ctl --all -d /dev/video0 | grep "Card type" : "Card type : Dummy video device (0x0000)". The other devices it lists also similarly correspond correctly to /dev/video<0-6>.
So I’m confident that virtualbox is picking up on the right video feed.
The only problem is that windows only gets a blue screen (of course!) as the webcam feed. I don’t see the correct video feed that I get in VLC.
I did find this page: https://forums.virtualbox.org/viewtopic.php?f=7&t=96552, but haven’t been able to make heads-or-tails of the answer. I don’t know much about ffmpeg or gstreamer!
I may try the same thing with an ubuntu guest OS to make narrow it down to a Windows problem, or a video formatting problem.
Thanks in advance for any suggestions!
OK so the answer is to output in yuyv422 format
in my case
ffmpeg -loglevel verbose -f x11grab -framerate 25 -video_size 1280x720 -i :1.0+0,0 -f v4l2 -vf format=yuyv422 /dev/video6
you may have to figure out which /dev/video# is the right one.
Answered by nick maxwell on January 1, 2022
7 Asked on January 5, 2022 by user1201675
1 Asked on January 5, 2022 by kavita-garg
1 Asked on January 5, 2022
1 Asked on January 5, 2022 by tim-almond
2 Asked on January 5, 2022 by ctrlz
3 Asked on January 5, 2022 by janos-braem
2 Asked on January 5, 2022 by chris-le-sueur
2 Asked on January 5, 2022 by cyphics
0 Asked on January 5, 2022 by raymond-holguin
1 Asked on January 5, 2022 by perry_m
0 Asked on January 5, 2022
2 Asked on January 5, 2022
0 Asked on January 3, 2022 by chicagonyc
10 Asked on January 3, 2022
Get help from others!