当前位置: 代码迷 >> 综合 >> ubuntu 18.04 下载编译安装 ffmpeg ffplay 及问题解决
  详细解决方案

ubuntu 18.04 下载编译安装 ffmpeg ffplay 及问题解决

热度:43   发布时间:2024-01-29 07:01:21.0

1 下载

git clone https://git.ffmpeg.org/ffmpeg.git  --config http.proxy= --config http.sslVerify=false

当然也可去官网下载源码包,速度会快点

2 配置

进入源码目录

./configure --prefix=/usr/local/ffmpeg --enable-debug=3 --enable-shared --disable-static

--prefix=/user/local/ffmpeg指定目录

--enable-debug=3 调试等级

--enable-shared 生成动态库

--disable-static 不允许生成静态库

3 编译

make -j 4

4 安装

sudo make install

5 配置环境变量 

vim ~/.bashrc 
export PATH="$PATH:/usr/local/ffmpeg/bin"
source ~/.bashrc 

6  验证

ffmpeg -version

 

7 安装 ffplay

安装后查看,ffplay没有安装,原因是libsdl2-dev 未安装,配置时自动检测不到,没有打开ffplay安装选项。

https://blog.csdn.net/longbei9029/article/details/69950552?utm_source=blogxgwz5

sudo apt install libsdl2-dev 

安装  libsdl2-dev ,重新走前面6步骤,解决该问题

 

8 安装中报错问题解决

1)remote: Counting objects: 602685, done.

remote: Compressing objects: 100% (124125/124125), done.

error: RPC failed; curl 56 GnuTLS recv error (-54): Error in the pull function.

fatal: The remote end hung up unexpectedly

fatal: 过早的文件结束符(EOF)

fatal: index-pack 失败

git config --global http.postBuffer 524288000

 

2) gcc is unable to create an executable file.

If gcc is a cross-compiler, use the --enable-cross-compile option.

Only do this if you know what cross compiling means.

C compiler test failed.)

原因:未安装gcc

sudo apt-get install gcc

 

3) nasm/yasm not found or too old. Use --disable-x86asm for a crippled build.

https://blog.csdn.net/taosera/article/details/79566905

需要安装yasm的汇编编译器

sudo apt-get install yasm

分析:yasm是汇编编译器,ffmpeg为了提高效率使用了汇编指令,如MMX和SSE等。所以系统中未安装yasm时,就会报上面错误。

如果不需要yasm也可以

./configure --disable-x86asm

 

4) WARNING: pkg-config not found, library detection may fail.

需要配置pkg-config环境变量,不影响使用。

 

5 Command 'make' not found, but can be installed with:

sudo apt install make

sudo apt install make-guile

原因:新的机子,没装make

sudo apt install make

6)ffmpeg: error while loading shared libraries: libavdevice.so.58: cannot open shared object file: No such file or directory

修改bashrc,添加