xpra icon
Bug tracker and wiki

Version 41 (modified by Antoine Martin, 6 years ago) (diff)

--

[[Image(...)]] Picture Encodings

This page is strongly related to WindowRefresh, the Network and client rendering are also relevant.
For video encodings (vpx and h264), colorspace conversion is also required reading.


Introduction

Xpra supports a number of picture encodings, provided you have the required libraries installed. Even then, the features of each encoding may vary based on the version of the libraries and other dependencies, both client and server side.
Here is the list as of v0.13

  • lossless encodings:
    • rgb: rgb24 for regular windows, rgb32 for transparency support (compressed with zlib or lz4, just like packet compression)
    • png (24/32-bit colour), png/L (8-bit grayscale) and png/P (8-bit colour palette)
    • webp (lossless mode)
  • lossy encodings:
    • jpeg
    • webp (lossy mode)
    • vpx (VP8 and VP9)
    • h264: either using x264 or nvenc
    • h265 using x265 (not usable, far too slow)

Note: for backwards compatibility, on versions older than 0.10.10 you have to specify the encoding as x264 to get h264. Newer versions use h264, but x264 will remain for command-line compatibility.

Choosing an Encoding

The best thing to do is to try them all and choose the one that provides the best results. Here are some rough guidelines:

  • on LANs with 100MBit/s or higher: rgb + zlib/lz4 should give you the best latency possible (whilst consuming quite a lot of bandwidth in the process..)
  • if you have the required hardware, use NVENC
  • to save a little bit of bandwidth at the expense of framerate and latency, use lossless encodings: png or webp
  • otherwise, choose h264} and tune the speed/quality to suit your needs (see below)

The other encodings are somewhat less useful:

  • vpx : VP8 is similar to h264 but it does not support all speed and quality tuning, it also subsamples colours which leads to visual degradation. VP9 is so slow it is unusable.
  • jpeg gives lower size/quality than other lossy encodings, use this if the video encodings are not available and you need better compression than png or webp can give you
  • webp (lossy mode) is a single image subset of vpx, and therefore lacks intra-frame compression - but latency is decent

Colourspace conversion step - CSC

Before passing the pixels to the video encoder, we may or may not include a colourspace conversion step, (some newer versions of x264 support BGRA pixels as input directly) it is required when downscaling the video.

See: Colourspace conversion step - CSC

Tuning

The best way to choose the right options is through wiki/Testing. Though you may find some good illustrations online to give you an idea of the trade offs. (ie: fps vs noise, fps vs size) Be aware that the lossless auto-refresh will trigger a lossless frame encoded using png or rgb. If the delay is too low, it may negate the benefits of using efficient compression.

Notes

When comparing performance, make sure that you use the right metrics... The number of updates per second is not always a good one (if there are more small regions, this can be a good or a bad thing), more examples here: Misleading Statistics

Future Encoding Support

We should eventually add support for: