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

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

风雨人生,自己撑伞。

相关推荐
shelutai7 小时前
FFMPEG: Overlay a video on a video after x seconds
ffmpeg
aqi0014 小时前
FFmpeg开发笔记(五十三)移动端的国产直播录制工具EasyPusher
android·ffmpeg·音视频·直播·流媒体
「QT(C++)开发工程师」1 天前
【FFmpeg应用场景概述】
ffmpeg
cuijiecheng20181 天前
音视频入门基础:AAC专题(6)——FFmpeg源码中解码ADTS格式的AAC的Header的实现
ffmpeg·音视频·aac
yunhuibin1 天前
ffmpeg面向对象——参数配置秘密探索及其设计模式
学习·设计模式·ffmpeg
superconvert2 天前
主流流媒体的综合性能大 PK ( smart_rtmpd, srs, zlm, nginx rtmp )
websocket·ffmpeg·webrtc·hevc·rtmp·h264·hls·dash·rtsp·srt·flv
cuijiecheng20182 天前
音视频入门基础:AAC专题(8)——FFmpeg源码中计算AAC裸流AVStream的time_base的实现
ffmpeg·音视频·aac
0点51 胜2 天前
[ffmpeg] 视频格式转换
ffmpeg
Jerry 二河小鱼3 天前
在Linux中安装FFmpeg
linux·运维·服务器·ffmpeg
0点51 胜4 天前
[ffmpeg] 音视频编码
ffmpeg·音视频