Version 56 (modified by 16 months ago) (diff) | ,
---|
We have moved
This wiki has been moved to https://github.com/Xpra-org/xpra/blob/master/docs/README.md and https://github.com/Xpra-org/xpra/wiki
Archived copy:
Colourspace conversion step - CSC
Before passing the pixels to the video encoder, we may or may not include a colourspace conversion step. (ie: newer versions of x264 support BGRA
pixels as input directly).
This conversion step is often used for chroma subsampling which reduces the size of the data to compress.
Information and Diagnostics
The pixel format used as input as well as the CSC module chosen to do this conversion work can be found via "xpra info
".
It will be chosen automatically based on the desired speed/quality settings.
Note that the CSC step may degrade the quality of the picture (YUV444P
mode does not, but YUV422P
and YUV420P
do).
CSC Modules
On the server side we support multiple modules for doing this step:
- csc_libyuv which uses libyuv's optimized CPU code (the fastest option)
- csc_swscale which uses FFmpeg's swscale library (CPU based)
- csc_cython: a much slower fallback module written in Cython (deprecated)
On the client side, the OpenGL rendering mode does not need a CSC step as it can display YUV pixels directly on screen, and does the scaling itself too.
Choosing a CSC module
The best way to choose a CSC module is to test them all and compare them.
Some rough guidelines:
- if you can use NVENC, then do so: the CSC step is built-in and will use the GPU hardware
- otherwise, use
libyuv
orswscale
Specify a module or mode
You can choose which CSC modules are loaded using the --csc-modules=
command line option. ie:
xpra --csc-modules=libyuv,swscale
One can also force the use a specific CSC mode:
XPRA_FORCE_CSC_MODE=cscmode xpra ...
Where cscmode
is one of: YUV420P
, YUV422P
, YUV444P
.
Scaling
As part of the colourspace conversion step, we can also downscale the frame if the XPRA_SCALING
environment variable is unset or set to "1", and either:
- the application requests scaling using the
_XPRA_SCALING
X11 window property (specified as a 32-bit fraction, 16-bits for each) - the
XPRA_SCALING_HARDCODED
environment variable is set on the server, using one of those 2 forms (the second one is preferred):XPRA_SCALING_HARDCODED=N
to downscale by NXPRA_SCALING_HARDCODED=M:N
to downscale by the fractionM/N
- automatically, using some heuristics (the bigger the picture size and the lower the quality + the higher the speed - the more likely it is that it will be enabled)
- manually using
xpra control
at runtime (see ticket:461#comment:9):xpra control DISPLAY scaling "*" 2:3
will scale all windows ("*") by 2/3rd onDISPLAY
(replace with your actual display number or URI)
Note: when downscaling is enabled, this may introduce a colourspace conversion step where none was necessary before (when the encoder was previously handling RGB pixel data directly).
Only some encoders can handle the scaling natively (and therefore at almost no cost), nvenc does.