Trying to make OpenCV conan package with FFmpeg support, not working

asked 2019-10-03 12:52:46 -0500

bevilacq12 gravatar image

I'm trying to build OpenCV as a conan package with FFmpeg support enabled. The conan package part is necessary, I can't change that aspect, but I can modify the conan recipe.

OpenCV builds and the package is usable elsewhere, but FFmpeg is not enabled. Initially the conan recipe had the following line:

cmake.definitions["WITH_FFMPEG"] = FALSE

which, well, the problem is obvious. But even after changing it to true, FFmpeg support is still turned off in the resulting OpenCV conan package (confirmed by running getBuildConfiguration() at runtime and seeing the line "FFMPEG: NO" in the VideoIO section).

I have FFmpeg itself installed on the runtime machine, but in case it also needed to be installed on the build machine, I added the following dependencies:

if tools.os_info.with_apt:
    pack_names.extend(["ffmpeg"])
    pack_names.extend(["x264"])
    pack_names.extend(["libx264-dev"])

But the result was the same.

What switches are necessary to build OpenCV with FFmpeg support?

Here is the total list of options I have enabled/disabled:

def build(self):
    cmake = CMake(self)
    cmake.definitions["CONAN_BUILD"] = "True"
    cmake.definitions["CMAKE_INSTALL_PREFIX"] = os.path.join(self.source_folder, "install")
    cmake.definitions["CMAKE_C_FLAGS"] = "-fstack-protector-strong -Wformat -Werror=format-security"
    cmake.definitions["CMAKE_CXX_FLAGS"] = "-fstack-protector-strong -Wformat -Werror=format-security"
    cmake.definitions["CMAKE_SHARED_LINKER_FLAGS"] = "-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now"
    cmake.definitions["CMAKE_EXE_LINKER_FLAGS"] = "-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now"
    cmake.definitions["BUILD_DOCS"] = "True"
    cmake.definitions["BUILD_PACKAGE"] = "True"
    cmake.definitions["BUILD_PERF_TESTS"] = "False"
    cmake.definitions["BUILD_SHARED_LIBS"] = "True"
    cmake.definitions["BUILD_TESTS"] = "True"
    cmake.definitions["BUILD_WITH_DEBUG_INFO"] = "True"
    cmake.definitions["BUILD_opencv_apps"] = "True"
    cmake.definitions["CUDA_FAST_MATH"] = "False"
    cmake.definitions["ENABLE_CCACHE"] = "True"
    cmake.definitions["ENABLE_FAST_MATH"] = str(self.options.cuda)
    cmake.definitions["ENABLE_PRECOMPILED_HEADERS"] = "True"
    cmake.definitions["WITH_1394"] = "True"
    cmake.definitions["WITH_CUDA"] = str(self.options.cuda)
    cmake.definitions["WITH_CUFFT"] = str(self.options.cuda)
    cmake.definitions["WITH_EIGEN"] = "True"
    cmake.definitions["WITH_FFMPEG"] = "True"
    cmake.definitions["WITH_GIGEAPI"] = "True"
    cmake.definitions["WITH_GSTREAMER"] = "False"
    cmake.definitions["WITH_GTK"] = "True"
    cmake.definitions["WITH_JASPER"] = "True"
    cmake.definitions["WITH_JPEG"] = "True"
    cmake.definitions["WITH_LIBV4L"] = "False"
    cmake.definitions["WITH_OPENCL"] = "True"
    cmake.definitions["WITH_OPENCLAMDBLAS"] = "True"
    cmake.definitions["WITH_OPENCLAMDFFT"] = "True"
    cmake.definitions["WITH_OPENEXR"] = "True"
    cmake.definitions["WITH_PNG"] = "True"
    cmake.definitions["WITH_PVAPI"] = "True"
    cmake.definitions["WITH_TBB"] = "False"
    cmake.definitions["WITH_TIFF"] = "True"
    cmake.definitions["WITH_V4L"] = "False"
    cmake.definitions["WITH_IPP"] = "True"
edit retag flag offensive close merge delete