Ask Your Question
0

Build problems for openCV 2.4.1 with Ubuntu 12.04 LTS

asked 2013-04-28 07:30:09 -0600

Edge84 gravatar image

updated 2013-04-28 08:17:25 -0600

Hi!

I'm about to install OpenCV 2.4.1 on Ubuntu 12.04 LTS and during the build process some errors show up:

In file included from /home/thomas/OpenCV-2.4.1/modules/highgui/src/cap_ffmpeg.cpp:45:0:
/home/thomas/OpenCV-2.4.1/modules/highgui/src/cap_ffmpeg_impl.hpp:845:10: error: use of enum ‘CodecID’ without previous declaration
/home/thomas/OpenCV-2.4.1/modules/highgui/src/cap_ffmpeg_impl.hpp:845:52: error: invalid type in declaration before ‘;’ token
/home/thomas/OpenCV-2.4.1/modules/highgui/src/cap_ffmpeg_impl.hpp:897:46: error: ‘CodecID’ has not been declared
/home/thomas/OpenCV-2.4.1/modules/highgui/src/cap_ffmpeg_impl.hpp: In function ‘AVStream* icv_add_video_stream_FFMPEG(AVFormatContext*, int, int, int, int, double, int)’:
/home/thomas/OpenCV-2.4.1/modules/highgui/src/cap_ffmpeg_impl.hpp:930:23: error: invalid conversion from ‘int’ to ‘AVCodecID’ [-fpermissive]
In file included from /home/thomas/OpenCV-2.4.1/modules/highgui/src/cap_ffmpeg.cpp:45:0:
/home/thomas/OpenCV-2.4.1/modules/highgui/src/cap_ffmpeg_impl.hpp: In member function ‘bool CvVideoWriter_FFMPEG::open(const char*, int, double, int, int, bool)’:
/home/thomas/OpenCV-2.4.1/modules/highgui/src/cap_ffmpeg_impl.hpp:1276:5: error: ‘CodecID’ was not declared in this scope
/home/thomas/OpenCV-2.4.1/modules/highgui/src/cap_ffmpeg_impl.hpp:1276:13: error: expected ‘;’ before ‘codec_id’
/home/thomas/OpenCV-2.4.1/modules/highgui/src/cap_ffmpeg_impl.hpp:1321:10: error: ‘codec_id’ was not declared in this scope
/home/thomas/OpenCV-2.4.1/modules/highgui/src/cap_ffmpeg_impl.hpp:1341:13: error: ‘codec_id’ was not declared in this scope
/home/thomas/OpenCV-2.4.1/modules/highgui/src/cap_ffmpeg_impl.hpp:1370:48: error: ‘codec_id’ was not declared in this scope
make[2]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/src/cap_ffmpeg.cpp.o] Error 1
make[1]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/all] Error 2
make: *** [all] Error 2

Anyone who have an idea about how to correct this or experienced the same errors? I have tried to see if there are some missed includes somewhere but can't find anything.

Thanks!

Regards Thomas

edit retag flag offensive close merge delete

3 answers

Sort by » oldest newest most voted
1

answered 2014-03-27 07:47:49 -0600

kapraf gravatar image

This error occurs when Opencv and ffmpeg are not fully compatible. In new ffmpeg version CodecID was replaced with AVCodecID so go to your cap_ffmpeg_impl.hpp file and change all occurences of CodecID to AVCodecID. In my case it was three lines. Restart the compilation of openCV and you should be fine :-)

edit flag offensive delete link more
0

answered 2013-04-28 08:24:11 -0600

Like mentioned in this you need to build ffmpeg first before building openCV. I urge you to follow this guide and then see of the problem still exists.

Another usefull guide could be this one.

edit flag offensive delete link more
0

answered 2014-11-21 07:04:13 -0600

hamidsani gravatar image

I had the same problem at first. Ended up building ffmpeg from source and it was all fixed. Follow these instructions: http://superuser.com/questions/286675/how-to-install-ffmpeg-on-debian

edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-04-28 07:30:09 -0600

Seen: 12,066 times

Last updated: Nov 21 '14