解决在 Ubuntu18.04 上安装 ffmpeg 失败的方法

解决在 Ubuntu18.04 上安装 ffmpeg 失败的方法

一、问题描述

准备用 ffmpeg 对视频进行抽帧处理,结果发现系统没装这玩意,然后一装就来问题了:

(base) root@a6tpt1b1mnhbu-0# apt install ffmpeg
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 ffmpeg : Depends: libavdevice58 (= 7:4.2.7-0ubuntu0.1) but it is not going to be installed
          Depends: libavfilter7 (= 7:4.2.7-0ubuntu0.1)
          Depends: libavresample4 (= 7:4.2.7-0ubuntu0.1) but it is not going to be installed
          Depends: libpostproc55 (= 7:4.2.7-0ubuntu0.1) but it is not going to be installed
          Depends: libsdl2-2.0-0 (>= 2.0.10) but it is not going to be installed
 libibverbs1 : Breaks: ibverbs-providers (< 25~) but 17.1-1ubuntu0.2 is to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

报错了,说是依赖不足,且提示用apt --fix-broken install进行修复依赖问题对吧,结果我一运行又来问题了:

(base) root@a6tpt1b1mnhbu-0# apt --fix-broken install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
  g++-7 libapt-inst2.0 libgdbm5 libicu60 libisl19 libperl5.26 libstdc++-7-dev multiarch-support perl-modules-5.26
Use 'apt autoremove' to remove them.
The following additional packages will be installed:
  ibverbs-providers
The following packages will be upgraded:
  ibverbs-providers
1 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.
175 not fully installed or removed.
Need to get 232 kB of archives.
After this operation, 310 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/main amd64 ibverbs-providers amd64 28.0-1ubuntu1 [232 kB]
Fetched 232 kB in 2s (102 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
(Reading database ... 50553 files and directories currently installed.)
Preparing to unpack .../ibverbs-providers_28.0-1ubuntu1_amd64.deb ...
Unpacking ibverbs-providers:amd64 (28.0-1ubuntu1) over (17.1-1ubuntu0.2) ...
dpkg: error processing archive /var/cache/apt/archives/ibverbs-providers_28.0-1ubuntu1_amd64.deb (--unpack):
 unable to clean up mess surrounding './etc/libibverbs.d/bnxt_re.driver' before installing another version: Read-only file system
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/ibverbs-providers_28.0-1ubuntu1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

说了一堆,但不是很懂,网上查阅了不少资料后,解决了这个问题

二、问题修复

先运行下面两条命令,第一条命令将尝试强制卸载 ibverbs-providers 包,即使在删除过程中出现问题也会强制执行。

然后,第二条命令将尝试修复依赖关系,并尽可能安装缺失的依赖项。

sudo dpkg --purge --force-all ibverbs-providers
sudo apt --fix-broken install

如果上面的成果了,再次使用下面的命令,即可成功安装

apt install ffmpeg

三、后记

搞了一天opencv编译了,没搞成功,各种问题,人已经要崩溃了;在这艰难的时间的里,唯有练练书法,逗逗小猫可以得到内心深处的放松。

愿我们在快节奏的时代里,找到自己的节奏,不慌不忙,踏实地、充实地过好每一天,爱惜自己的身体,爱自己,爱家人。

风雨人生,自己撑伞。

  • 7
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值