Export the required library, run:
ffmpeg: error while loading shared libraries: libavdevice.so.58
Last year, I had a lot of fun testing the new Intel Flex Series GPUs (formerly codenamed Arctic Sound-M). In particular, I was playing around with the Flex Series 140, for Media Delivery and Transcoding solutions, using FFmpeg. The environment: Ubuntu 20.04.
It is important to mention, that I am using some kind of special version from Intel, however, I found this error common in FFmpeg.
After installing FFmpeg and running it, (ffmpeg or ffmpeg -version), you receive the following error message:
"ffmpeg: error while loading shared libraries: libavdevice.so.58: cannot open shared object file: No such file or directory”
The cause of this issue is that FFmpeg is unable to load a required shared library file, libavdevice.so.58. And that Ubuntu has not configured the environment variables through the source code installation software; as a result, the startup path cannot be found.
Here are some options you can take to resolve this error on Ubuntu:
Export the required FFmpeg library
Open a terminal window. Run the following command to export the required library to the right path.
Try running the FFmpeg command again to confirm that the error has been resolved:
If FFmpeg runs without error, like in the below image, then the issue has been resolved. If not, you may need to try the fix below.
Configure FFmpeg environment variables
In the Ubuntu terminal, run:
sudo vim /etc/ld.so.conf
Note: This is the default installation path for FFmpeg. If the path is different, you will need to switch to your own installation path and then point to the "lib" folder.
After opening the (VIM) text editor, add the following line.
Save the file and run:
You're done! Type ffmpeg again to check.