What's the best way to push video from QEMU to GStreamer?

Guest os could be either Linux or Windows, host is Linux.

I need to capture video output from the QEMU (that is, from virtual display device) and push it into a GStreamer pipeline.

I’ve tried using libspice-client-glib, but video was very choppy, latency was pretty bad and quality wasn’t good as well. It’s probably due to multiple re-encodings though (qemu → spice-server [gstreamer|mjpeg] → socket → spice-client-glib [gstreamer|mjpeg] → (raw video) my app → gstreamer), but there doesn’t seem a better way to do it given the library API.

Other option seem to be rfbsrc but it doesn’t seem to be actively improved anymore. I’ve also heard some bad things about VNC, so not sure whether it’ll be any better.

Are there any other (potentially better) approaches?

Spice seems the most popular remote access to QEmu/KVM these days, unfortunatly we don’t have an easy source like rfbsrc. Perhaps you can learn how to implement a spice / gstreamer client from:

Spice is similar to RFB in the sense it can do JPEG but also H.264 encoding, that depends on the server (QEmu).

Is actually built from that repo. Funnily enough, it already makes use of gstreamer internally (appsrc+decodebin). I wonder if simply hacking it to instead push into my pipeline would make any difference in terms of snappiness.

Is there an easy way to create a plugin which basically is appsrc + something that pushes data into it? Creating a “proper” plugin seems to be too much work.

There is no issue with doing exactly the same but in your own program.

1 Like