opencv_ffmpeg static library is incompatible with highgui (Feature #687)
Description
When you build OpenCV in static library mode, highgui can't open and save video (on windows at least).
This bug is in OpenCV 2.1 and in the trunk. It should be good to be resolved before the release of OpenCV 2.2.
The reason is opencv_ffmpeg is designed to be a dll and not a static lib.
- in the file cap_w32.cpp (highgui) the linking to opencv_ffmpeg is done with LoadLibrary and GetProcAddress.
Changes are on the attach file cvcap_w32_diff.htm. * in the ffopencv.h (opencv_ffmpeg) : <pre> <pre> * add to all project that use [[OpenCV]] (traincascade, createsamples, performance, haartraining) <pre> <pre>
Associated revisions
always build ffmpeg_opencv as a shared lib (ticket #687)
Merge pull request #687 from vpisarev:fast_lin_svm2
History
Updated by Vadim Pisarevsky over 14 years ago
ffmpeg is LGPL library, without any exceptions. As long as you link ffmpeg statically, the whole highgui becomes LGPL library, not BSD, and thus any application that links such highgui statically, should be LGPL or GPL application, which is completely inappropriate for us and for many of our users. That's why only opencv_ffmpeg is built as dynamic library and it's LGPL, the rest of OpenCV is BSD.
The patch can not be integrated in the current form, we need something that works for usual (non-static) OpenCV build.
Updated by Yvonnic MM over 14 years ago
OK, So the problem is in cmake configuration file that build opencv_ffmpeg library in static lib when the option BUILD_SHARED_LIB is untick.
I replaced the ffopencv directory of a static lib version of opencv by the same one of a shared lib version and it works fine, opencv_ffmpeg was the only dll build and the rest was only static lib, and opencv_ffmpeg wasn't dependent to cxcore.dll (but it was 2MB larger).
and you still ave to add libcmt.lib;atlthunk.lib to the IgnoreDefaultLibraryNames of traincascade, createsamples, performance and haartraining, when highgui is build in static mode.
highgui already have libcmt.lib;atlthunk.lib in its IgnoreDefaultLibraryNames in the dll version, because of videoinput.lib which is include in cvcap_dshow.cpp.
Updated by Vadim Pisarevsky almost 14 years ago
probably fixed in r5271
- (deleted custom field) set to fixed
Updated by Andrey Kamaev over 12 years ago
- Category changed from highgui-images to highgui-video