I'm trying to build OpenCV by following Kdenlive's compilation document. At cmake step, cmake cannot find ffmpeg's library. How can I address cmake to find ffmpeg?


$ git clone https://github.com/opencv/opencv.git
$ git clone https://github.com/mltframework/mlt.git
$ mkdir opencv/build
$ cd opencv/build
$ cmake .. -DOPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules

Output of cmake:

--     FFMPEG:                      NO
--       avcodec:                   NO
--       avformat:                  NO
--       avutil:                    NO
--       swscale:                   NO
--       avresample:                NO

Platform is Scientific Linux 7.4 and I have installed ffmeg and it's library under '/usr/local/lib' but it seems that cmake couldn't find it.

  • Are you sure you need to build OpenCV with ffmpeg support? to me, it reads like they are two separate parts (1) OpenCV for the motion tracker (2) an up-to-date FFMPEG. Regardless, IIRC ffmpeg is turned off by default in the OpenCV cmake build - so at a minimum you'll need to add -DWITH_FFMPEG=ON and then see what sub-parts it still complains about – steeldriver Dec 17 '17 at 14:15

Does your LD_LIBRARY_PATH variable include /usr/local/lib? You can check with 'echo $LD_LIBRARY_PATH'

Safest way to add it, if missing, is 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib' this will add the /usr/local/lib to the existing directories in

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.