gstreamer-vaapi-patches¶
There are three LGPL-licensed patches for gstreamer-vaapi plugins:
Peek
VADisplay
andVaSurface
The patch is based on gstreamer-vaapi merge request #435. It allows other MIT-licences plugins to obtainVADisplay
fromGstContext
created by VAAPI elements. It also allows to getVASurfaceID
fromGstBuffer
created by VAAPI elements. This patch is required to enable VAAPI preprocessor of inference elements.video-format-mapping.patch Patch to improve the mapping between VA and GST formats. The new map will be generated dynamically, based on the query result of ab image format in VA driver. Also consider the ambiguity of RGB color format in LSB mode.
dma-vaapiencode.patch Patch enables DMA memory input in VAAPI elements thus expanding its capabilities.
How to use these patches¶
To build gstreamer-vaapi with these patches you have to proceed following steps:
Install meson and ninja. We need them to configure and build gstreamer-vaapi project
pip3 install meson ninja
Create working directory:
mkdir -p $HOME/mygst-vaapi
Move into working directory
cd $HOME/mygst-vaapi
Download patches (usually, you can take last version of file from
master
-branch of DL Streamer’s repository)
wget https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/435.patch -O gst-vaapi-peek-vadisplay.patch
wget https://raw.githubusercontent.com/openvinotoolkit/dlstreamer_gst/master/patches/gstreamer-vaapi/dma-vaapiencode.patch
wget https://raw.githubusercontent.com/openvinotoolkit/dlstreamer_gst/master/patches/gstreamer-vaapi/video-format-mapping.patch
Download appropriate version of gstreamer-vaapi’s sources (e.g. 1.18.4)
wget https://gstreamer.freedesktop.org/src/gstreamer-vaapi/gstreamer-vaapi-1.18.4.tar.xz
Unpack downloaded archive
tar xf gstreamer-vaapi-1.18.4.tar.xz
Move into unpacked directory
cd gstreamer-vaapi-1.18.4
Apply patches
patch -p1 < ../gst-vaapi-peek-vadisplay.patch
patch -p1 < ../video-format-mapping.patch
patch -p1 < ../dma-vaapiencode.patch
Configure for building gstreamer-vaapi with applied patches (disable examples, docs and test because we don’t need them)
meson \
-Dexamples=disabled \
-Dtests=disabled \
-Dgtk_doc=disabled \
build/
Note
If you are experiencing troubles configuring gstreamer-vaapi consider rebooting machine if you haven’t done it after installing OpenVINO™ Toolkit. Otherwise:
sudo apt install libudev-dev
If the libva dependency cannot be found:
export PKG_CONFIG_PATH=/opt/intel/mediasdk/lib64/pkgconfig:$PKG_CONFIG_PATH
If you are facing the error
Neither a subproject directory nor a gst-plugins-bad.wrap file was found
install the gstreamer-plugins-bad developer package:sudo apt install libgstreamer-plugins-bad1.0-dev
Reconfigure gstreamer-vaapi after the steps above.
Build configured gstreamer-vaapi project
ninja -C build/
Install into desired directory (let’s use
$HOME/mygst-vaapi/install
for example):
mkdir -p $HOME/mygst-vaapi/install
DESTDIR=$HOME/mygst-vaapi/install meson install -C build/
As output of previous command you should see path to installed libgstvaapi.so library. depending on your system this path may be different, as example we use path that most likely you will see in Ubuntu. To start using this library you have to add directory containing that libgstvaapi.so to your
GST_PLUGIN_PATH
as leading path :
export GST_PLUGIN_PATH=$HOME/mygst-vaapi/install/usr/local/lib/x86_64-linux-gnu/gstreamer-1.0/:$GST_PLUGIN_PATH
Available VA-API plugins can be shown by:
gst-inspect-1.0 vaapi
Note
If the library is found but the command above shows 0 features
refer to the note section in step 9. Then repeat steps 9, 10, 11 to reconfigure your gstreamer-vaapi.
VAAPI preprocessing backend¶
To enable VAAPI preprocessing backend you have to pass to cmake that configures gst-video-analytics
following parameter -DENABLE_VAAPI=ON