linux下ffmpeg安装时ERROR: libx264 not found 错误解决

    技术2023-11-19  114

    一、下图是产生错误的,命令:

    [root@CentOS7 ffmpeg]# ./configure --prefix=/usr/ffmpeg --enable-shared --enable-yasm --enable-libx264 --enable-gpl --extra-cflags=-l/usr/x264/include --extra-ldflags=-L/usr/x264/lib

    报出的错误:

    ERROR: libx264 not found If you think configure made a mistake, make sure you are using the latest version from Git. If the latest version fails, report the problem to the ffmpeg-user@ffmpeg.org mailing list or IRC #ffmpeg on irc.freenode.net. Include the log file "ffbuild/config.log" produced by configure as this will help solve the problem.

    根据提示去查看错误的日志,日志存放的地址如上已经指出ffbuild/config.log。 二、查看具体的错误信息: 如图:

    check_pkg_config libx264 x264 stdint.h x264.h x264_encoder_encode test_pkg_config libx264 x264 stdint.h x264.h x264_encoder_encode pkg-config --exists --print-errors x264 Package x264 was not found in the pkg-config search path. Perhaps you should add the directory containing `x264.pc' to the PKG_CONFIG_PATH environment variable No package 'x264' found

    以上告诉你没有找到pkg-config这个文件夹,所以也就不存在x264.pc这个命令。 接下来我们看一下为什么找不到这个文件夹,明明参数–extra-ldflags=-L/usr/x264/lib都指定了,到x264下看看; 发现安装x264的pkgconfig不叫pkg-config,由于不知道什么原因也不敢乱改怕有不可知的影响,仔细读报错发现一个变量名PKG_CONFIG_PATH,这就好办了,编辑/etc/profile这个文件添加这个变量:

    export PKG_CONFIG_PATH=$X264_HOME/lib/pkgconfig

    然后保存,执行

    source /etc/profile

    再次切换到ffmpeg下执行./configure…那些命令,发现好了!

    Processed: 0.010, SQL: 9