OpenCV 3.0.0 makes a mistake with FFMPEG

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

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

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

Then I downloaded the latest stable version of OpenCV 3.0.0 and configured it using ccmake. When I try 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.

While trying to solve the problem, I tried to install OpenCV 2.4.11, but also gave this error. The latest version of GIT does not give me this error, but rather an error, part of which looks like

 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 inserted the above error from another unresolved issue on the Internet, and so the folder names are different, but the move error is exactly the same.

While trying to solve 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 mentioned changing some lines in the cap_ffmpeg_impl.hpp file. I tried to do this, but either I cannot do it right, or something else is wrong and it is not working. Exact line numbers and exact changes are not mentioned, so it's hard for me to change things and be sure.

I am using Fedora 19 (Schrodinger Cat) as the operating system. I hope the details of my question are clear, and I hope the community has committed me with a good answer.

Relations Ujjwal

+5
source share
3 answers

I came across this while trying to create OpenCV 3.0.0 on Ubuntu 12.04. The problem is an error 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 #define on lines 1174 (optional), 1546 and 1556 - and the assembly worked.

For more details, see the post in the tracker on the OpenCV issue. And the error was fixed on the main OpenCV branch before my post as part of this commit.

+10
source

Assuming you are not using FFMPEG with OpenCV, you can disable its compilation:

When you start Cmake i.e. when you did it:

 cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local \ -D PYTHON2_PACKAGES_PATH=~/.virtualenvs/cv/lib/python2.7/site-packages \ -D PYTHON2_LIBRARY=/usr/local/Cellar/python/2.7.10/Frameworks/Python.framework/Versions/2.7/bin \ -D PYTHON2_INCLUDE_DIR=/usr/local/Frameworks/Python.framework/Headers \ -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON \ -D BUILD_EXAMPLES=ON \ -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules .. 

Add this flag to the mix -DWITH_FFMPEG = 0 so as not to compile part of FFMPEG

+1
source

This version supports ffmpeg

 conda install --channel conda-forge 
0
source

All Articles