本文主要介绍在centos操作系统上,向FFmpeg添加h265库的方法,使FFmpeg可以针对H.265编码的视频进行转码。
1.安装mercurial
wget http://mercurial.selenic.com/release/mercurial-2.6.1.tar.gz
tar -zxvf mercurial-2.6.1.tar.gz
yum -y install python-devel.x86_64
yum -y install python-docutils
cd mercurial-2.6.1
make install
2.安装x265
hg clone https://bitbucket.org/multicoreware/x265
cd x265/build/linux
./make-Makefiles.bash
make && make install
其中cmake版本要高于2.8.8
3.编译ffmpeg
./configure --prefix=/usr/local/ --enable-gpl --enable-version3 --enable-nonfree --enable-shared --enable-zlib --enable-bzlib --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libvo-aacenc --enable-libvorbis --enable-libx264 --enable-libx265 --enable-libxvid --enable-pic --enable-pthreads --enable-pic --enable-openssl --enable-libtwolame
报错x256 not found
查看config.log文件最后一行
到x265编译目录x265/build/linux将x265.pc文件复制到/usr/local/lib
然后修改/etc/profile中的环境变量PKG_CONFIG_PATH
运行pkg-config –list-all 查看x265
运行ffmpeg