ffmpeg踩坑之手动编译报错Unrecognized option ‘preset‘及rtsp/rtmp推流

本文解决的问题记录:

报错1:Unrecognized option 'preset'.
Error splitting the argument list: Option not found

报错2:ERROR: x264 not found using pkg-config

报错3:ffmpeg: error while loading shared libraries: libavdevice.so.60: cannot open shared object file: No such file or directory

报错信息:

Unrecognized option 'preset'.
Error splitting the argument list: Option not found

一开始以为是版本不对,于是从3.1升级到了6.1结果还是不行,然后我在想是不是前面3.1版本的没有删除干净 ,执行时使用了旧版本的依赖,于是重新删除干净再次安装6.1,结果还是不行。

然后百度了一通,有大佬指出了问题,出现这个问题大概率是手动编译导致的,果不其然!是我执行configure的时候没有加--enable-libx264这个参数,首先使用whereis或者which命令找到自己的ffmpeg安装目录,将ffmpeg可执行文件删掉,然后回到ffmpeg目录执行

./configure --enable-shared --enable-libx264 --enable-gpl --prefix=/usr/local/ffmpeg

/usr/bin.ffmpeg可以换成自己的安装目录

 于是马上执行>>>

root@gateway-desktop:~/ffmpeg-6.1# ./configure --enable-shared --enable-libx264 --enable-gpl --prefix=/usr/bin/ffmpeg
ERROR: x264 not found using pkg-config

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.libera.chat.
Include the log file "ffbuild/config.log" produced by configure as this will help
solve the problem.

好家伙报错了

一开始我以为是我没有安装x264导致的问题,于是便安装了libx264

libx264下载地址:x264, the best H.264/AVC encoder - VideoLAN

tar jxvf x264-master.tar.bz2
cd x264-master/
./configure --enable-gpl --enable-libx264  # 先往下看
make
make install

结果发现安装好了x264还是报一样的错误,可能是我configure的时候没有加--enable-shared,重装后这个问题就解决了

然后重新给ffmpeg执行上面的configure

执行完之后别忘了vim /etc/ld.so.conf加上一行/usr/local/ffmpeg/lib 这里换成你自己的安装目录

ps:如果这一步没有操作那应该会报错:ffmpeg: error while loading shared libraries: libavdevice.so.60: cannot open shared object file: No such file or directory

最后ldconfig一下就可以愉快的使用ffmpeg了

参考

​​​​ffmpeg问题解决:Unrecognized option 'preset'. Error splitting the argument list: Option not found - 简书 (jianshu.com)

ffmpeg编译问题:“ERROR: x264 not found using pkg-config”_ffmpeg pkg-config-CSDN博客

ffmpeg中设置配置项时ERROR: x264 not found using pkg-config-CSDN博客

相关推荐

  1. ffmpeg的部署简单使用方式

    2023-12-17 02:52:02       7 阅读
  2. 基于FFmpeg进行rtsp

    2023-12-17 02:52:02       50 阅读
  3. FFmpeg实现RTSP

    2023-12-17 02:52:02       37 阅读
  4. FFmpeg实现rtp

    2023-12-17 02:52:02       30 阅读

最近更新

  1. TCP协议是安全的吗?

    2023-12-17 02:52:02       16 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2023-12-17 02:52:02       16 阅读
  3. 【Python教程】压缩PDF文件大小

    2023-12-17 02:52:02       15 阅读
  4. 通过文章id递归查询所有评论(xml)

    2023-12-17 02:52:02       18 阅读

热门阅读

  1. Elasticsearch 8.9 search命令执行查询源码

    2023-12-17 02:52:02       33 阅读
  2. gitee推荐-粤语编程

    2023-12-17 02:52:02       45 阅读
  3. Lua学习笔记 — Table与Metatable(超详细)

    2023-12-17 02:52:02       36 阅读
  4. CSS新手入门笔记整理:CSS3选择器

    2023-12-17 02:52:02       32 阅读
  5. Linux PWM 应用编程

    2023-12-17 02:52:02       39 阅读
  6. LeetCode 70. 爬楼梯

    2023-12-17 02:52:02       45 阅读
  7. MySQL_12.Innodb存储引擎参数

    2023-12-17 02:52:02       33 阅读
  8. 掌握 Go 的计时器

    2023-12-17 02:52:02       43 阅读
  9. Cmake基础(2)

    2023-12-17 02:52:02       31 阅读
  10. 网格布局 Grid

    2023-12-17 02:52:02       42 阅读