Debian

由於 Debian 中未滿足的依賴關係而無法重新安裝 ffmpeg / 為什麼 ffmpeg 沒有在影片轉換中使用指定的比特率?

  • March 26, 2021

**簡而言之:**我嘗試重新安裝 ffmpeg: sudo apt install ffmpeg

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: libavcodec58 (= 7:4.1.6-1~deb10u1)
         Depends: libavdevice58 (= 7:4.1.6-1~deb10u1) but 7:4.3.1-6~bpo10+1 is to be installed
         Depends: libavfilter7 (= 7:4.1.6-1~deb10u1)
         [...]
E: Unable to correct problems, you have held broken packages.`

如何解決那些缺失的依賴關係?


完整問題:

當我執行時ffmpeg -i "./input.mp4" -vcodec libvpx-vp9 -acodec libvorbis -b:v 9M "./output.webm",結果的比特率不是 9MB,而是小得多,即使我嘗試使用的輸入影片的比特率正好是 9MB 或更大。

我對為什麼會發生這種情況很感興趣,除了-crf改用之外,沒有什麼能幫助解決這個問題。有了它,我可以通過反複試驗獲得輸出文件的比特率以匹配輸入文件的比特率。此問題可能與以下問題有關,也可能無關。也許我應該為它創建一個單獨的問題。

由於上述問題,我嘗試重新安裝 ffmpeg。看起來我從Basil Gello 的 Kodi 儲存庫安裝了 ffmpeg (Debian 主記憶體儲庫中的 Kodi 版本非常過時)。起初,我嘗試通過刪除 repo 並執行sudo apt-get update && sudo apt-get --reinstall install ffmpeg我得到的來從主記憶體儲庫重新安裝 ffmpeg: Reinstallation of ffmpeg is not possible, it cannot be downloaded.所以我再次添加了該 repo 並執行:sudo apt-get --reinstall install ffmpeg/buster-backports。這是輸出:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Selected version '7:4.3.1-6~bpo10+1' (kodi-nightly-debian-repo:1.0/stable-backports [amd64]) for 'ffmpeg'
Selected version '7:4.3.1-6~bpo10+1' (kodi-nightly-debian-repo:1.0/stable-backports [amd64]) for 'libavcodec58' because of 'ffmpeg'
Selected version '7:4.3.1-6~bpo10+1' (kodi-nightly-debian-repo:1.0/stable-backports [amd64]) for 'libavutil56' because of 'libavcodec58'
Selected version '7:4.3.1-6~bpo10+1' (kodi-nightly-debian-repo:1.0/stable-backports [amd64]) for 'libswresample3' because of 'libavcodec58'
Selected version '7:4.3.1-6~bpo10+1' (kodi-nightly-debian-repo:1.0/stable-backports [amd64]) for 'libavdevice58' because of 'ffmpeg'
Selected version '7:4.3.1-6~bpo10+1' (kodi-nightly-debian-repo:1.0/stable-backports [amd64]) for 'libavfilter7' because of 'libavdevice58'
Selected version '7:4.3.1-6~bpo10+1' (kodi-nightly-debian-repo:1.0/stable-backports [amd64]) for 'libavformat58' because of 'libavfilter7'
Selected version '7:4.3.1-6~bpo10+1' (kodi-nightly-debian-repo:1.0/stable-backports [amd64]) for 'libpostproc55' because of 'libavfilter7'
Selected version '7:4.3.1-6~bpo10+1' (kodi-nightly-debian-repo:1.0/stable-backports [amd64]) for 'libswscale5' because of 'libavfilter7'
Selected version '7:4.3.1-6~bpo10+1' (kodi-nightly-debian-repo:1.0/stable-backports [amd64]) for 'libavresample4' because of 'ffmpeg'
The following packages were automatically installed and are no longer required:
 i965-va-driver:i386 intel-media-va-driver:i386 libgomp1:i386 libigdgmm5:i386 libsoxr0:i386 libva-drm2:i386 libva-x11-2:i386 libva2:i386
 libvdpau-va-gl1:i386 libvdpau1:i386 mesa-va-drivers:i386 mesa-vdpau-drivers:i386 ocl-icd-libopencl1:i386 va-driver-all:i386 vdpau-driver-all:i386
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
 libavcodec58 libavdevice58 libavfilter7 libavformat58 libavresample4 libavutil56 libpostproc55 libswresample3 libswscale5
Suggested packages:
 ffmpeg-doc
The following packages will be REMOVED:
 libavcodec-dev libavfilter-dev libavformat-dev libavresample-dev libavutil-dev libavutil56:i386 libpostproc-dev libswresample-dev libswresample3:i386
 libswscale-dev
The following packages will be upgraded:
 ffmpeg libavcodec58 libavdevice58 libavfilter7 libavformat58 libavresample4 libavutil56 libpostproc55 libswresample3 libswscale5
10 upgraded, 0 newly installed, 10 to remove and 0 not upgraded.
Need to get 9,752 kB of archives.
After this operation, 39.0 MB disk space will be freed.
Do you want to continue? [Y/n] y
Get:1 https://basilgello.github.io/kodi-nightly-debian-repo buster-backports/main amd64 ffmpeg amd64 7:4.3.1-6~bpo10+1 [1,584 kB]
Get:2 https://basilgello.github.io/kodi-nightly-debian-repo buster-backports/main amd64 libavdevice58 amd64 7:4.3.1-6~bpo10+1 [114 kB]
Get:3 https://basilgello.github.io/kodi-nightly-debian-repo buster-backports/main amd64 libavfilter7 amd64 7:4.3.1-6~bpo10+1 [1,281 kB]
Get:4 https://basilgello.github.io/kodi-nightly-debian-repo buster-backports/main amd64 libswscale5 amd64 7:4.3.1-6~bpo10+1 [195 kB]
Get:5 https://basilgello.github.io/kodi-nightly-debian-repo buster-backports/main amd64 libavformat58 amd64 7:4.3.1-6~bpo10+1 [1,037 kB]
Get:6 https://basilgello.github.io/kodi-nightly-debian-repo buster-backports/main amd64 libavcodec58 amd64 7:4.3.1-6~bpo10+1 [4,942 kB]
Get:7 https://basilgello.github.io/kodi-nightly-debian-repo buster-backports/main amd64 libswresample3 amd64 7:4.3.1-6~bpo10+1 [95.0 kB]                  
Get:8 https://basilgello.github.io/kodi-nightly-debian-repo buster-backports/main amd64 libpostproc55 amd64 7:4.3.1-6~bpo10+1 [91.0 kB]                   
Get:9 https://basilgello.github.io/kodi-nightly-debian-repo buster-backports/main amd64 libavresample4 amd64 7:4.3.1-6~bpo10+1 [92.0 kB]                  
Get:10 https://basilgello.github.io/kodi-nightly-debian-repo buster-backports/main amd64 libavutil56 amd64 7:4.3.1-6~bpo10+1 [320 kB]                     
Fetched 9,752 kB in 8s (1,242 kB/s)                                                                                                                       
Reading changelogs... Done
apt-listchanges: Do you want to continue? [Y/n] y
apt-listchanges: Mailing root: apt-listchanges: changelogs for hostname(Reading database ... 427402 files and directories currently installed.)
Removing libavfilter-dev:amd64 (7:4.3.1-5.1~bpo10+1) ...
Removing libavformat-dev:amd64 (7:4.3.1-5.1~bpo10+1) ...
Removing libavcodec-dev:amd64 (7:4.3.1-5.1~bpo10+1) ...
Removing libavresample-dev:amd64 (7:4.3.1-5.1~bpo10+1) ...
Removing libswscale-dev:amd64 (7:4.3.1-5.1~bpo10+1) ...
Removing libswresample-dev:amd64 (7:4.3.1-5.1~bpo10+1) ...
Removing libswresample3:i386 (7:4.3.1-5.1~bpo10+1) ...
Removing libavutil56:i386 (7:4.3.1-5.1~bpo10+1) ...
Removing libpostproc-dev:amd64 (7:4.3.1-5.1~bpo10+1) ...
Removing libavutil-dev:amd64 (7:4.3.1-5.1~bpo10+1) ...
(Reading database ... 427211 files and directories currently installed.)
Preparing to unpack .../0-ffmpeg_7%3a4.3.1-6~bpo10+1_amd64.deb ...
Unpacking ffmpeg (7:4.3.1-6~bpo10+1) over (7:4.3.1-5.1~bpo10+1) ...
Preparing to unpack .../1-libavdevice58_7%3a4.3.1-6~bpo10+1_amd64.deb ...
Unpacking libavdevice58:amd64 (7:4.3.1-6~bpo10+1) over (7:4.3.1-5.1~bpo10+1) ...
Preparing to unpack .../2-libavfilter7_7%3a4.3.1-6~bpo10+1_amd64.deb ...
Unpacking libavfilter7:amd64 (7:4.3.1-6~bpo10+1) over (7:4.3.1-5.1~bpo10+1) ...
Preparing to unpack .../3-libswscale5_7%3a4.3.1-6~bpo10+1_amd64.deb ...
Unpacking libswscale5:amd64 (7:4.3.1-6~bpo10+1) over (7:4.3.1-5.1~bpo10+1) ...
Preparing to unpack .../4-libavformat58_7%3a4.3.1-6~bpo10+1_amd64.deb ...
Unpacking libavformat58:amd64 (7:4.3.1-6~bpo10+1) over (7:4.3.1-5.1~bpo10+1) ...
Preparing to unpack .../5-libavcodec58_7%3a4.3.1-6~bpo10+1_amd64.deb ...
Unpacking libavcodec58:amd64 (7:4.3.1-6~bpo10+1) over (7:4.3.1-5.1~bpo10+1) ...
Preparing to unpack .../6-libswresample3_7%3a4.3.1-6~bpo10+1_amd64.deb ...
Unpacking libswresample3:amd64 (7:4.3.1-6~bpo10+1) over (7:4.3.1-5.1~bpo10+1) ...
Preparing to unpack .../7-libpostproc55_7%3a4.3.1-6~bpo10+1_amd64.deb ...
Unpacking libpostproc55:amd64 (7:4.3.1-6~bpo10+1) over (7:4.3.1-5.1~bpo10+1) ...
Preparing to unpack .../8-libavresample4_7%3a4.3.1-6~bpo10+1_amd64.deb ...
Unpacking libavresample4:amd64 (7:4.3.1-6~bpo10+1) over (7:4.3.1-5.1~bpo10+1) ...
Preparing to unpack .../9-libavutil56_7%3a4.3.1-6~bpo10+1_amd64.deb ...
Unpacking libavutil56:amd64 (7:4.3.1-6~bpo10+1) over (7:4.3.1-5.1~bpo10+1) ...
Setting up libavutil56:amd64 (7:4.3.1-6~bpo10+1) ...
Setting up libpostproc55:amd64 (7:4.3.1-6~bpo10+1) ...
Setting up libswscale5:amd64 (7:4.3.1-6~bpo10+1) ...
Setting up libswresample3:amd64 (7:4.3.1-6~bpo10+1) ...
Setting up libavresample4:amd64 (7:4.3.1-6~bpo10+1) ...
Setting up libavcodec58:amd64 (7:4.3.1-6~bpo10+1) ...
Setting up libavformat58:amd64 (7:4.3.1-6~bpo10+1) ...
Setting up libavfilter7:amd64 (7:4.3.1-6~bpo10+1) ...
Setting up libavdevice58:amd64 (7:4.3.1-6~bpo10+1) ...
Setting up ffmpeg (7:4.3.1-6~bpo10+1) ...
Processing triggers for man-db (2.8.5-2) ...
Processing triggers for libc-bin (2.28-10) ...
[ Rootkit Hunter version 1.4.6 ]
File updated: searched for 181 files, found 146
Scanning processes...                                                                                                                                      
Scanning candidates...                                                                                                                                     
Scanning processor microcode...                                                                                                                            
Scanning linux images...                                                                                                                                   

Running kernel seems to be up-to-date.

The processor microcode seems to be up-to-date.

No services need to be restarted.

No containers need to be restarted.

User sessions running outdated binaries: [...]

現在sudo apt install ffmpegalways 的輸出是:

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: libavcodec58 (= 7:4.1.6-1~deb10u1)
         Depends: libavdevice58 (= 7:4.1.6-1~deb10u1) but 7:4.3.1-6~bpo10+1 is to be installed
         Depends: libavfilter7 (= 7:4.1.6-1~deb10u1)
         Depends: libavformat58 (= 7:4.1.6-1~deb10u1) but 7:4.3.1-6~bpo10+1 is to be installed
         Depends: libavresample4 (= 7:4.1.6-1~deb10u1) but 7:4.3.1-6~bpo10+1 is to be installed
         Depends: libavutil56 (= 7:4.1.6-1~deb10u1) but 7:4.3.1-6~bpo10+1 is to be installed
         Depends: libpostproc55 (= 7:4.1.6-1~deb10u1) but 7:4.3.1-6~bpo10+1 is to be installed
         Depends: libswresample3 (= 7:4.1.6-1~deb10u1) but 7:4.3.1-6~bpo10+1 is to be installed
         Depends: libswscale5 (= 7:4.1.6-1~deb10u1) but 7:4.3.1-6~bpo10+1 is to be installed
E: Unable to correct problems, you have held broken packages.

如何解決那些缺失的依賴關係?我不能只重新安裝那些,許多其他核心包都依賴於這些。

我也試過執行sudo apt-get clean ; sudo apt-get update ; sudo apt-get check ; sudo apt-get purge ffmpeg* -y ; sudo apt-get autoremove -y ; sudo apt-get -f satisfy ffmpeg -y 並沒有解決問題。

我正在使用 KDE 執行 Debian 10。任何幫助表示讚賞。

好像有人要求安裝 libavdevice58 版本 7:4.3.1-6~bpo10+1。ffmpeg這與依賴於 libavdevice58 版本 7:4.1.6-1~deb10u1的 Debian 香草相衝突。您可以通過在命令行上指定版本來顯式請求舊版本:

sudo apt install ffmpeg libavdevice58=7:4.1.6-1~deb10u1

至於編碼結果,你應該打開第二個問題。正如指南所指出的,有幾個參數一起發揮作用。您的命令實際上將編碼器置於平均比特率模式,而不是恆定比特率模式。請記住,如果源材料足夠容易壓縮,編碼器可能始終選擇保持在目標比特率以下。

引用自:https://unix.stackexchange.com/questions/633114