Streaming video from guest to host QEMU

Hi!
I have Linux on my computer.
Windows is installed in the QEMU virtual machine.
A webcam has been added to the virtual machine.
What is the best way to transfer video from a virtual machine’s webcam to the host machine?
The host and the guest it’s the same laptop.
Thank you.
Ip a on host:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host noprefixroute
       valid_lft forever preferred_lft forever
2: enp44s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN group default qlen 1000
    link/ether a0:36:bc:20:72:51 brd ff:ff:ff:ff:ff:ff
4: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether a0:59:50:65:e4:83 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.6/24 metric 600 brd 192.168.1.255 scope global dynamic wlan0
       valid_lft 7919sec preferred_lft 7919sec
    inet6 2403:6200:8871:88e7:a259:50ff:fe65:e483/64 scope global dynamic mngtmpaddr noprefixroute
       valid_lft 259196sec preferred_lft 172796sec
    inet6 fe80::a259:50ff:fe65:e483/64 scope link proto kernel_ll
       valid_lft forever preferred_lft forever
5: virbr0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 52:54:00:55:eb:24 brd ff:ff:ff:ff:ff:ff
    inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
       valid_lft forever preferred_lft forever
6: vnet0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master virbr0 state UNKNOWN group default qlen 1000
    link/ether fe:54:00:9e:fc:0d brd ff:ff:ff:ff:ff:ff
    inet6 fe80::fc54:ff:fe9e:fc0d/64 scope link proto kernel_ll
       valid_lft forever preferred_lft forever

ipconfig on guest wm:


Ethernet adapter Ethernet Instance 0:

   Connection-specific DNS Suffix  . :
   Link-local IPv6 Address . . . . . : fe80::8362:ac08:7da0:1a68%5
   IPv4 Address. . . . . . . . . . . : 192.168.122.183
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : 192.168.122.1

P.S. I do translation in OBS on my guest machine udp://192.168.122.1 And when I try to receive on host by udp://192.168.122.1, there is nothing…

THX!

sorry, but why would you even do this? Why not just use the camera on the host directly?

3 Likes

I wanna use Nvidia broadcast.
But now I’m already wondering how to do it in general)

Doesn’t anyone know the answer? Or is there something wrong with my question?)

Depends on your latency requirements I guess.

You could do plain old ffmpeg to ingest the camera and stream it via rtmp to an rtmp server on the host.

You could also run OBS on both the host and guest and use obs-teleport or obs-ndi. On the host you could then use the virtual camera if you need the device to still show up as a webcam.

There’s probably other options too.