Ask Your Question

ryantheseer's profile - activity

2019-03-15 09:03:42 -0500 received badge  Notable Question (source)
2018-06-06 16:54:09 -0500 received badge  Popular Question (source)
2017-02-15 09:37:49 -0500 received badge  Scholar (source)
2017-02-15 05:55:44 -0500 received badge  Teacher (source)
2017-02-14 15:34:50 -0500 received badge  Self-Learner (source)
2017-02-14 13:08:59 -0500 answered a question Using custom opencv_ffmpeg*.dll version on Windows

I built a custom opencv_ffmpeg*.dll from a 3.2.0-dev version of the code (23 Dec 2016 8:20, commit 7dd3723), with some instructions, here.

2017-02-14 13:01:51 -0500 answered a question How to build opencv_ffmpeg.dll from patched FFmpeg source

This worked for me to build the 64-bit FFmpeg API from source:

1. Build the FFmpeg .a static library archives(which are object that are inputs to a linker). On 64-bit Windows, I configured the FFmpeg build like this:
./configure --target-os=win32 --disable-programs --disable-doc --enable-static --enable-shared
make install

2. Copy the .a static library archives into a folder in the OpenCV source folder under \3rdparty\lib, and add the suffix 64 for the 64-bit archives:

  • ffmpeg/libavcodec/libavcodec.a → opencv/3rdparty/lib/libavcodec64.a
  • ffmpeg/libavdevice/libavdevice.a → opencv/3rdparty/lib/libavdevice64.a
  • ffmpeg/libavfilter/libavfilter.a → opencv/3rdparty/lib/libavfilter64.a
  • ffmpeg/libavformat/libavformat.a → opencv/3rdparty/lib/libavformat64.a
  • ffmpeg/libavutil/libavutil.a → opencv/3rdparty/lib/libavutil64.a
  • ffmpeg/libswresample/libswresample.a → opencv/3rdparty/lib/libswresample64.a
  • ffmpeg/libswscale/libswscale.a → opencv/3rdparty/lib/libswscale64.a

3. Copy all the C/C++ header files in the FFmpeg source directory to a new OpenCV source directory called \3rdparty\include\ffmpeg_. For example:
cp /ffmpeg/libavcodec/*.h /opencv/3rdparty/include/ffmpeg_/libavcodec
cp /ffmpeg/libavdevice/*.h /opencv/3rdparty/include/ffmpeg_/libavdevice
cp /ffmpeg/libavfilter/*.h /opencv/3rdparty/include/ffmpeg_/libavfilter
cp /ffmpeg/libavformat/*.h /opencv/3rdparty/include/ffmpeg_/libavformat
cp /ffmpeg/libavresample/*.h /opencv/3rdparty/include/ffmpeg_/libavresample
cp /ffmpeg/libavutil/*.h /opencv/3rdparty/include/ffmpeg_/libavutil
cp /ffmpeg/libpostproc/*.h /opencv/3rdparty/include/ffmpeg_/libpostproc
cp /ffmpeg/libswresample/*.h /opencv/3rdparty/include/ffmpeg_/libswresample
cp /ffmpeg/libswscale/*.h /opencv/3rdparty/include/ffmpeg_/libswscale

4. In the OpenCV \3rdparty\ffmpeg folder, create a file called ffopencv.c, with these contents:
#include "cap_ffmpeg_impl.hpp"

5. From the OpenCV \3rdparty\ffmpeg folder, run the following from the Windows command line with Cygwin and MingW installed:
x86_64-w64-mingw32-g++ -m64 -Wall -static -static-libgcc -static-libstdc++ -shared -o opencv_ffmpeg320_64.dll -O2 -x c++ -I../include -I../include/ffmpeg_ -I../../modules/videoio/src -I/../../modules/highgui/src ffopencv.c -L../lib -lavdevice64 -lavfilter64 -lavformat64 -lavcodec64 -lavutil64 -lswscale64 -lswresample64 -lws2_32 -liconv -lz -lbz2 -lsecur32

This will produce the opencv_ffmpeg320_64.dll (or you can use another name, if applicable) in the correct folder. Whenever you change the OpenCV FFmpeg API, you will only have to re-run Step 5. Whenever you change FFmpeg source code, you will have to re-run Steps 1-5.

2017-02-14 09:43:47 -0500 received badge  Enthusiast
2017-02-06 15:20:20 -0500 commented question How to build opencv_ffmpeg.dll from patched FFmpeg source

Going to try to follow the steps here:

2017-02-06 09:49:33 -0500 commented question Using custom opencv_ffmpeg*.dll version on Windows

Hi, did you ever figure out an answer to this question?

2017-02-06 08:44:08 -0500 received badge  Supporter (source)
2017-02-06 07:44:15 -0500 received badge  Editor (source)
2017-02-04 08:16:24 -0500 received badge  Student (source)
2017-02-04 08:03:11 -0500 asked a question How to build opencv_ffmpeg.dll from patched FFmpeg source

I am trying to write a patch to the FFmpeg API, and I am able to build the FFmpeg library dlls for Windows successfully using the instructions on their website (MinGW/FFmpeg installation guide). However, I'm not sure how to package these various dlls (avfilter.dll, avformat.dll, avcodec.dll, etc.) into the opencv_ffmpeg.dll that the CMake looks for when building OpenCV. I will eventually want to build my custom FFmpeg libraries and OpenCV cross-platform for Linux and Mac OS X, as well. The end game is to have Java-wrapped OpenCV working cross-platform with a modified FFmpeg API. How do I do this?