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

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

一、问题描述

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

cmd 复制代码
(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进行修复依赖问题对吧,结果我一运行又来问题了:

cmd 复制代码
(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 包,即使在删除过程中出现问题也会强制执行。

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

cmd 复制代码
sudo dpkg --purge --force-all ibverbs-providers
sudo apt --fix-broken install

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

cmd 复制代码
apt install ffmpeg

三、后记

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

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

风雨人生,自己撑伞。

相关推荐
Sleepless_斑马2 天前
【FFmpeg学习(1)】图像表示
学习·ffmpeg
frankz612 天前
ffmpeg windows 32位编译
windows·ffmpeg
Sleepless_斑马2 天前
【FFmpeg学习(2)】视频概念
学习·ffmpeg·音视频
我是苏苏2 天前
FFmpeg:Windows系统小白安装及其使用
ffmpeg
头发那是一根不剩了3 天前
用 FFmpeg 实现 RTMP 推流直播
ffmpeg
有你有我OK3 天前
FFmpeg介绍
ffmpeg
灰灰的9963 天前
基于ffmpeg+sdl的audio player
ffmpeg
勿芮介3 天前
【开发技术】.Net使用FFmpeg视频特定帧上绘制内容
ffmpeg·.net·音视频
长沙红胖子Qt3 天前
关于 ffmpeg设置摄像头报错“Could not set video options” 的解决方法
ffmpeg
aningxiaoxixi3 天前
Android Framework 之 AudioDeviceBroker
android·windows·ffmpeg