[SOLVED] Passthough of a "webcam" created via gstreamer =>solid blue

Discussions related to using VirtualBox on Linux hosts.

[SOLVED] Passthough of a "webcam" created via gstreamer =>solid blue

Postby sbpetrack » 22. Jan 2020, 04:33

On a windows host, I can use "virtual camera" software like SplitCam and ManyCam and use a single Webcam on BOTH host and guest simultaneously. I want to do this with a linux host, but there is no Linux-software analogous which is analogous to SplitCam or ManyCam. However, there is a very powerful framework called gstreamer, which lets me easily create a v4l2loopback device, and the following one-line command takes the H.264-encoded stream from my Logitech C920 camera and puts it straight back into a new video device:

gst-launch-1.0 uvch264src device=/dev/video3 name=src auto-start=true src.vfsrc ! queue ! video/x-raw,format=YV12,width=320,height=240 ! queue ! \
v4l2sink device=/dev/video5

Here /dev/video3 is the Logitec c920, and /dev/video5 is a v4l2loopback device . The fact is that such devices can be opened for reading by mulitple processes at the same time. Indeed, on the Linux host, I can run skype, zoom, Ring Central and whereby.com all simultaneous -- feeding FOUR (4) separate applications from a single camera feed. This works seamlessly because that /dev/video5 device, created by the v4l2sink, **is** a video capture device, so it "just works". Please note that alhtough the C920 is a USB camera /dev/video 5 is not. But it is the stream of a webcam that happens to be virtual

I want to use this new video device in a windows guest. I have no choice but to use webcam passthrough, because /dev/video5 doesn't have a VID or PID. When I do, the camera showws perfectly the the Windows 10 guest, and in every application that needs a camera. The problem is that the video is a solid blue screen.

Should i expect this to work? Am I correct that there's no way I can shoehorn my situation into one where I'd use USB passthhrough?

Therefore I'm following the advice you gave , namely to run the command
VBoxManage debugvm Win7 log --release "+USB_WEBCAM.e.l2.l3,-USB_WEBCAM.restrict"
attach the /dev/video5 device and look at this put tp verifiy that is a pure blue square

I attach the VBox.log file. Perhaps it is the VERR_NOT_SUPPORTED there that is the problem. I thank you in advance for examining the .log file and letting me know what you find.
Attachments
VBox.log.zip
added "solved"
(81.26 KiB) Downloaded 1 time
Last edited by sbpetrack on 22. Jan 2020, 06:57, edited 1 time in total.
sbpetrack
 
Posts: 11
Joined: 20. Sep 2014, 09:41

Re: Passthough of a "webcam" created via gstreamer =>solid blue

Postby sbpetrack » 22. Jan 2020, 06:57

"NEVERMIND..."

Just in case some other weirdo wants to do the same thing:

Yes, it **is** possible to "share" a webcam and have it run under both host and guest simultaneously. Clearly, you are not guaranteed to get identical deliveries of video bits to both machines -- there are different buffers and queues involved. But you can get it so the two streams are utterly indistinguishable.
From the previous post, I just made the assumption that if I was told to post the logs, it must be because they contain some clues :). And indeed there was some early nonsense in the logs that suggested simply that the out format of then stream was not one supported by the Windows driver. I don't know much about the topic, but it seemed to me that the simplest rawest format might be YV12 or YUY2. I ran into a little glitch in that it seems that (at least in the arch linux distro that i use), the plug-in I used to get the camera source bits -- called uvch264src -- could produce YUV1 but not YUY2 format.But the windows native 8uvc drive could not accept YUv1, but rather only YUY2. By putting in a small converter in the stream, I could do what I set out to do: create a uvc video device that could 1. produce a bit stream which could be consumed by both Windows and Unix, and 2. be opened for reading by different processes simultaneously. For the record, the gstreamer command I use in the end is:
gst-launch-1.0 uvch264src device=dev/video1 name=src auto-start=true src.vidsrc ! queue ! video/x-raw.format=YV12,width=800,height=600,fps=15/1! \ videoconvert ! video/x-raw,format=YUY2 !v4l2sink device=/dev/video5

I'm sure that v4l2sink has some properties to name the device etc. but with the barebones command above, I can use /dev/video5 in all my linux apps, and virtualbox will call the device "Dummy Video Device (0x0000)" You choose it in the menu "Devices"-->"Webcams". And then it works just fine in the WIndows
guest and in the Linux host.

I'll mark it as solved
sbpetrack
 
Posts: 11
Joined: 20. Sep 2014, 09:41


Return to VirtualBox on Linux Hosts

Who is online

Users browsing this forum: No registered users and 14 guests