Ffmpeg: error while loading shared libraries: libavdevice.so.58: cannot open shared object file: Error 74

ffmpeg

Since today when I run ffmpeg I have the error in the title of this question.

I tried this, but can't apply the solution because I have a directory /etc/ld.so.conf.d and in that directory there are the following files:
fakeroot-x86_64-linux-gnu.conf i386-linux-gnu.conf libc.conf x86_64-linux-gnu.conf

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.4 LTS
Release:    22.04
Codename:   jammy

Best Answer

If you're encountering an error with ffmpeg that suggests a library issue and you've noted the presence of various .conf files in /etc/ld.so.conf.d, it sounds like there might be a mismatch or a missing path in your library configuration. Given that you have Ubuntu 22.04.4 LTS, here's a streamlined approach to troubleshoot and potentially solve your problem:

First, ensure that ffmpeg is correctly installed and try to identify which version you're running. If you installed it from Ubuntu's repositories, it should be configured correctly, but if it's a custom build or from a third-party repository, you might need to ensure it's compatible with your system.

then run ffmpeg from the terminal and pay close attention to any error messages regarding missing libraries. The specific name of the missing file can give a clue on what to fix.

Since the system might not be aware of the location of some newly installed libraries, update the linker run-time bindings with:

sudo ldconfig

The above command I gave updates the cache of the dynamic linker to include paths to all known libraries in the directories listed in /etc/ld.so.conf and its included files in /etc/ld.so.conf.d/.

Also If ffmpeg is complaining about a library that you know is installed, make sure the path to this library is included in the linker configuration. You can add a new .conf file in /etc/ld.so.conf.d/ that contains the path to the directory where the missing library resides. For example, if your library is in /usr/local/lib, you can do:

echo "/usr/local/lib" | sudo tee /etc/ld.so.conf.d/mycustomlib.conf
sudo ldconfig

Please always replace /usr/local/lib with the actual path where the problematic library is located.

If the issue persists, consider reinstalling ffmpeg to ensure it's properly set up:

sudo apt-get update
sudo apt-get install --reinstall ffmpeg

This can help resolve any corrupt installations or incorrect configurations.

Related Question