TransWikia.com

Stream linux destop as fake webcam to virtuabox windows guest

Super User Asked by nick maxwell on January 1, 2022

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!

One Answer

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

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP