Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Building opencv from source in Mac m1

I’m using the following Make to build OpenCV from source,

 cmake -D CMAKE_BUILD_TYPE=RELEASE \
    -D CMAKE_INSTALL_PREFIX=/usr/local \
  -D OPENCV_EXTRA_MODULES_PATH=/Users/Tools/opencv_contrib/modules \
  -D PYTHON3_EXECUTABLE=/miniforge/base/envs/envname/bin/python3 \
    -D BUILD_opencv_python2=OFF \
    -D BUILD_opencv_python3=ON \
    -D INSTALL_PYTHON_EXAMPLES=ON \
    -D WITH_TBB=ON \
    -D WITH_V4L=ON \
    -D INSTALL_C_EXAMPLES=OFF \
    -D OPENCV_ENABLE_NONFREE=ON \
    -D WITH_OPENGL=ON \
     -DBUILD_ZLIB=OFF \
  -D OPENCV_EXTRA_MODULES_PATH=/Users/Tools/opencv_contrib/modules \
    -D BUILD_EXAMPLES=ON ..

Unfortunately it doesn’t build. It throws the following error,

: error: unknown type name 'AVBSFContext'; did you mean 'AVIOContext'?

I have of course installed FFmpeg. what am I still missing?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

I think that you’ve installed ffmpeg 5 and OpenCV is not yet compatible with it. Please try the following:

brew install ffmpeg@4
brew unlink ffmpeg
brew link ffmpeg@4

and then recompile OpenCV again.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading