opencv / opencv/opencv-python

Failed build opencv-python without ffmpeg option in Windows

Open
#1,023 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
5.4k
Forks
1k
Avg merge
22h 17m
Merged PRs (30d)
3

Description

I'm trying build minimal OpenCV-python for Windows for my project, without not needed functions. In my case I don't need video encoding and decoding functions. Also I would like to minimize LGPL libs presence.

At that setup.py contains the following lines:

    rearrange_cmake_output_data = {
        "cv2": (
            [r"bin/opencv_videoio_ffmpeg\d{4}%s\.dll" % ("_64" if is64 else "")]
            if os.name == "nt"
            else []
        )
        +

Here is expected, that ffmpeg dll will be built and packaged. However, there is no such file in case of building without FFMPEG (with CMAKE_ARGS="-DWITH_FFMPEG=OFF" env variable set). These lines leads to build fail in such configuration.

I have changed these lines to fix problem in my case. However, it seems disabling FFMPEG is a common need given the considerations above. Build should not fail in this case.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in setup.py at the rearrange_cmake_output_data entry for the Windows FFmpeg DLL and reproduce the build with CMAKE_ARGS="-DWITH_FFMPEG=OFF". Check the packaging step and confirm that a Windows build without FFmpeg completes successfully without requiring the absent DLL.

Written by the indexing model from the issue text.

Assessment

Tech stack
opencv, python
Domain
build-system
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.