How to enable compilation of OpenCV 2.3.1 on Ubuntu 11.10 due to FFmpeg

Possible duplicate:
compile opencv2.3.1 in ubuntu 11.10

How did you prepare your environment to compile OpenCV 2.3.1 correctly on Ubuntu 11.10?

I am following the OpenCV installation guide , but the instructions are complex.

However, I remade it into the following script:

sudo apt-get install --yes cmake libjpeg62 libjpeg62-dev libtiff4 libtiff4-dev libjasper1 libjasper-dev libpng12-0 libpng12-dev libavformat-dev libswscale-dev openexr zlibc zlib1g zlib1g-dev python2.7-dev libgtk-3-dev gcc g++ libtbb-dev
cd /tmp
wget --output-document=OpenCV-2.3.1a.tar.bz2 http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.3.1/OpenCV-2.3.1a.tar.bz2/download?use_mirror=iweb
tar -xvjf OpenCV-2.3.1a.tar.bz2
cd OpenCV-2.3.1
mkdir release
cd release
time cmake -D WITH_TBB=ON -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_PYTHON_SUPPORT=ON -D BUILD_EXAMPLES=ON ..
time make

      

Everything works well, except, of course, for make

which exits with an error:

/tmp/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:1339:41: error: β€˜guess_format’ was not declared in this scope
/tmp/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:1367:31: error: β€˜av_alloc_format_context’ was not declared in this scope
/tmp/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:1411:9: warning: β€˜int av_set_parameters(AVFormatContext*, AVFormatParameters*)’ is deprecated (declared at /usr/include/libavformat/avformat.h:1363) [-Wdeprecated-declarations]
/tmp/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:1411:35: warning: β€˜int av_set_parameters(AVFormatContext*, AVFormatParameters*)’ is deprecated (declared at /usr/include/libavformat/avformat.h:1363) [-Wdeprecated-declarations]
/tmp/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:1415:5: warning: β€˜void dump_format(AVFormatContext*, int, const char*, int)’ is deprecated (declared at /usr/include/libavformat/avformat.h:1485) [-Wdeprecated-declarations]
/tmp/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:1415:35: warning: β€˜void dump_format(AVFormatContext*, int, const char*, int)’ is deprecated (declared at /usr/include/libavformat/avformat.h:1485) [-Wdeprecated-declarations]
/tmp/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:1442:15: warning: β€˜int avcodec_open(AVCodecContext*, AVCodec*)’ is deprecated (declared at /usr/include/libavcodec/avcodec.h:3650) [-Wdeprecated-declarations]
/tmp/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:1442:36: warning: β€˜int avcodec_open(AVCodecContext*, AVCodec*)’ is deprecated (declared at /usr/include/libavcodec/avcodec.h:3650) [-Wdeprecated-declarations]
/tmp/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:1479:13: warning: β€˜int url_fopen(AVIOContext**, const char*, int)’ is deprecated (declared at /usr/include/libavformat/avio.h:278) [-Wdeprecated-declarations]
/tmp/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:1479:52: warning: β€˜int url_fopen(AVIOContext**, const char*, int)’ is deprecated (declared at /usr/include/libavformat/avio.h:278) [-Wdeprecated-declarations]
/tmp/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:1485:5: warning: β€˜int av_write_header(AVFormatContext*)’ is deprecated (declared at /usr/include/libavformat/avformat.h:1421) [-Wdeprecated-declarations]
/tmp/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:1485:25: warning: β€˜int av_write_header(AVFormatContext*)’ is deprecated (declared at /usr/include/libavformat/avformat.h:1421) [-Wdeprecated-declarations]
make[2]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/src/cap_ffmpeg.o] Error 1
make[1]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/all] Error 2
make: *** [all] Error 2

      

How do I resolve this error?

+3


source to share


1 answer


I think you don't have any good ffmpeg libraries. There are at least two solutions. If you need ffmpeg try installing it using:

sudo apt-get install libavformat-dev libswscale-dev 

      

If you don't need to use ffmpeg in your openCV applications, you can try to disable it:



WITH_FFMPEG=OFF WITH_GSTREAMER=OFF

      

to your cmake config line.

Greetings,

+2


source







All Articles