I cannot seem to configure OpenCV to link to a non-/usr/lib set of FFMPEG
libraries.
My LD_LIBRARY_PATH contains a direct link to the folder for the custom
It's years after the question was asked, but I recently ran into the kinds of issues described in this question! I'd like to add my input.
First: I only built the static ffmpeg libraries (for reasons), which the opencv build process is somewhat hostile towards. There have been posts by opencv developers stating that they don't support an opencv build against static ffmpeg libraries, but my thinking was "what if you're also building static opencv libraries? Certainly that should be supported?"
And the answer is yes, you can compile static opencv libraries against static ffmpeg libraries! I did this with opencv 4.1.1 against ffmpeg 4.2. I had to use the following cmake options:
cmake3 \
-D BUILD_opencv_apps=OFF \
-D BUILD_opencv_python2=OFF \
-D BUILD_SHARED_LIBS=OFF \
-D WITH_FFMPEG=ON \
-D OPENCV_FFMPEG_SKIP_BUILD_CHECK=ON \
These options result in a set of opencv static libraries that include whatever ffmpeg static libraries that you've also built, assuming your PKG_CONFIG_PATH is setup to correctly find those libraries (or if you've installed them to some default system location).
Q/A: