编译libx264
cd x264
//指定路径
./configure --prefix=/usr/local/x264 --enable-shared --enable-static --disable-asm
//我是不指定路径,不然后面编译FFmpeg需要配置路径
./configure --enable–shared --enable–static --disable-asm
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
出现的问题
libx264 not found【编译x264不指定目录应该不会出现这个问题】
–extra-cflags=-I 和 –extra-ldflags 手动指定头文件和库路径
将使用到的库路径添加至环境变量中
vim /etc/profile //文件末尾加入下面内容
export PATH