OpenCV 3.0.0使用FFMPEG出错 [英] OpenCV 3.0.0 make error with FFMPEG

查看:2479
本文介绍了OpenCV 3.0.0使用FFMPEG出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用OpenCV。但是我最近改变了我的系统到一个集群,我没有任何管理员权限。问题是这样的:

I have been using OpenCV for a while. However I have recently changed my system to a cluster where I do not have any admin permission. The problem is like this :

在我的主文件夹中,我安装了FFMPEG(最新的稳定版本可在ffmpeg网站上)。我在$ HOME中安装它,因此在$ HOME / lib中安装了库文件。有关更多信息,我编译FFMPEG与以下选项:

In my home folder, I installed FFMPEG (latest stable version available on ffmpeg site). I installed it in $HOME, and so in $HOME/lib there are the library files installed. For more information I compiled FFMPEG with following options :

./configure --prefix=$HOME --enable-shared --enable-pic

然后我下载了最新的稳定版本的OpenCV 3.0.0并使用ccmake配置。当我尝试 make -j8 时,它会给我以下错误。

I then downloaded the latest stable version of OpenCV 3.0.0 and configured it using ccmake. When I try to make -j8, it gives me the following error.

 Scanning dependencies of target opencv_videoio
[ 63%] [ 63%] [ 63%] [ 63%] [ 63%] [ 63%] Building CXX object modules/videoio/CMakeFiles/opencv_videoio.dir/src/cap.cpp.o
Building CXX object modules/videoio/CMakeFiles/opencv_videoio.dir/src/cap_mjpeg_decoder.cpp.o
Building CXX object modules/videoio/CMakeFiles/opencv_videoio.dir/src/cap_images.cpp.o
Building CXX object modules/videoio/CMakeFiles/opencv_videoio.dir/src/cap_v4l.cpp.o
Building CXX object modules/videoio/CMakeFiles/opencv_videoio.dir/src/cap_mjpeg_encoder.cpp.o
Building CXX object modules/videoio/CMakeFiles/opencv_videoio.dir/src/cap_ffmpeg.cpp.o
In file included from /home/uujjwal/libraries/opencv-nogpu/opencv-3.0.0/modules/videoio/src/cap_ffmpeg.cpp:45:0:
/home/uujjwal/libraries/opencv-nogpu/opencv-3.0.0/modules/videoio/src/cap_ffmpeg_impl.hpp:1546:71: error: use of enum 'AVCodecID' without previous declaration
/home/uujjwal/libraries/opencv-nogpu/opencv-3.0.0/modules/videoio/src/cap_ffmpeg_impl.hpp:1556:83: error: use of enum 'AVCodecID' without previous declaration
make[2]: *** [modules/videoio/CMakeFiles/opencv_videoio.dir/src/cap_ffmpeg.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....

然而没有ffmpeg支持它工作正常。然而,由于我的工作性质,我需要ffmpeg支持。

However without ffmpeg support it works fine. However I need ffmpeg support due to the nature of my work.

在尝试解决这个问题,我试图安装OpenCV 2.4.11,但它也给出了这个错误。最新的GIT版本不会给我这个错误,而是一个错误,它的一部分像这样

In trying to resolve the problem, I tried installing OpenCV 2.4.11 but it also gave this error. The latest GIT version does not give me this error but rather an error a part of which goes like this

Linking CXX shared library ../../lib/libopencv_highgui.so /usr/bin/ld: /home/matheus/ffmpeg_build/lib/../lib/libavcodec.a(avpacket.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used

我从另一个未解决的问题在线粘贴了上述错误,但是重定位错误是完全相同的。

I have pasted the above error from another unresolved question online and so the folder names are different but the relocation error is exactly the same.

在尝试解决问题,我搜索,并找到以下链接 http://answers.opencv.org/question/12597/build-problems -for-opencv-241-with-ubuntu-1204-lts /

In trying to resolve the problem I searched and found the following link http://answers.opencv.org/question/12597/build-problems-for-opencv-241-with-ubuntu-1204-lts/

然而,其中的一个答案提到了改变cap_ffmpeg_impl.hpp中的一些行文件。我试着这样做,但是我无法正确地做,或者其他的东西出了问题,它不工作。

However, one of the answers over there mentioned changing some lines in cap_ffmpeg_impl.hpp file. I tried doing that but either i am not able to do it correctly or something else is going wrong and it is not working. Exact line numbers and exact changes are not mentioned and so I am having difficulty changing things and being sure.

我使用Fedora 19(Schrodinger Cat)作为操作系统希望我的问题的细节是清楚的,我希望社区会责成我很好的回应。

I am using Fedora 19 (Schrodinger Cat) as the operating system I hope the details of my question are clear and I hope that the community would oblige me with a good response.

尊敬的
Ujjwal

Regards Ujjwal

推荐答案

我遇到了这一点,试图在Ubuntu 12.04上构建OpenCV 3.0.0。这个问题似乎是OpenCV中的一个错误。我编辑了opencv-3.0.0 / modules / videoio / src / cap_ffmpeg_impl.hpp,将 AVCodecID 替换为 CV_CODEC_ID 但是 #define - 在行1174(可选),1546和1556中,并且构建工作。

I ran into this as well trying to build OpenCV 3.0.0 on Ubuntu 12.04. The problem appears to be a bug in OpenCV. I edited opencv-3.0.0/modules/videoio/src/cap_ffmpeg_impl.hpp, replacing AVCodecID with CV_CODEC_ID in all places but the #define -- in lines 1174 (optional), 1546, and 1556 -- and the build worked.

有关详情,请参阅OpenCV问题跟踪器上的帖子。作为提交的一部分,该错误已在我的帖子之前修复在OpenCV主分支上。

For more details, see my post on the OpenCV issue tracker. And the bug had been fixed on the OpenCV master branch prior to my post as part of this commit.

这篇关于OpenCV 3.0.0使用FFMPEG出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆