一个解决OpenCV ffmpeg的链接错误的解决方法
来源:互联网 发布:中国农大网络远程教育 编辑:程序博客网 时间:2024/05/19 04:04
Visual Studio 2008 Win64: FFmpeg support
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?
- 一个解决OpenCV ffmpeg的链接错误的解决方法
- 记录一个编译链接错误的解决方法
- 一个链接error LNK2019错误的解决方法
- 记录一个QT+Opencv+Cmake的错误的解决
- 使用ffmpeg的库 链接错误, LNK2019
- 今天解决的一个mtk modis vc 链接lib错误
- 解决OpenCV 1.0.0在linux下编译ffmpeg有关例程时的错误
- Ubuntu16.04 安装OpenCV 错误解决 ffmpeg
- 一个奇怪的链接错误
- 解决编译ffmpeg时的错误
- [vc]关于链接错误的解决方法
- C++ Builder链接错误的解决方法
- 链接时出现LNK2001错误的解决方法
- SAE的一个错误解决方法
- Qt一个错误的解决方法
- 链接数据库时80004005错误的解决
- VS2008有关 LNK1000链接错误的解决
- Linux共享链接库错误的解决
- JavaWeb那些事儿(二)--java中类、成员和方法的访问权限
- 2010嵌入式归渊--收集的命令
- Linux用户空间与内核空间
- init 5和startx的区别
- 红帽CEO:员工经常当面叫我笨蛋
- 一个解决OpenCV ffmpeg的链接错误的解决方法
- RHEL6 命令行下安装图形桌面
- aop自定义切面
- 第五周项目1.4-三角形类雏形
- IntentService
- How to build qemu-system-arm in Linux
- Activity 的 LaunchMode
- ARM汇编调试
- Using QEMU for Embedded Systems Development, Part 1