Error building OpenCV 3.0.0 with FFMPEG
Hello,
This is my first question on this forum. 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 :
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
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....
However without ffmpeg support it works fine. However I need ffmpeg support due to the nature of my work.
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
inking 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
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/
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.
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.
Regards
Ujjwal
Have you tried with installing the ffmpeg-devel package ?
Hello., I did not, because I do not have root permissions on the cluster. However I did compile ffmpeg from source as specified in the question. I installed in #{HOME} and in my ~/.bashrc file I did export ${HOME}/lib as the LD_LIBRARY_PATH. I can see relevant header files in $HOME/include and library files in $HOME/lib