openCV 2.1.0安装+ ffmpeg +错误

时间:2013-02-12 20:06:11

标签: ubuntu opencv ffmpeg

我想安装OpenCV 2.1.0(在Ubuntu 11.10上),但在make之后(我的步骤为make:http://www.doc.ic.ac.uk/~strasdat/rss2010videos/INSTALL.txt)我得到:

[ 45%] Built target opencv_lapack
[ 45%] Built target cxcore_pch_dephelp
[ 45%] Built target pch_Generate_cxcore
[ 45%] Built target flann
[ 47%] Built target zlib
[ 50%] Built target cxcore
[ 50%] Built target cv_pch_dephelp
[ 51%] Built target pch_Generate_cv
[ 61%] Built target cv
[ 61%] Built target highgui_pch_dephelp
[ 61%] Built target pch_Generate_highgui
[ 61%] Building CXX object src/highgui/CMakeFiles/highgui.dir/cvcap_ffmpeg.o
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp: In member function ‘virtual void CvCapture_FFMPEG::close()’:
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:403:9: warning: ‘void av_close_input_file(AVFormatContext*)’ is deprecated (declared at /usr/local/include/libavformat/avformat.h:1687) [-Wdeprecated-declarations]
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:403:31: warning: ‘void av_close_input_file(AVFormatContext*)’ is deprecated (declared at /usr/local/include/libavformat/avformat.h:1687) [-Wdeprecated-declarations]
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp: In member function ‘bool CvCapture_FFMPEG::reopen()’:
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:432:5: warning: ‘void av_close_input_file(AVFormatContext*)’ is deprecated (declared at /usr/local/include/libavformat/avformat.h:1687) [-Wdeprecated-declarations]
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:432:27: warning: ‘void av_close_input_file(AVFormatContext*)’ is deprecated (declared at /usr/local/include/libavformat/avformat.h:1687) [-Wdeprecated-declarations]
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:435:52: error: ‘av_open_input_file’ was not declared in this scope
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:436:5: warning: ‘int av_find_stream_info(AVFormatContext*)’ is deprecated (declared at /usr/local/include/libavformat/avformat.h:1511) [-Wdeprecated-declarations]
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:436:27: warning: ‘int av_find_stream_info(AVFormatContext*)’ is deprecated (declared at /usr/local/include/libavformat/avformat.h:1511) [-Wdeprecated-declarations]
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:443:5: warning: ‘int avcodec_open(AVCodecContext*, AVCodec*)’ is deprecated (declared at /usr/local/include/libavcodec/avcodec.h:3681) [-Wdeprecated-declarations]
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:443:28: warning: ‘int avcodec_open(AVCodecContext*, AVCodec*)’ is deprecated (declared at /usr/local/include/libavcodec/avcodec.h:3681) [-Wdeprecated-declarations]
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp: In member function ‘virtual bool CvCapture_FFMPEG::open(const char*)’:
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:468:63: error: ‘av_open_input_file’ was not declared in this scope
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:473:11: warning: ‘int av_find_stream_info(AVFormatContext*)’ is deprecated (declared at /usr/local/include/libavformat/avformat.h:1511) [-Wdeprecated-declarations]
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:473:33: warning: ‘int av_find_stream_info(AVFormatContext*)’ is deprecated (declared at /usr/local/include/libavformat/avformat.h:1511) [-Wdeprecated-declarations]
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:488:13: warning: ‘int avcodec_open(AVCodecContext*, AVCodec*)’ is deprecated (declared at /usr/local/include/libavcodec/avcodec.h:3681) [-Wdeprecated-declarations]
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:488:36: warning: ‘int avcodec_open(AVCodecContext*, AVCodec*)’ is deprecated (declared at /usr/local/include/libavcodec/avcodec.h:3681) [-Wdeprecated-declarations]
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp: In member function ‘virtual bool CvCapture_FFMPEG::grabFrame()’:
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:566:54: error: ‘avcodec_decode_video’ was not declared in this scope
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp: In function ‘const char* icvFFMPEGErrStr(int)’:
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:819:10: error: ‘AVERROR_NUMEXPECTED’ was not declared in this scope
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:823:10: error: ‘AVERROR_NOFMT’ was not declared in this scope
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:825:10: error: ‘AVERROR_IO’ was not declared in this scope
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:827:10: error: ‘AVERROR_NOMEM’ was not declared in this scope
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp: In function ‘AVStream* icv_add_video_stream_FFMPEG(AVFormatContext*, AVCodecID, int, int, int, double, int)’:
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:899:7: warning: ‘AVStream* av_new_stream(AVFormatContext*, int)’ is deprecated (declared at /usr/local/include/libavformat/avformat.h:1711) [-Wdeprecated-declarations]
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:899:26: warning: ‘AVStream* av_new_stream(AVFormatContext*, int)’ is deprecated (declared at /usr/local/include/libavformat/avformat.h:1711) [-Wdeprecated-declarations]
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp: In function ‘int icv_av_write_frame_FFMPEG(AVFormatContext*, AVStream*, uint8_t*, uint32_t, AVFrame*)’:
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:1011:22: error: ‘PKT_FLAG_KEY’ was not declared in this scope
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:1019:20: warning: ‘int avcodec_encode_video(AVCodecContext*, uint8_t*, int, const AVFrame*)’ is deprecated (declared at /usr/local/include/libavcodec/avcodec.h:4388) [-Wdeprecated-declarations]
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:1019:72: warning: ‘int avcodec_encode_video(AVCodecContext*, uint8_t*, int, const AVFrame*)’ is deprecated (declared at /usr/local/include/libavcodec/avcodec.h:4388) [-Wdeprecated-declarations]
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:1031:30: error: ‘PKT_FLAG_KEY’ was not declared in this scope
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp: In member function ‘virtual void CvVideoWriter_FFMPEG::close()’:
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:1195:20: error: ‘url_fclose’ was not declared in this scope
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp: In member function ‘virtual bool CvVideoWriter_FFMPEG::open(const char*, int, double, CvSize, bool)’:
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:1228:41: error: ‘guess_format’ was not declared in this scope
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:1251:31: error: ‘av_alloc_format_context’ was not declared in this scope
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:1292:35: error: ‘av_set_parameters’ was not declared in this scope
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:1296:35: error: ‘dump_format’ was not declared in this scope
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:1321:15: warning: ‘int avcodec_open(AVCodecContext*, AVCodec*)’ is deprecated (declared at /usr/local/include/libavcodec/avcodec.h:3681) [-Wdeprecated-declarations]
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:1321:36: warning: ‘int avcodec_open(AVCodecContext*, AVCodec*)’ is deprecated (declared at /usr/local/include/libavcodec/avcodec.h:3681) [-Wdeprecated-declarations]
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:1358:42: error: ‘URL_WRONLY’ was not declared in this scope
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:1358:52: error: ‘url_fopen’ was not declared in this scope
.../OpenCV-2.1.0/src/highgui/cvcap_ffmpeg.cpp:1364:25: error: ‘av_write_header’ was not declared in this scope
make[2]: *** [src/highgui/CMakeFiles/highgui.dir/cvcap_ffmpeg.o] Chyba 1
make[1]: *** [src/highgui/CMakeFiles/highgui.dir/all] Chyba 2
make: *** [all] Chyba 2

我在cvcap_ffmpeg.cpp文件中添加了这个:

#ifndef UINT64_C
#define UINT64_C(c) (c ## ULL)
#endif

#if LIBAVCODEC_VERSION_MAJOR < 53
#define CodecType AVMediaType

#define CODEC_TYPE_UNKNOWN    AVMEDIA_TYPE_UNKNOWN
#define CODEC_TYPE_VIDEO      AVMEDIA_TYPE_VIDEO
#define CODEC_TYPE_AUDIO      AVMEDIA_TYPE_AUDIO
#define CODEC_TYPE_DATA       AVMEDIA_TYPE_DATA
#define CODEC_TYPE_SUBTITLE   AVMEDIA_TYPE_SUBTITLE
#define CODEC_TYPE_ATTACHMENT AVMEDIA_TYPE_ATTACHMENT
#define CODEC_TYPE_NB         AVMEDIA_TYPE_NB
#endif 

以前解决了一些问题。

我尝试像这里安装ffmpeg - &gt; https://ffmpeg.org/trac/ffmpeg/wiki/UbuntuCompilationGuide,但它没有变化。 有人可以帮我解决这些错误吗?

感谢

1 个答案:

答案 0 :(得分:0)

我得到了答案 https://code.ros.org/trac/opencv/ticket/1020 尝试两个补丁