!!!(gcc/g++版本要在4.8以上,本人使用的是5.4版本)
要先安装依赖,按以下步骤依次执行
1.LIBVA
git clone https://github.com/intel/libva.git cd libva/ ./autogen.sh ./configure make make install cp /usr/local/include/va/* /usr/include/ cp /usr/local/lib/libva* /usr/lib64/
2.Intel(R) Graphics Memory Management Library(gmmlib)(可以不用单独安装,安装Media Driver时会附带安装)
Introduction
The Intel(R) Graphics Memory Management Library provides device specific and buffer management for the Intel(R) Graphics Compute Runtime for OpenCL(TM) and the Intel(R) Media Driver for VAAPI.
License
The Intel(R) Graphics Memory Management Library is distributed under the MIT Open Source license.
You may obtain a copy of the License at:
https://opensource.org/licenses/MIT
Building
Get gmmlib repo, make it look like <workspace> |- GmmLib $ mkdir <workspace>/build $ cd <workspace>/build cmake [-DCMAKE_BUILD_TYPE= Release | Debug | ReleaseInternal] [-DARCH= 64 | 32] ../GmmLib $ make -j8 ( Also performs compile time ULT)
Build步骤如下:
mkdir workspace && cd workspace/ git clone https://github.com/intel/gmmlib.git mkdir build && cd build cmake [-DCMAKE_BUILD_TYPE= Release] [-DARCH= 64] ../gmmlib make -j8
执行完make以后会得到如下结果:
[ 89%] Linking CXX static library libgmm_umd.a [ 89%] Built target gmm_umd [ 90%] Linking CXX shared library libigdgmm64.so [ 90%] Built target igfx_gmmumd_dll [ 91%] Linking CXX static library libigfx_gmmumd_excite.a [ 91%] Built target igfx_gmmumd_excite Scanning dependencies of target GMMULT [ 91%] Building CXX object Source/GmmLib/ULT/CMakeFiles/GMMULT.dir/GmmCachePolicyULT.cpp.o [ 92%] Building CXX object Source/GmmLib/ULT/CMakeFiles/GMMULT.dir/GmmCommonULT.cpp.o [ 93%] Building CXX object Source/GmmLib/ULT/CMakeFiles/GMMULT.dir/GmmGen10CachePolicyULT.cpp.o [ 94%] Building CXX object Source/GmmLib/ULT/CMakeFiles/GMMULT.dir/GmmGen9CachePolicyULT.cpp.o [ 94%] Building CXX object Source/GmmLib/ULT/CMakeFiles/GMMULT.dir/GmmGen10ResourceULT.cpp.o [ 95%] Building CXX object Source/GmmLib/ULT/CMakeFiles/GMMULT.dir/GmmGen9ResourceULT.cpp.o [ 96%] Building CXX object Source/GmmLib/ULT/CMakeFiles/GMMULT.dir/GmmResourceCpuBltULT.cpp.o [ 97%] Linking CXX static library libigfxgmmumd.a [ 97%] Built target igfxgmmumd
把生成的动态和静态库拷贝到 /usr/lib64 目录下:
cp Source/GmmLib/libgmm_umd.a /usr/lib64/ && cp Source/GmmLib/libigdgmm64.so /usr/lib64/ && cp Source/GmmLib/libigfx_gmmumd_excite.a /usr/lib64/ && cp Source/GmmLib/libigfxgmmumd.a /usr/lib64/
Install
Not a stand alone software component. GmmLib is build as static library for Intel media driver and Compute runtime for OpenCL Supported Platforms
Intel Atom and Core Processors supporting Gen9/Gen10 graphics devices
BDW (Broadwell)
SKL (Skylake)
CNL (Cannonlake)
3.Intel(R) Media Driver for VAAPI
Introduction
The Intel(R) Media Driver for VAAPI is a new VA-API (Video Acceleration API) user mode driver supporting hardware accelerated decoding, encoding, and video post processing for GEN based graphics hardware.
License
The Intel(R) Media Driver for VAAPI is distributed under the MIT license with portions covered under the BSD 3-clause "New" or "Revised" License. You may obtain a copy of the License at: https://opensource.org/licenses/MIT & https://opensource.org/licenses/BSD-3-Clause
Prerequisites
For Ubuntu 16.04 and above
apt install autoconf libtool libdrm-dev xorg xorg-dev openbox libx11-dev libgl1-mesa-glx libgl1-mesa-dev
Equivalents for other distributions should work.
Dependencies
Libva - https://github.com/intel/libva
GmmLib - https://github.com/intel/gmmlib (please check https://github.com/intel/media-driver/wiki/Comparability-with-GmmLib)
Building
1. Build and install libva master 2. Get gmmlib and media repo and format the workspace folder as below (suggest the workspace to be a dedicated one for media driver build): <workspace> |- gmmlib |- media-driver $ mkdir <workspace>/build_media $ cd <workspace>/build_media $ cmake ../media-driver -DCMAKE_INSTALL_PREFIX=/usr -DMEDIA_VERSION="2.0.0" -DBUILD_ALONG_WITH_CMRTLIB=1 -DBS_DIR_GMMLIB=`pwd`/../gmmlib/Source/GmmLib/ -DBS_DIR_COMMON=`pwd`/../gmmlib/Source/Common/ -DBS_DIR_INC=`pwd`/../gmmlib/Source/inc/ -DBS_DIR_MEDIA=`pwd`/../media-driver Alternatively, copy <workspace>/media-driver/unified_cmake.sh into <workspace>/build_media then run $ ./unified_cmake.sh $ make -j8 Install $ sudo make install This will install the following files (e.g. on Ubuntu): -- Installing: /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so -- Installing: /etc/profile.d/intel-media.sh -- Installing: /usr/lib/x86_64-linux-gnu/igfxcmrt64.so
Build步骤如下:
cd workspace/ git clone https://github.com/intel/media-driver.git mkdir build_media && cd build_media/ cp ../media-driver/unified_cmake.sh ./ ./unified_cmake.sh
make -j8
make install
执行unified_cmake.sh脚本时可能会报如下错误:
CMake Error at /usr/local/share/cmake-3.5/Modules/FindPkgConfig.cmake:363 (message): A required package was not found Call Stack (most recent call first): /usr/local/share/cmake-3.5/Modules/FindPkgConfig.cmake:528 (_pkg_check_modules_internal) cmrtlib/linux/CMakeLists.txt:68 (pkg_check_modules) -- Configuring incomplete, errors occurred! See also "/opt/MediaDriver/build_media/CMakeFiles/CMakeOutput.log".
解决方法:
vim /usr/local/share/cmake-3.5/Modules/FindPkgConfig.cmake
在356行,把set(_pkg_check_modules_failed 1)改为set(_pkg_check_modules_failed 0)
再执行./unified_cmake.sh
执行make install后,无错误的情况如下:
Install the project... -- Install configuration: "" -- Installing: /home/tvu/hevc_shmenc_new/shmenc/3rdparty/libva-1.8.3/lib/lib/dri/iHD_drv_video.so -- Installing: /usr/lib64/igfxcmrt64.so -- Installing: /etc/profile.d/intel-media.sh
命令行输入:echo $LIBVA_DRIVERS_PATH 查看环境变量的值,如下:
/usr/intel/mediasdk/lib64
执行 ls /usr/intel/mediasdk/lib64 可以看到此目录下有如下文件:
iHD_drv_video.so libmfxhw64-p.so.1.19 libmfxhw64.so libmfxsw64-p.so.1.19 libmfxsw64.so iHD_drv_video.so libdispatch_shared.a libmfx.a libmfxhw64-p.so.1.19 libmfxhw64-p.so.1.26 libmfxhw64.so libmfxsw64-p.so.1.19 libmfxsw64.so pkgconfig
执行如下命令替换掉 /usr/intel/mediasdk/lib64/iHD_drv_video.so(此步骤也可以在装完MediaSDK后执行):
cp /home/tvu/hevc_shmenc_new/shmenc/3rdparty/libva-1.8.3/lib/lib/dri/iHD_drv_video.so /usr/intel/mediasdk/lib64/
然后执行vainfo的到如下结果:
error: can't connect to X server! libva info: VA-API version 1.1.0 libva info: va_getDriverName() returns 0 libva info: User requested driver 'iHD' libva info: Trying to open /usr/intel/mediasdk/lib64/iHD_drv_video.so libva info: Found init function __vaDriverInit_1_1 libva info: va_openDriver() returns 0 vainfo: VA-API version: 1.1 (libva 1.67.0.pre1) vainfo: Driver version: Intel iHD driver - 2.0.0 vainfo: Supported profile and entrypoints VAProfileNone : VAEntrypointVideoProc VAProfileNone : <unknown entrypoint> VAProfileMPEG2Simple : VAEntrypointVLD VAProfileMPEG2Main : VAEntrypointVLD VAProfileH264Main : VAEntrypointVLD VAProfileH264Main : VAEntrypointEncSlice VAProfileH264Main : <unknown entrypoint> VAProfileH264Main : <unknown entrypoint> VAProfileH264High : VAEntrypointVLD VAProfileH264High : VAEntrypointEncSlice VAProfileH264High : <unknown entrypoint> VAProfileH264High : <unknown entrypoint> VAProfileVC1Simple : VAEntrypointVLD VAProfileVC1Main : VAEntrypointVLD VAProfileVC1Advanced : VAEntrypointVLD VAProfileJPEGBaseline : VAEntrypointVLD VAProfileJPEGBaseline : VAEntrypointEncPicture VAProfileH264ConstrainedBaseline: VAEntrypointVLD VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice VAProfileH264ConstrainedBaseline: <unknown entrypoint> VAProfileH264ConstrainedBaseline: <unknown entrypoint> VAProfileVP8Version0_3 : VAEntrypointVLD VAProfileHEVCMain : VAEntrypointVLD VAProfileHEVCMain : VAEntrypointEncSlice VAProfileHEVCMain : <unknown entrypoint> VAProfileHEVCMain10 : VAEntrypointVLD VAProfileVP9Profile0 : VAEntrypointVLD
*注意:没替换掉 /usr/intel/mediasdk/lib64/iHD_drv_video.so的情况下,命令行执行vainfo可能会出现以下情况:
error: can't connect to X server! libva info: VA-API version 1.1.0 libva info: va_getDriverName() returns 0 libva info: User requested driver 'iHD' libva info: Trying to open /usr/intel/mediasdk/lib64/iHD_drv_video.so libva error: /usr/intel/mediasdk/lib64/iHD_drv_video.so has no function __vaDriverInit_1_0 libva info: va_openDriver() returns -1 vaInitialize failed with error code -1 (unknown libva error),exit
4.Intel® Media SDK
Intel® Media SDK provides an API to access hardware-accelerated video decode, encode and filtering on Intel® platforms with integrated graphics.
Supported video encoders: HEVC, AVC, MPEG-2, JPEG Supported Video decoders: HEVC, AVC, VP8, MPEG-2, VC1, JPEG Supported video pre-processing filters: Color Conversion, Deinterlace, Denoise, Resize, Rotate, Composition Important note
The current version of Intel Media SDK is compatible with the open source Intel Media Driver for VAAPI. Intel Media SDK depends on LibVA. FAQ
You can find answers for the most frequently asked questions here. Table of contents
- License
- How to contribute
- Documentation
- Products which use Media SDK
- System requirements
- How to build
- Requirements
- Build steps
License
Intel Media SDK is licensed under MIT license. See LICENSE for details.
How to contribute
See CONTRIBUTING for details. Thank you!
Documentation
Please find full documentation under the doc/ folder. Key documents:
- Media SDK Developer Reference
- Media SDK Developer Reference Extensions for User-Defined Functions
- Media Samples Guide
You may also wish to visit Intel Media Server Studio support page for additional documentation.
products which use Media SDK
- Intel Media Server Studio
- Intel Media SDK for Embedded Linux
System requirements
Operating System: Linux
Software:
- LibVA
- VAAPI backend driver:
Intel Media Driver for VAAPI - Some features require CM Runtime library (part of Intel Media Driver for VAAPI package)
Hardware: Intel platforms supported by the Intel Media Driver for VAAPI
Media SDK test and sample applications may require additional software packages (for example, X Server, Wayland, LibDRM, etc.) to be functional.
How to build
Requirements
- Git* (with LFS support)
- Perl* v5.16+
- Cmake* v2.8+
- GCC* v4.8+
- LibVA
Build steps
Get sources
git clone https://github.com/Intel-Media-SDK/MediaSDK msdk cd msdk
Configure build with GCC (default) compiler:
perl tools/builder/build_mfx.pl --cmake=intel64.make.release
这时会报如下错误:
CMake Error at builder/FindTrace.cmake:27 (include): include could not find load file /usr/intel/mediasdk/builder/FindVTune.cmake Call Stack (most recent call first): CMakeLists.txt:56 (include)
mkdir /usr/intel/mediasdk/builder/ cp builder/* /usr/intel/mediasdk/builder/
This will build MSDK binaries and MSDK samples.
If you want to configure build with CLang compiler use the following command:
perl tools/builder/build_mfx.pl --cmake=intel64.make.release.clang
Run build:
make -j8 -C __cmake/intel64.make.release