1

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 modprobe v4l2loopback.

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.

enter image description here

enter image description here

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!

2
  • Does it work in VLC in the Windows VM? Show the complete log from your ffmpeg command
    – llogan
    Commented Jul 24, 2020 at 18:28
  • thanks for the comment. I added a screen grab of ffmpeg's output, with verbose logging. I ran VLC in windows, it shows the same blue-screen feed. Commented Jul 27, 2020 at 16:57

1 Answer 1

1

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .