很多博客感觉在乱抄,x264不指定路径然后ffmpeg有配置了x264路径根本就装不上。
这边两种方式都给出了。
编译 nasm
下载地址 https://www.nasm.us/pub/nasm/releasebuilds/2.15/
./confgure
make
make install
编译libx264
cd x264
//指定路径
./configure --prefix=/usr/local/x264 --enable-shared --enable-static --disable-asm
//不指定路径,不然后面编译FFmpeg需要配置路径
./configure --enable-shared --enable-static
make
sudo make install
编译FFmpeg
cd ffmpeg
//有指定路径
./configure --prefix=/usr/local/ffmpeg --enable-shared --enable-libx264 --enable-gpl --enable-pthreads --extra-cflags=-I/usr/local/x264/include --extra-ldflags=-L/usr/local/x264/lib //不建议使用 --extra-cflags --extra-ldflags 可以使用环境变量 以及 pkg-config来自动加载
//不指定路径
./configure --enable-shared --enable-libx264 --enable-gpl --enable-pthreads
make
make install
运行ffmpeg后若出现os找不到
方法一
运行ffmpeg后若出现os找不到,用 find /usr -name "os文件名" 寻找路径然后拷贝到/usr/lib64就行了。
方法二
vim /etc/profile //文件末尾加入下面内容
export PATH=/usr/local/x264/bin:$PATH
export PATH=/usr/local/x264/include:$PATH
export PATH=/usr/local/x264/lib:$PATH