[ffmpeg安装问题]ffmpeg have unmet dependencies (依赖库冲突)
问题: 安装ffmpeg时出现依赖库的冲突问题
$ sudo apt-get install ffmpeg
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
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: libavformat58 (= 7:4.2.7-0ubuntu0.1) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
解决步骤
step 1. 修复
$ sudo apt --fix-broken install
Reading package lists... Done
Building dependency tree
Reading state information... Done
step2. 重装第一步中出现的冲突库,以查找原因
$sudo apt install libavdevice58=7:4.2.7-0ubuntu0.1 libavfilter7=7:4.2.7-0ubuntu0.1 libavformat58=7:4.2.7-0ubuntu0.1
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
libavformat58 : Depends: libchromaprint1 (>= 1.3.2) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
Here the problem is from libchromaprint1
上面出现的libchromaprint1 库就是原因.
step3. 查找依赖库的备选版本号
$ apt-cache policy libchromaprint1
libchromaprint1:
Installed: (none)
Candidate: 1.5.1-1~20.04.sav0
Version table:
1.5.1-1~20.04.sav0 500
500 http://ppa.launchpad.net/savoury1/multimedia/ubuntu focal/main amd64 Packages
1.4.3-3build1 500
500 http://mirrors.cloud.aliyuncs.com/ubuntu focal/universe amd64 Packages
500 http://archive.ubuntu.com/ubuntu focal/universe amd64 Packages
版本1.5.1-1~20.04.sav0对其他库太新,会产生冲突. 这里我们选择旧版本(1.4.3-3build1)
step4. 安装libchromaprint1 1.4.3-3build1
$ sudo apt install libchromaprint1=1.4.3-3build1
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
libchromaprint1
0 upgraded, 1 newly installed, 0 to remove and 223 not upgraded.
Need to get 37.6 kB of archives.
...
step5. 重装ffmpeg
$ sudo apt install ffmpeg
Reading package lists... Done
Building dependency tree
Reading state information... Done
...