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

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 ,重新走前面步骤3-5,解决该问题

 

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,添加 

vim ~/.bashrc
export LD_LIBRARY_PATH=/usr/local/ffmpeg/lib/
source  ~/.bashrc

 

  • 10
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
Ubuntu 18.04安装ffmpeg,你可以按照以下步骤进行操作: 1. 首先,确保你已经安装了必要的编译工具和依赖项。你可以使用以下命令安装它们: ```shell sudo apt-get update sudo apt-get install build-essential ``` 2. 下载ffmpeg的源代码。你可以在官方网站或者其他可信的资源中找到最新版本的源代码。 3. 解压下载的源代码文件。你可以使用以下命令进入解压后的文件夹: ```shell cd ffmpeg-<version> ``` 4. 配置和编译ffmpeg。你可以按照以下命令依次执行: ```shell ./configure make sudo make install ``` 5. 安装完成后,你可以通过以下命令检查ffmpeg是否成功安装: ```shell ffmpeg -version ``` 如果你想卸载或重新安装ffmpeg,你可以按照以下步骤进行操作: 卸载ffmpeg: 1. 删除相关的软链接: ```shell sudo rm /usr/bin/ffmpeg sudo rm /usr/bin/ffprobe ``` 2. 清空环境变量中修改的地方并更新: ```shell sudo ldconfig ``` 重新安装ffmpeg: 1. 如果你需要更新、回退或增加库支持,你可以按照以下步骤进行操作: - 删除ffbuild目录下带"config"字段的文件:`rm ffmpeg-<version>/ffbuild/config` - 删除相关的软链接: ```shell sudo rm /usr/bin/ffmpeg sudo rm /usr/bin/ffprobe ``` - 重新编译安装ffmpeg: ```shell cd ffmpeg-<version> ./configure make sudo make install ``` - 配置ffmpeg依赖环境并更新环境变量: ```shell sudo nano /etc/ld.so.conf ``` 在打开的文件中添加ffmpeg所在的目录,保存并关闭文件。然后运行以下命令更新环境变量: ```shell sudo ldconfig ``` 通过以上步骤,你可以在Ubuntu 18.04安装、卸载或重新安装ffmpeg。请根据你的需求选择相应的操作。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [Ubuntu 18.04 安装FFmpeg](https://blog.csdn.net/weixin_43804210/article/details/108198399)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *2* *3* [Ubuntu 18.04 安装ffmpeg(支持GPU硬件加速)](https://blog.csdn.net/txf1931783593/article/details/128250457)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值