安装opencv2.4.1报错cap_ffmpeg_impl.hpp error 1

编译安装openCV2.4.1,遇到

/opencv-2.4.1/modules/highgui/src/cap_ffmpeg_impl.hpp:845:10: error: use of enum ‘CodecID’ without previous declaration

...

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

网上查了很多解决办法都没有用,后根据一个评论提到的修改cap_ffmpeg_impl.hpp成功

http://answers.opencv.org/question/12597/build-problems-for-opencv-241-with-ubuntu-1204-lts/

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 :-)

/opencv-2.4.1/modules/highgui/src/cap_ffmpeg_impl.hpp中CodecID替换为AVCodecID,编译通过。

你可能感兴趣的:(opencv)