参照https://github.com/Intel-FFmpeg-Plugin/Intel_FFmpeg_plugins/wiki, 在linux下编译intel版本的ffmpeg时,
[root@localhost project]# git clone https://github.com/Intel-FFmpeg-Plugin/Intel_FFmpeg_plugins.git
Cloning into 'Intel_FFmpeg_plugins'...
remote: Counting objects: 527303, done.
remote: Total 527303 (delta 0), reused 0 (delta 0), pack-reused 527303
Receiving objects: 100% (527303/527303), 193.22 MiB | 214.00 KiB/s, done.
Resolving deltas: 100% (410506/410506), done.
[root@localhost project]# cd Intel_FFmpeg_plugins/
[root@localhost Intel_FFmpeg_plugins]# git checkout origin/qsv-3.2.2 -b 3.2.2
Branch 3.2.2 set up to track remote branch qsv-3.2.2 from origin.
Switched to a new branch '3.2.2'
FFMPEG 中使用 libmfx 实现 intel qsv 的硬件编码器,如果想要编译它的硬件编码器,所以如果想要编译这个硬件编码器,你需要在加入如下的配置选项:
./configure --enable-libmfx
执行configure时遇到了以下问题:
[root@localhost Intel_FFmpeg_plugins]# ./configure --enable-libmfx
ERROR: libmfx not found using pkg-config
If you think configure made a mistake, make sure you are using the latest
version from Git. If the latest version fails, report the problem to the
ffmpeg-user@ffmpeg.org mailing list or IRC #ffmpeg on irc.freenode.net.
Include the log file "config.log" produced by configure as this will help
solve the problem.
如何解决呢?
(1) /opt/intel/mediasdk/include中新建文件夹mfx,并把所有.h拷贝到该文件夹中。
(2) mkdir -p /opt/intel/mediasdk/lib64/pkgconfig
(3) 建立libmfx.pc文件,内容如下:
prefix=/opt/intel/mediasdk
exec_prefix=/opt/intel/mediasdk/
libdir=${prefix}/lib/lin_x64/
includedir=${prefix}/include/
Name: libmfx
Description: mfx
Version: 1.0.0
Cflags: -I${includedir}
Libs: -L${libdir} -lmfx -ldl -lstdc++ -lrt -lva -lva-drm
Libs.private: -lstdc++ -ldl
并将其拷贝到以下目录:
cp libmfx.pc /opt/intel/mediasdk/lib64/pkgconfig
cp libmfx.pc /usr/lib64/pkgconfig
(4) 添加环境变量。
在.bashrc中添加
export MFX_HOME=/opt/intel/mediasdk/
export PKG_CONFIG_PATH=/usr/lib64/pkgconfig/
然后再去执行configure即可。
然后make,接着make install。
可用以下语句验证是否成功。
[root@localhost Intel_FFmpeg_plugins]# ffmpeg -codecs | grep qsv
ffmpeg version n3.2.2-59-g94c76be Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-11)
configuration: --enable-libmfx
libavutil 55. 34.100 / 55. 34.100
libavcodec 57. 64.101 / 57. 64.101
libavformat 57. 56.100 / 57. 56.100
libavdevice 57. 1.100 / 57. 1.100
libavfilter 6. 65.100 / 6. 65.100
libswscale 4. 2.100 / 4. 2.100
libswresample 2. 3.100 / 2. 3.100
DEV.LS h264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (decoders: h264 h264_qsv ) (encoders: h264_nvenc h264_qsv h264_vaapi nvenc nvenc_h264 )
DEV.L. hevc H.265 / HEVC (High Efficiency Video Coding) (decoders: hevc hevc_qsv ) (encoders: nvenc_hevc hevc_nvenc hevc_qsv hevc_vaapi )
DEVIL. mjpeg Motion JPEG (decoders: mjpeg mjpeg_qsv ) (encoders: mjpeg mjpeg_qsv mjpeg_vaapi )
DEV.L. mpeg2video MPEG-2 video (decoders: mpeg2video mpegvideo mpeg2_qsv ) (encoders: mpeg2video mpeg2_qsv )
D.V.L. vc1 SMPTE VC-1 (decoders: vc1 vc1_qsv )
References:
https://github.com/Intel-FFmpeg-Plugin/Intel_FFmpeg_plugins/wiki
https://blog.csdn.net/LeoChen1983/article/details/72742656