环境:
Ubuntu 22.04.2 LTS (GNU/Linux 4.4.0-19041-Microsoft x86_64)
编译步骤(基本上都是默认配置):
1 ,编译nasm-2.16.01
./configure
make
make install
2,编译nasm-2.16.01
同上。
3,编译x264库
下载:https://www.videolan.org/developers/x264.html
./configure --prefix=/usr/local/x264 --enable-shared --enable-static
make
make install
4,编译ffmpeg-5.1.2.tar
./configure --prefix=/usr/local/ffmpeg --enable-gpl --enable-libx264 --extra-cflags=-I/usr/local/x264/include --extra-ldflags=-L/usr/local/x264/lib
make
make install
错误:
ERROR: x264 not found using pkg-config
解决:
vim /etc/profile
末尾加入内容export PKG_CONFIG_PATH=/usr/local/x264/lib/pkgconfig,具体看各位自己x264的安装路径
source /etc/profile
然后再./configure ...就没问题了
或者:
在命令行执行命令:export PKG_CONFIG_PATH=/usr/local/x264/lib/pkgconfig
错误2:
如果运行的时候提示 error while loading shared libraries: libx264.so
cd /etc/ld.so.conf.d
sudo touch ffmpeg-x86_64.conf //创建一个空文件
用vim打开这个空文件,第一行键入 /usr/local/x264/lib 保存文件退出。
sudo ldconfig
2023/5