Building gst-msdk with MediaSDK opensource
I tried, several months ago, the open source version of Intel MediaSDK and it was a complete mess. In order to review some patches for gst-msdk I tried it again. I am surprised how the situation has improved since then.## Install dependencies
sudo apt get install libva-dev vainfo cmake ccache
sudo apt build-dep gstreamer1.0 gst-plugins-{base,good,bad}1.0
sudo apt remove libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev
Setting up the workplace #
sudo mkdir /opt/intel
sudo chown usuario:usuario /opt/intel
mkdir ~/msdk
cd ~/msdk
Build MediaSDK #
It will be built in its source directory: ~/msdk/MediaSDK/build
It will be installed in /opt/intel
git clone https://github.com/Intel-Media-SDK/MediaSDK.git
cd MediaSDK
mkdir build
cd build
cmake ..
make
make install
Build media-driver #
cd ~/msdk
git clone https://github.com/intel/media-driver.git
git clone https://github.com/intel/gmmlib.git
mkdir build
cd build
cmake ../media-driver
make
Let’s install media-driver in /opt/intel
too
cd ~/msdk/build
cp ./media_driver/iHD_drv_video.so /opt/intel
But don’t remove, rename or move the directory ~/msdk/build
because
iHD_drv_video.so
links against libigdgmm.so.5
which is there. Thus either
you keep the directory or you install that library in a path searchable by the
linker, or set the environment variable LD_LIBRARY_PATH
Test environment #
$ LIBVA_DRIVERS_PATH=/opt/intel LIBVA_DRIVER_NAME=iHD vainfo
libva info: VA-API version 1.3.0
libva info: va_getDriverName() returns -1
libva info: User requested driver 'iHD'
libva info: Trying to open /opt/intel/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_3
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.3 (libva 2.2.0)
vainfo: Driver version: Intel iHD driver - 1.0.0
vainfo: Supported profile and entrypoints
VAProfileNone : VAEntrypointVideoProc
VAProfileNone : VAEntrypointStats
VAProfileMPEG2Simple : VAEntrypointVLD
VAProfileMPEG2Simple : VAEntrypointEncSlice
VAProfileMPEG2Main : VAEntrypointVLD
VAProfileMPEG2Main : VAEntrypointEncSlice
VAProfileH264Main : VAEntrypointVLD
VAProfileH264Main : VAEntrypointEncSlice
VAProfileH264Main : VAEntrypointFEI
VAProfileH264Main : VAEntrypointEncSliceLP
VAProfileH264High : VAEntrypointVLD
VAProfileH264High : VAEntrypointEncSlice
VAProfileH264High : VAEntrypointFEI
VAProfileH264High : VAEntrypointEncSliceLP
VAProfileVC1Simple : VAEntrypointVLD
VAProfileVC1Main : VAEntrypointVLD
VAProfileVC1Advanced : VAEntrypointVLD
VAProfileJPEGBaseline : VAEntrypointVLD
VAProfileJPEGBaseline : VAEntrypointEncPicture
VAProfileH264ConstrainedBaseline: VAEntrypointVLD
VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
VAProfileH264ConstrainedBaseline: VAEntrypointFEI
VAProfileH264ConstrainedBaseline: VAEntrypointEncSliceLP
VAProfileVP8Version0_3 : VAEntrypointVLD
VAProfileHEVCMain : VAEntrypointVLD
VAProfileHEVCMain : VAEntrypointEncSlice
VAProfileHEVCMain : VAEntrypointFEI
Setup gst-build #
It will be build in its source directory: ~/msdk/gst-build/build
cd ~/msdk
git clone https://gitlab.freedesktop.org/gstreamer/gst-build.git
cd gst-build
export INTELMEDIASDKROOT=/opt/intel/mediasdk
meson build -Dpython=disabled -Dgst-plugins-bad:msdk=enabled
ninja -C build
Check for build elements #
$ ninja -C ~/msdk/gst-build/build uninstalled
[gst-master] $ GST_VAAPI_ALL_DRIVERS=1 \
LIBVA_DRIVERS_PATH=/opt/intel \
LIBVA_DRIVER_NAME=iHD \
gst-inspect-1.0 | egrep "vaapi|msdk"
vaapi: vaapijpegdec: VA-API JPEG decoder
vaapi: vaapimpeg2dec: VA-API MPEG2 decoder
vaapi: vaapih264dec: VA-API H264 decoder
vaapi: vaapivc1dec: VA-API VC1 decoder
vaapi: vaapivp8dec: VA-API VP8 decoder
vaapi: vaapih265dec: VA-API H265 decoder
vaapi: vaapipostproc: VA-API video postprocessing
vaapi: vaapidecodebin: VA-API Decode Bin
vaapi: vaapisink: VA-API sink
vaapi: vaapimpeg2enc: VA-API MPEG-2 encoder
vaapi: vaapih265enc: VA-API H265 encoder
vaapi: vaapijpegenc: VA-API JPEG encoder
vaapi: vaapih264enc: VA-API H264 encoder
msdk: msdkvpp: MSDK Video Postprocessor
msdk: msdkvc1dec: Intel MSDK VC1 decoder
msdk: msdkvp8enc: Intel MSDK VP8 encoder
msdk: msdkvp8dec: Intel MSDK VP8 decoder
msdk: msdkmpeg2enc: Intel MSDK MPEG2 encoder
msdk: msdkmpeg2dec: Intel MSDK MPEG2 decoder
msdk: msdkmjpegenc: Intel MSDK MJPEG encoder
msdk: msdkmjpegdec: Intel MSDK MJPEG decoder
msdk: msdkh265enc: Intel MSDK H265 encoder
msdk: msdkh265dec: Intel MSDK H265 decoder
msdk: msdkh264enc: Intel MSDK H264 encoder
msdk: msdkh264dec: Intel MSDK H264 decoder
Remember #
Remember to export these environment variables (perhaps you what to create a script file to set them):
export GST_VAAPI_ALL_DRIVERS=1
export LIBVA_DRIVERS_PATH=/opt/intel
export LIBVA_DRIVER_NAME=iHD