Skip to content

Hardware acceleration

Rafał Dzięgiel edited this page Jun 28, 2022 · 15 revisions

Clapper uses hardware acceleration by default, when available both CPU and RAM usage should be much lower.

NOTE: Because of this mesa issue: https://gitlab.freedesktop.org/mesa/mesa/-/issues/149, GTK4 does not use EGL on Xorg session. Without EGL we cannot use DMABufs for zero-copy (good performance). Due to that, using Wayland session is recommended.

AMD/Intel

GStreamer now has two different plugins that provide hardware acceleration vaapi (provided by gstreamer-vaapi) and newer va (part of gst-plugins-bad). Starting with GStreamer 1.19.1, Clapper gradually enables and uses new va decoders by default. Otherwise older vaapi plugins are used. You can control which one to use in Clapper preferences "Plugin ranking" by changing their default rank to be higher then alternative (e.g. apply rank 300 to vah264dec and so on).

NVIDIA

Hardware acceleration on Nvidia GPUs is supported through NVDEC. This requires Nvidia proprietary GPU drivers. Since Clapper 0.4.0 version, NVDEC is automatically used when available.

If you want to use stateless decoders such as nvh264sldec and nvh265sldec with fewer features but improved latency. You can enable them inside Clapper preferences "Plugin ranking" feature. Apply higher value to them then any other decoder (e.g. apply rank 300 to nvh264sldec and so on).

Mobile devices (V4L2 codecs)

V4L2 stateless decoders are available since GStreamer 1.20 and are used by default on mobile/embedded devices (mainly on Allwinner, Rockchip and i.MX). Mobile devices usually use GLES instead of normal OpenGL. Since version 0.5.0 Clapper will try to automatically select best GL context type for your hardware (GL or GLES). Otherwise if necessary, you can manually force app to use GLES by exporting GST_GL_API=gles2 environment variable.

Due to a bug in GStreamer playbin2 element, GstVideoMeta is not passed through pipeline which causes the v4l2 decoders to copy frames and reduce performance*. In order to workaround this bug you can use newer playbin3 element by either enabling it in Clapper preferences or exporting GST_CLAPPER_USE_PLAYBIN3=1 environment variable.

* Flatpak version from Flathub has a workaround applied, so until fixed in GStreamer, this version should also work with playbin2 (default).

Clone this wiki locally