1.下载x264
git clone https://code.videolan.org/videolan/x264.git
2.编译x264
cd x264/
./configure --prefix=/usr/local/x264 --enable-shared --enable-static --disable-asm
排错:提示错误
安装gcc:yum -y install gcc gcc-c++ kernel-devel
3.安装ffmpeg,找到需要的版本
wget http://www.ffmpeg.org/releases/ffmpeg-3.4.13.tar.gz
4.编译
./configure --prefix=/usr/local/ffmpeg --enable-shared --disable-yasm --enable-libx264 --enable-gpl
make && make install
5.添加环境变量
/etc/profile
export PATH=“/usr/local/ffmpeg/bin:$PATH”
source /etc/profile
安装ffmpeg几个常见的错误
1.error while loading shared libraries: libx264.so.164: cannot open shared object file: No such file or directory
解决:在/etc/ld.so.conf加上如下
/usr/local/x264/lib
/usr/local/ffmpeg/lib
ldconfig