Build OpenCV with FFmpeg on Linux #1784
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Due to the non-standard install location of FFmpeg during the AliceVision build OpenCV cannot find it. This patch adds FFmpeg to the BUILD_PREFIX of OpenCV to enable the FFmpeg features.
This builds on the work done in #1732 by @furbrain and @fabiencastan.
Features list
Implementation remarks
Expanding on #1732, OpenCV fetches a prebuilt FFmpeg when building for Windows but looks for system libraries when building on Linux.
OpenCV being built without FFmpeg is confirmed by building the Ubuntu docker image and running:
Which responds with
NO
.OpenCV is picky about how external dependencies are specified and it does not support directly specifying install locations. Instead of specifying a location OpenCV's CMAKE uses
find_package()
to find packages. It first looks for Modules inCMAKE_MODULE_PATH
, then looks within the OpenCV source for Find.cmake files according to the CMake Docs.This implementation adds the FFmpeg install path to the
${CMAKE_PREFIX_PATH}
of OpenCV, allowingfind_package()
to search in${CMAKE_INSTALL_PREFIX}
when building.This change is confirmed by running
opencv_version -v | grep -i ffmpeg
, resulting inYES