解决在 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编译了,没搞成功,各种问题,人已经要崩溃了;在这艰难的时间的里,唯有练练书法,逗逗小猫可以得到内心深处的放松。

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

风雨人生,自己撑伞。

相关推荐
Enougme5 小时前
ffmpeg常用方法(一)
ffmpeg
gma99918 小时前
【FFmpeg】拉流
ffmpeg
深图智能1 天前
算法仿真平台搭建1-FFMPEG+RtspSever快速搭建一个RTSP服务器
c++·算法·ffmpeg·视频编解码
IT技术分享社区2 天前
电脑软件:推荐一款非常强大的视频音频转换剪辑工具FFmpeg Batch AV Converter V3.12
ffmpeg·音视频·batch·剪辑工具
ICUD2 天前
FFmpeg+vvenc实现H.266的视频编解码教程
人工智能·ffmpeg·视频编解码·h.266
万里不留行2 天前
海康摄像头 + M7s(Monibuca) + FFmpeg + Python实现多个网络摄像头视频流推流
服务器·网络·python·ffmpeg
ICUD2 天前
FFmpeg使用H.266/H.264/H.265编解码视频教程
ffmpeg·h.264·h.266
宇宙无敌花心大萝卜3 天前
一种简单的快速批量视频抽取固定间隔帧截图的操作方法
ffmpeg·音视频·视频
飞猿_SIR3 天前
最新版本Exoplayer(MediaX)实现K歌原伴唱包括单音轨和双音轨
android·ffmpeg·音视频
WalkingWithTheWind~4 天前
Linux搭建Nginx直播流媒体服务RTMP/RTSP转Http-flv视频浏览器在线播放/Vue/Java/ffmpeg
java·linux·nginx·ffmpeg·vue·http-flv·rtsp