ffmpeg: error while loading shared libraries: libopenh264.so.5: cannot open shared…
- User
ffmpeg: error while loading shared libraries: libopenh264.so.5: cannot open shared object file: No such file or directory FATAL: command failed
- Assistant
The error you're seeing indicates that FFmpeg is trying to use the
libopenh264.so.5library, but it cannot find it. OpenH264 is a codec library that implements the H.264 video codec, and it must be properly installed on your system for FFmpeg to utilize it when needed.There are a few ways to resolve this issue:
-
Install OpenH264:
The first step is to ensure OpenH264 is installed on your system. You can typically find it in your system's package manager. For example, on a Debian-based system (like Ubuntu), you would run:
sudo apt-get update sudo apt-get install libopenh264-5Replace
libopenh264-5with the correct package name if it differs for your distribution. For other systems, like CentOS or Fedora, you would use theyumordnfpackage manager, respectively. -
Install FFmpeg with Static Libraries:
Alternatively, you could opt for a version of FFmpeg that has been statically compiled with the necessary libraries. This would not require you to install
libopenh264separately. Pre-compiled static builds of FFmpeg can be downloaded from various sources. -
Set
LD_LIBRARY_PATH:If you have OpenH264 installed in a non-standard directory, you might need to inform your system where to find the library. You can do this by setting the
LD_LIBRARY_PATHenvironment variable:export LD_LIBRARY_PATH=/path/to/your/libraries:$LD_LIBRARY_PATHReplace
/path/to/your/librarieswith the actual path wherelibopenh264.so.5is located. -
Update the Dynamic Linker Run-Time Bindings:
After installing a new library, the system's dynamic linker might need to be updated to know about the new library. On many systems, this is done using the
ldconfigcommand:sudo ldconfig -
Reinstall FFmpeg:
It's possible that your FFmpeg installation is not set up correctly. Reinstalling FFmpeg could potentially solve the problem, especially if you use an installation method that accounts for all necessary dependencies.
sudo apt-get remove --purge ffmpeg sudo apt-get install ffmpeg
Remember to replace the use of
apt-getwith the appropriate package management command for your specific Linux distribution. After completing one or more of the above steps, try running FFmpeg again to see if the issue has been resolved. -