Solution of libavcodec problem in OpenCV

I had manually compiled OpenCV version 3.4.2 on my CentOS system, and it worked well until today. This morning, I received a issue of my SRCNN-cpp project. After I tried to execute the programming I got the following error message: cannot open shared object file: No such file or directory. In the beginning, I thought maybe something wrong of the executable, so I tried to recompile the program. Surprisingly, I got the compile errors related to FFmpeg. I realized I upgraded FFmpeg a month ago which breaks OpenCV (my is symlinked to

As mentioned in this thread, I can solve this problem by these two approaches:

  1. Recompile OpenCV to link against the latest version of libavcodec.
  2. Revert the version of libavcodec to 56.

As a hardcore programmer, I selected the solution of recompiling. What’s more, I wanted to upgrade my OpenCV to newer version. For compiling OpenCV from source on CentOS, you can see this article.

Originally published at on January 31, 2020.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store