最近在CentOS7 下编译了FFMpeg,整理了下过程:
1.依赖库整理:
libffi-3.0.13-11.el7.x86_64.rpm
libffi-devel-3.0.13-11.el7.x86_64.rpm
libdrm-2.4.56-2.el7.x86_64.rpm
libdrm-devel-2.4.56-2.el7.x86_64.rpm
expat-2.1.0-8.el7.x86_64.rpm
expat-devel-2.1.0-8.el7.x86_64.rpm
yasm-1.2.0-4.el7.x86_64.rpm
lynx-2.8.8-0.3.dev15.el7.x86_64.rpm
以下几个需要依赖库比较多,建议通过仓库直接装,或根据yum提示自行准备库:
yum install xmlto
yum install graphviz
yum install cmake
yum install automake libtool
因为我们还要直接调用libva的X11接口,所以
yum install xorg-x11*
2.准备wayland:
yum install libpciaccess-devel
git://anongit.freedesktop.org/wayland/wayland
3. 开始编译:
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
#首先编译wayland
cd wayland
./autogen.sh
make
make install
#这个环境变量目的是把O2去掉,方便调试看结果
export CFLAGS=-g
#编译libva和intel驱动
cd libva-1.6.0
autoreconf
./configure
#我们的LIBVA需要和INTEL DRIVER互相冗余依赖,因此test用例过不了,所以此时还需要把Makefile.am里面的SUBDIRS的test删除
make
make install
cd libva-intel-driver-1.6.0
autoreconf
./configure
make
make install
#编译x264
cd x264-snapshot-20141218-2245
./configure --enable-pic --enable-shared
make
make install
#编译x265
cd x265_1.7
cd build/linux/
./make-Makefiles.bash
make
make install
#最后编译FFMpeg
#./configure --enable-libx264 --enable-libx265 --enable-gpl --enable-shared --enable-libopus --enable-libfdk-aac --disable-static --enable-nonfree --disable-optimizations --disable-stripping
#由于我们的Libva做过改动,存在着驱动和外层依赖,因此需要编译依赖Intel driver
export LD_LIBRARY_PATH="/usr/local/lib:/usr/lib:/lib:/opt/DynamicCodecHard"
./configure --enable-libx264 --enable-libx265 --enable-gpl --enable-shared --disable-optimizations --disable-stripping --extra-ldflags="-L/usr/local/lib -lva -lva-drm -lva-x11 -li965_drv_video"
#不touch的话一个个改太累了
touch /usr/local/include/windows.h
make
make install