[Spice-devel] Discuss about camera redirection in SPICE

zhenwei pi pizhenwei at bytedance.com
Mon Jan 17 03:29:52 UTC 2022


On 1/14/22 8:51 PM, Gerd Hoffmann wrote:
>    Hi,
> 
>> Although USB redirection has already provided a solution to use a remote
>> webcam, I notice that it uses a heavy network(1280*720 at 30FPS in MJPEG uses
>> 5MB/s+). I have tested several webcam, and all of them don't support h264.
>> So I'd like to develop camera redirection in SPICE with h264 support, and
>> expect to reduce the network bandwidth(300K/s may be enough).
> 
> Well, one option would be to add usb webcam emulation to the spice client,
> simliar to cdrom redirection (which emulates an usb cdrom drive under
> the hood).  Advantage: works without spice protocol changes as you can
> simply tunnel everything through the usb redirection protocol.
> 
> I'd also recommend to look for another video codec (if possible, not
> sure what the usb webcam spec allows).  H.264 is a patent minefield,
> which makes it rather difficult to use in open source projects.  You'll
> end up with a lot of legal problems when it comes to software
> distribution.  vp8/9 would be a much better choice.
> 
> take care,
>    Gerd
> 
Hi,

Camera redirection through the USB redirection protocol seems feasible. 
But I have several concerns:
1, UVC started to support H.264 and VP8 since version 1.5, old version 
OS has no support(Link 
https://en.wikipedia.org/wiki/USB_video_device_class).

2, Even guest side supports UVC 1.5, the camera App still has a chance 
to select which format to use. We can control this from hypervisor side.

3, I noticed that USB emulation uses a lot of CPU, so I also have a plan 
to introduce virtio camera to reduce the CPU utilization. If we use this 
solution, it's difficult to do the extension in the future.

So from the point of my view, I prefer a common camera redirection 
protocol(event a hard work to do, but I can support it for a long time).

I will follow your opinion of the video codec to avoid the legal 
problems, thanks!

-- 
zhenwei pi


More information about the Spice-devel mailing list