OpenCV 2.4 static lib relies on opencv_ffmpeg*.dll on Windows
I want to compile a simple C program which I would like to statically link to opencv*.lib files. I am doing thin on Windows 64bit, with VS 2013.
I have included the include
directory, the opencv\build\x64\vc12\staticlib
directory, and all the necessary .lib files. The compilation went smoothly, but the program won't execute. More specifically,
VideoCapture::open(*filename*)
will fail, and
VideoCapture::isOpened()
will return false. But no exception of any kind is thrown.
I noticed if I put my executable under opencv\build\x64\vc12\bin
, the program will work as expected. So I tried the combination of the DLLs and my program, and I found opencv_ffmpeg*.dll is the one causing my problem.
It seems to me that the static lib is dynamically linking to this ffmpeg DLL. So even my program can run without DLLs from opencv, I still need to satisfy the dependencies of the static lib, which is a dynamic lib...so complicate.
You will need to statically build ffmpeg first yourself on your system before you can integrate it in OpenCV like you want. If not the dependency will indeed still exist. The reason of it being dynamically linked is due to the GPL licence ...
So, I need to:
That means I need to build everything from scratch...correct?
Yep that is correct. But keep in mind that once you would deploy this code to a product, that the license prohibits you from using it commercially with a static ffmpeg, for free that is.