FFmpeg:intel核显vaapi驱动安装记录

FFmpeg:intel核显vaapi驱动安装


主要需要安装media-driver和它的依赖。
开源,在github上

media-driver

https://github.com/intel/media-driver 上下下来后,切下版本分支, 然后cmake直接编。

– The C compiler identification is GNU 8.3.0
– The CXX compiler identification is GNU 8.3.0
– Check for working C compiler: /usr/bin/cc
– Check for working C compiler: /usr/bin/cc – works
– Detecting C compiler ABI info
– Detecting C compiler ABI info - done
– Detecting C compile features
– Detecting C compile features - done
– Check for working CXX compiler: /usr/bin/c++
– Check for working CXX compiler: /usr/bin/c++ – works
– Detecting CXX compiler ABI info
– Detecting CXX compiler ABI info - done
– Detecting CXX compile features
– Detecting CXX compile features - done
– CMAKE_INSTALL_PREFIX = /usr/local
– Found PkgConfig: /usr/bin/pkg-config (found version “0.29.1”)
– Checking for module ‘libva>=1.0.0’
-- No package 'libva' found
CMake Error at /usr/share/cmake-3.13/Modules/FindPkgConfig.cmake:452 (message):
A required package was not found
Call Stack (most recent call first):
/usr/share/cmake-3.13/Modules/FindPkgConfig.cmake:622 (_pkg_check_modules_internal)
cmrtlib/linux/CMakeLists.txt:56 (pkg_check_modules)

– Configuring incomplete, errors occurred!

libva

checking for DRM… no
configure: error: Package requirements(libdrm >= 2.4)were not met:

No package ‘libdrm’ found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables DRM_CFLAGS
and DRM_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

libdrm

autoreconf: Entering directory .
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force -I m4 ${ACLOCAL_FLAGS}
configure.ac:34: error: must install xorg-macros 1.12 or later before running autoconf/autogen
configure.ac:34: the top level
autom4te: /usr/bin/m4 failed with exit status: 1
aclocal: error: echo failed with exit status: 1
autoreconf: aclocal failed with exit status: 1

sudo apt-get install xutils-dev

checking which warning flags were supported… -Wall -Wextra -Werror=undef -Wsign-compare -Werror-implicit-function-declaration -Wpointer-arith -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Wpacked -Wswitch-enum -Wmissing-format-attribute -Wstrict-aliasing=2 -Winit-self -Wdeclaration-after-statement -Wold-style-definition -Wno-unused-parameter -Wno-attributes -Wno-long-long -Winline -Wshadow -Wno-missing-field-initializers
checking for native atomic primitives… Intel
checking for PCIACCESS… no
configure: error: Package requirements (pciaccess >= 0.10) were not met:

No package 'pciaccess' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables PCIACCESS_CFLAGS
and PCIACCESS_LIBS to avoid the need to call pkg-config.

sudo apt-get install libpciaccess-dev

这两个库装好后,回来安装media-drive

CMake Error at media_driver/media_top_cmake.cmake:114 (add_subdirectory):
add_subdirectory given source
“/home/sola/server_source/vaapi-driv/media-driver/…/gmmlib/Source/GmmLib”
which is not an existing directory.
Call Stack (most recent call first):
media_driver/CMakeLists.txt:95 (include)

CMake Error at media_driver/media_top_cmake.cmake:117 (message):
gmm library not found on the system
Call Stack (most recent call first):
media_driver/CMakeLists.txt:95 (include)

– Configuring incomplete, errors occurred!

git clone https://github.com/intel/gmmlib.git

clone 一份下来 编译安装

注意 sudo apt-get install libigdgmm-dev这样安装的话,最后编译media-drive的时候会出问题。

装完gmm就能编过了,一切完工。

vaninfo&libva 配置

可以使用vaninfo 查看libva 信息,

然后你可能会遇到这种错误:

libva info: Trying to open /usr/lib/dri/i965_drv_video.so
libva info: va_openDriver() returns -1
vaInitialize failed with error code -1 (unknown libva error),exit

你会发现没有 这个 /usr/lib/dri/i965_drv_video.so 库文件, 我尝试做了个软连接 然后就能正常工作了
在这里插入图片描述

vainfo
sola@:~/vaapi-driv/media-driver$ vainfo
libva info: VA-API version 1.6.0
libva info: va_getDriverName() returns -1
libva info: User requested driver 'i965'
libva info: Trying to open /usr/local/lib/dri/i965_drv_video.so
libva info: va_openDriver() returns -1
vaInitialize failed with error code -1 (unknown libva error),exit
sola@:~/vaapi-driv/media-driver$ 
sola@:~/vaapi-driv/media-driver$ cd /usr/local/lib/dri/
sola@:/usr/local/lib/dri$ ls
iHD_drv_video.so
sola@:/usr/local/lib/dri$ sudo ln -s iHD_drv_video.so i965_drv_video.so
sola@:/usr/local/lib/dri$ cd -
/home/sola/vaapi-driv/media-driver
sola@:~/vaapi-driv/media-driver$ vainfo
libva info: VA-API version 1.6.0
libva info: va_getDriverName() returns -1
libva info: User requested driver 'i965'
libva info: Trying to open /usr/local/lib/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_1_6
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.6 (libva 2.4.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
      VAProfileVP8Version0_3          :	VAEntrypointEncSlice
      VAProfileHEVCMain               :	VAEntrypointVLD
      VAProfileHEVCMain               :	VAEntrypointEncSlice
      VAProfileHEVCMain               :	VAEntrypointFEI
      VAProfileHEVCMain10             :	VAEntrypointVLD
      VAProfileHEVCMain10             :	VAEntrypointEncSlice
      VAProfileVP9Profile0            :	VAEntrypointVLD
      VAProfileVP9Profile2            :	VAEntrypointVLD

但这不是正道呀,google了下发现了下面信息。
链接 : https://wiki.archlinux.org/index.php/Hardware_video_acceleration
[外链图片转存失败(img-wxNWGFAU-1563878316947)(./1563853799447.png)]

原来我们只需要配置下这个环境变量即可
export LIBVA_DRIVER_NAME=iHD

[外链图片转存失败(img-G5IeYAUY-1563878316947)(./1563854095686.png)]

ffmpeg

最后尝试ffmpeg进行vaapi硬解。

打开 vaapi : ./configure --enable-hwaccel=h264_vaapi --enable-gpl --disable-x86asm --enable-shared

test : ffmpeg -v trace -vaapi_device /dev/dri/card0 -i 720p.mp4 -vf 'format=nv12,hwupload' -c:v h264_vaapi output.mp4

gpu-top

[外链图片转存失败(img-GDi6LbXH-1563878316950)(./1563767300504.png)]

[外链图片转存失败(img-7kVVZuFw-1563878316951)(./1563767359744.png)]

  • 1
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
您好!如果您在使用ffmpeg时遇到了“ffmpeg: not found”的错误,这可能是因为ffmpeg安装或未在系统的环境变量中被找到。请按照以下步骤进行操作: 1. 确认是否已安装ffmpeg:在终端或命令提示符中输入以下命令并按下回车: ``` ffmpeg -version ``` 如果ffmpeg已正确安装,将显示ffmpeg的版本信息。如果未安装,则需要安装ffmpeg。 2. 安装ffmpeg:根据您的操作系统和环境,可以选择不同的方式来安装ffmpeg。以下是一些常见操作系统上的安装方法: - 在Ubuntu上,可以使用以下命令安装ffmpeg: ``` sudo apt-get install ffmpeg ``` - 在CentOS上,可以使用以下命令安装ffmpeg: ``` sudo yum install ffmpeg ``` - 在macOS上,可以使用Homebrew来安装ffmpeg。如果尚未安装Homebrew,请先安装Homebrew,然后运行以下命令来安装ffmpeg: ``` brew install ffmpeg ``` - 在Windows上,可以从ffmpeg官方网站(https://www.ffmpeg.org/download.html)下载预编译的可执行文件,并将其添加到系统的环境变量中。 3. 添加ffmpeg到环境变量:如果已经安装ffmpeg但仍然遇到问题,请确保ffmpeg所在的目录已添加到系统的环境变量中。详细步骤取决于您的操作系统,请参考相应的文档或搜索如何将目录添加到环境变量。 完成以上步骤后,重新启动终端或命令提示符,并尝试再次运行ffmpeg命令。如果仍然遇到问题,请提供更多详细信息以便我们进一步帮助您。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值