Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build OpenCV with FFmpeg on Linux #1784

Merged
merged 1 commit into from
Dec 3, 2024

Conversation

c-ewing
Copy link
Contributor

@c-ewing c-ewing commented Nov 24, 2024

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:

$ ./opt/AliceVision_install/bin-deps/opencv_version -v | grep -i ffmpeg

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 in CMAKE_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, allowing find_package() to search in ${CMAKE_INSTALL_PREFIX} when building.

This change is confirmed by running opencv_version -v | grep -i ffmpeg, resulting in YES

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.
@cbentejac
Copy link
Contributor

Thanks for your contribution @c-ewing!

@cbentejac cbentejac merged commit 7d73bc0 into alicevision:develop Dec 3, 2024
4 checks passed
@c-ewing c-ewing deleted the opencv-ffmpeg branch December 3, 2024 22:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants