6. Video Streaming

SPICE streaming allows sending an encoded video stream of the guest desktop to the client. The encoding can be done from the host (inside SPICE server) or from the guest, with the help of the SPICE streaming agent.

The streaming agent is a daemon/service running in the guest OS so it must be installed if it does not yet exist on the guest system. It relies on a dedicated spiceport char device to achieve communication between the guest and the host. This device must be added to the virtual machine as described below for the streaming agent to work in the guest.

6.1. Guest Video Encoding: Agent Configuration

Using virt-manager. The needed device can be added from the virtual machine details. Click on "Add hardware" and then add a "Channel" device with type "Spice port (spiceport)". The port should be named org.spice-space.stream.0, and the channel should also be org.spice-space.stream.0.

Using libvirt. Two distinct devices must be added:

<devices>
    <controller type='virtio-serial' index='0'/>
    <channel type='spiceport'>
        <source channel='org.spice-space.stream.0'/>
        <target type='virtio' name='org.spice-space.stream.0'/>
    </channel>
</devices>

Using QEMU. Adding the following parameters to your QEMU command line will enable the needed devices for agent support in the guest OS:

-device virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel1,id=channel1,name=org.spice-space.stream.0 \
-chardev spiceport,name=org.spice-space.stream.0,id=charchannel1

6.2. Host Video Encoding

For host video encoding, SPICE natively supports MJPEG encoding. For using further codecs, SPICE server must be compiled with GStreamer support.

Setting. SPICE video streaming parameter can take three values:

  • off: no video detection is performed,
  • all: any fast-refreshing window can be encoded into a video stream,
  • filter: SPICE server adds additional filters to decide if video streaming should be activated (at the moment, only small window surfaces are skipped),

Using libvirt. The streaming tag must be added to Spice graphics:

<graphics type='spice' autoport='yes'>
    <streaming mode='off|all|filter'/>
</graphics>

Using QEMU. Adding the following parameters to your QEMU command line will enable SPICE server video encoding:

-spice ...,streaming-video=off|all|filter,...