Visual Studio 2008 Win64: FFmpeg support (Feature #677)
Description
Currently, when you try to compile OpenCV under Visual Studio 2008 Win64, there is no FFmpeg support. Here's what I did to add it in:
In "opencv\modules\CMakeLists.txt", the "if(NOT CMAKE_CL_64)" block surrounding "add_subdirectory(ffmpeg)" must be commented out. That way, when you run CMake, the "opencv_ffmpeg" project will show up.
However, when you try to compile the "opencv_ffmpeg" project, you'll get 37 unresolved externals (av_free_packet, av_close_input_file, etc). I believe the fundamental problem is that the calling convention between 64-bit Windows and 64-bit Unix systems are different, so MSVC can not link to the 64-bit .a file.
This means that FFmpeg must be compiled as a MSVC-importable .lib. Here is the build process I used:
1. Follow the steps on this page to install Ubuntu 64-bit on a virtual box: http://ffmpeg.arrozcru.org/wiki/index.php?title=Installing_Ubuntu_in_VirtualBox
2. Execute the "script" file I've attached, which is based on the steps from this page: http://ffmpeg.arrozcru.org/wiki/index.php?title=Cross-compiling
Assuming the script executes successfully (let me know if it doesn't), you'll end up with a few .lib and .dll files. You can use the virtual box extensions to copy these files to the correct Windows folder: "opencv\3rdparty\lib".
Finally, in ffopencv.cpp, the following lines:
#pragma comment(lib, "libavformat64.a")
#pragma comment(lib, "libavcodec64.a")
#pragma comment(lib, "libavutil64.a")
...should be changed to:
#pragma comment(lib, "avformat-52.lib")
#pragma comment(lib, "avcodec-52.lib")
#pragma comment(lib, "avutil-50.lib")
#pragma comment(lib, "swscale-0.lib")
Now, everything will compile. However, you'll need the 5 ffmpeg dlls at runtime.
Could the above changes be integrated into the trunk, so that we'll have FFmpeg support on 64-bit Windows platforms?
Associated revisions
Merge pull request #677 from jet47:gpu-lut-fix
History
Updated by Drew Jetter over 14 years ago
Please ignore the steps above; I now have a way that doesn't involve .dlls.
The mingw-w64 developers have fixed mingw-w64, so now it can create 64-bit static libraries that MSVC can link to. I created a wiki page here that contains a script for building the libraries:
http://ffmpeg.arrozcru.org/wiki/index.php?title=Building_64-bit_static_libraries
Updated by Alexander Shishkov over 13 years ago
Fixed in #5466 revision. Thanks for your instructions!
- Status changed from Open to Done
- (deleted custom field) set to fixed
Updated by Andrey Kamaev over 12 years ago
- Category changed from highgui-images to highgui-video