PDA

View Full Version : [ubuntu] Compile Errors from OpenCV with ffmpeg + x264



wind_field
May 29th, 2011, 06:56 PM
Dear My Friends,

I am trying to compile OpenCV 2.0 with ffmpeg (with x264) support on my Ubuntu 11.04 64-bit machine. (Since I want to use the binaries provided by other developers, I have to use opencv 2.0 version)

I followed the guide from: http://ubuntuforums.org/showthread.php?t=786095 to compile x264 and ffmpeg manually, and succeeded.

Then I followed the guide in the INSTALL file provided by the OpenCV 2.0 package. I use CMake to configure and generate them, and use "make" command to try compiling. However, I got the following error report, which haunted me for almost half a week.


Linking CXX static library ../../lib/libhighgui_pch_dephelp.a
[ 71%] Built target highgui_pch_dephelp
Scanning dependencies of target pch_Generate_highgui
[ 71%] Generating _highgui.h
[ 71%] Generating _highgui.h.gch/highgui_Release.gch
[ 72%] Built target pch_Generate_highgui
Scanning dependencies of target highgui
[ 73%] Building CXX object src/highgui/CMakeFiles/highgui.dir/cvcap.o
[ 73%] Building CXX object src/highgui/CMakeFiles/highgui.dir/cvcap_images.o
[ 73%] Building CXX object src/highgui/CMakeFiles/highgui.dir/image.o
[ 73%] Building CXX object src/highgui/CMakeFiles/highgui.dir/loadsave.o
[ 73%] Building CXX object src/highgui/CMakeFiles/highgui.dir/precomp.o
[ 73%] Building CXX object src/highgui/CMakeFiles/highgui.dir/utils.o
[ 74%] Building CXX object src/highgui/CMakeFiles/highgui.dir/window.o
[ 74%] Building CXX object src/highgui/CMakeFiles/highgui.dir/cvcap_ffmpeg.o
In file included from /usr/local/include/libavutil/avutil.h:119:0,
from /usr/local/include/libavutil/samplefmt.h:22,
from /usr/local/include/libavcodec/avcodec.h:30,
from /usr/local/include/libavformat/avformat.h:42,
from /home/jimmy/OpenCV-2.0.0/src/highgui/cvcap_ffmpeg.cpp:97:
/usr/local/include/libavutil/common.h: In function ‘int32_t av_clipl_int32_c(int64_t)’:
/usr/local/include/libavutil/common.h:170:47: error: ‘UINT64_C’ was not declared in this scope
/home/jimmy/OpenCV-2.0.0/src/highgui/cvcap_ffmpeg.cpp: In member function ‘virtual bool CvCapture_FFMPEG::open(const char*)’:
/home/jimmy/OpenCV-2.0.0/src/highgui/cvcap_ffmpeg.cpp:467:13: error: ‘CODEC_TYPE_VIDEO’ was not declared in this scope
/home/jimmy/OpenCV-2.0.0/src/highgui/cvcap_ffmpeg.cpp: In member function ‘virtual bool CvCapture_FFMPEG::grabFrame()’:
/home/jimmy/OpenCV-2.0.0/src/highgui/cvcap_ffmpeg.cpp:548:54: error: ‘avcodec_decode_video’ was not declared in this scope
/home/jimmy/OpenCV-2.0.0/src/highgui/cvcap_ffmpeg.cpp: In function ‘const char* icvFFMPEGErrStr(int)’:
/home/jimmy/OpenCV-2.0.0/src/highgui/cvcap_ffmpeg.cpp:790:10: error: ‘AVERROR_NUMEXPECTED’ was not declared in this scope
/home/jimmy/OpenCV-2.0.0/src/highgui/cvcap_ffmpeg.cpp:794:10: error: ‘AVERROR_NOFMT’ was not declared in this scope
/home/jimmy/OpenCV-2.0.0/src/highgui/cvcap_ffmpeg.cpp:796:10: error: ‘AVERROR_IO’ was not declared in this scope
/home/jimmy/OpenCV-2.0.0/src/highgui/cvcap_ffmpeg.cpp:798:10: error: ‘AVERROR_NOMEM’ was not declared in this scope
/home/jimmy/OpenCV-2.0.0/src/highgui/cvcap_ffmpeg.cpp: In function ‘AVStream* icv_add_video_stream_FFMPEG(AVFormatContext*, CodecID, int, int, int, double, int)’:
/home/jimmy/OpenCV-2.0.0/src/highgui/cvcap_ffmpeg.cpp:883:70: error: ‘CODEC_TYPE_VIDEO’ was not declared in this scope
/home/jimmy/OpenCV-2.0.0/src/highgui/cvcap_ffmpeg.cpp: In function ‘int icv_av_write_frame_FFMPEG(AVFormatContext*, AVStream*, uint8_t*, uint32_t, AVFrame*)’:
/home/jimmy/OpenCV-2.0.0/src/highgui/cvcap_ffmpeg.cpp:982:22: error: ‘PKT_FLAG_KEY’ was not declared in this scope
/home/jimmy/OpenCV-2.0.0/src/highgui/cvcap_ffmpeg.cpp:1002:30: error: ‘PKT_FLAG_KEY’ was not declared in this scope
/home/jimmy/OpenCV-2.0.0/src/highgui/cvcap_ffmpeg.cpp: In member function ‘virtual void CvVideoWriter_FFMPEG::close()’:
/home/jimmy/OpenCV-2.0.0/src/highgui/cvcap_ffmpeg.cpp:1162:3: warning: ‘int url_fclose(AVIOContext*)’ is deprecated (declared at /usr/local/include/libavformat/avio.h:280)
/home/jimmy/OpenCV-2.0.0/src/highgui/cvcap_ffmpeg.cpp:1162:20: warning: ‘int url_fclose(AVIOContext*)’ is deprecated (declared at /usr/local/include/libavformat/avio.h:280)
/home/jimmy/OpenCV-2.0.0/src/highgui/cvcap_ffmpeg.cpp: In member function ‘virtual bool CvVideoWriter_FFMPEG::open(const char*, int, double, CvSize, bool)’:
/home/jimmy/OpenCV-2.0.0/src/highgui/cvcap_ffmpeg.cpp:1199:41: error: ‘guess_format’ was not declared in this scope
/home/jimmy/OpenCV-2.0.0/src/highgui/cvcap_ffmpeg.cpp:1213:31: error: ‘av_alloc_format_context’ was not declared in this scope
/home/jimmy/OpenCV-2.0.0/src/highgui/cvcap_ffmpeg.cpp:1270:9: warning: ‘int av_set_parameters(AVFormatContext*, AVFormatParameters*)’ is deprecated (declared at /usr/local/include/libavformat/avformat.h:1334)
/home/jimmy/OpenCV-2.0.0/src/highgui/cvcap_ffmpeg.cpp:1270:35: warning: ‘int av_set_parameters(AVFormatContext*, AVFormatParameters*)’ is deprecated (declared at /usr/local/include/libavformat/avformat.h:1334)
/home/jimmy/OpenCV-2.0.0/src/highgui/cvcap_ffmpeg.cpp:1274:5: warning: ‘void dump_format(AVFormatContext*, int, const char*, int)’ is deprecated (declared at /usr/local/include/libavformat/avformat.h:1434)
/home/jimmy/OpenCV-2.0.0/src/highgui/cvcap_ffmpeg.cpp:1274:35: warning: ‘void dump_format(AVFormatContext*, int, const char*, int)’ is deprecated (declared at /usr/local/include/libavformat/avformat.h:1434)
/home/jimmy/OpenCV-2.0.0/src/highgui/cvcap_ffmpeg.cpp:1336:13: warning: ‘int url_fopen(AVIOContext**, const char*, int)’ is deprecated (declared at /usr/local/include/libavformat/avio.h:279)
/home/jimmy/OpenCV-2.0.0/src/highgui/cvcap_ffmpeg.cpp:1336:52: warning: ‘int url_fopen(AVIOContext**, const char*, int)’ is deprecated (declared at /usr/local/include/libavformat/avio.h:279)
make[2]: *** [src/highgui/CMakeFiles/highgui.dir/cvcap_ffmpeg.o] Error 1
make[1]: *** [src/highgui/CMakeFiles/highgui.dir/all] Error 2
make: *** [all] Error 2

For you further information, I have used the latest code from x264 and ffmpeg git, and opencv2.0 from sourceforge.net

I have googled for a while but just cannot find a right solution to me. I know this similar compiling errors have been posted for many times, but different versions might have different fixes. So I hope any of you could help in this. Thank you in advance.

Regards,
Jingming

wind_field
May 29th, 2011, 06:59 PM
It seems some tags in the code segments are not displayed correctly. Plz ignore the tags like . Thank you.

wind_field
May 30th, 2011, 12:04 AM
Is there anyone who can help on this?

milk3dfx
May 31st, 2011, 03:59 PM
Hi
I have the same error and don't know what to do.

milk3dfx
June 2nd, 2011, 01:11 AM
I installed OpenCV on 10.4 with out any errors.

hnkulkarni
July 29th, 2011, 02:17 AM
I am also stuck in the same error. Were you able to solve it ?
Any help or pointers regarding this will be very useful.

Regards,
Hrushikesh


Dear My Friends,

I am trying to compile OpenCV 2.0 with ffmpeg (with x264) support on my Ubuntu 11.04 64-bit machine. (Since I want to use the binaries provided by other developers, I have to use opencv 2.0 version)

I followed the guide from: http://ubuntuforums.org/showthread.php?t=786095 to compile x264 and ffmpeg manually, and succeeded.

Then I followed the guide in the INSTALL file provided by the OpenCV 2.0 package. I use CMake to configure and generate them, and use "make" command to try compiling. However, I got the following error report, which haunted me for almost half a week.


Linking CXX static library ../../lib/libhighgui_pch_dephelp.a
[ 71%] Built target highgui_pch_dephelp
Scanning dependencies of target pch_Generate_highgui
[ 71%] Generating _highgui.h
[ 71%] Generating _highgui.h.gch/highgui_Release.gch
[ 72%] Built target pch_Generate_highgui
Scanning dependencies of target highgui
[ 73%] Building CXX object src/highgui/CMakeFiles/highgui.dir/cvcap.o
[ 73%] Building CXX object src/highgui/CMakeFiles/highgui.dir/cvcap_images.o
[ 73%] Building CXX object src/highgui/CMakeFiles/highgui.dir/image.o
[ 73%] Building CXX object src/highgui/CMakeFiles/highgui.dir/loadsave.o
[ 73%] Building CXX object src/highgui/CMakeFiles/highgui.dir/precomp.o
[ 73%] Building CXX object src/highgui/CMakeFiles/highgui.dir/utils.o
[ 74%] Building CXX object src/highgui/CMakeFiles/highgui.dir/window.o
[ 74%] Building CXX object src/highgui/CMakeFiles/highgui.dir/cvcap_ffmpeg.o
In file included from /usr/local/include/libavutil/avutil.h:119:0,
from /usr/local/include/libavutil/samplefmt.h:22,
from /usr/local/include/libavcodec/avcodec.h:30,
from /usr/local/include/libavformat/avformat.h:42,
from /home/jimmy/OpenCV-2.0.0/src/highgui/cvcap_ffmpeg.cpp:97:
/usr/local/include/libavutil/common.h: In function ‘int32_t av_clipl_int32_c(int64_t)’:
/usr/local/include/libavutil/common.h:170:47: error: ‘UINT64_C’ was not declared in this scope
/home/jimmy/OpenCV-2.0.0/src/highgui/cvcap_ffmpeg.cpp: In member function ‘virtual bool CvCapture_FFMPEG::open(const char*)’:
/home/jimmy/OpenCV-2.0.0/src/highgui/cvcap_ffmpeg.cpp:467:13: error: ‘CODEC_TYPE_VIDEO’ was not declared in this scope
/home/jimmy/OpenCV-2.0.0/src/highgui/cvcap_ffmpeg.cpp: In member function ‘virtual bool CvCapture_FFMPEG::grabFrame()’:
/home/jimmy/OpenCV-2.0.0/src/highgui/cvcap_ffmpeg.cpp:548:54: error: ‘avcodec_decode_video’ was not declared in this scope
/home/jimmy/OpenCV-2.0.0/src/highgui/cvcap_ffmpeg.cpp: In function ‘const char* icvFFMPEGErrStr(int)’:
/home/jimmy/OpenCV-2.0.0/src/highgui/cvcap_ffmpeg.cpp:790:10: error: ‘AVERROR_NUMEXPECTED’ was not declared in this scope
/home/jimmy/OpenCV-2.0.0/src/highgui/cvcap_ffmpeg.cpp:794:10: error: ‘AVERROR_NOFMT’ was not declared in this scope
/home/jimmy/OpenCV-2.0.0/src/highgui/cvcap_ffmpeg.cpp:796:10: error: ‘AVERROR_IO’ was not declared in this scope
/home/jimmy/OpenCV-2.0.0/src/highgui/cvcap_ffmpeg.cpp:798:10: error: ‘AVERROR_NOMEM’ was not declared in this scope
/home/jimmy/OpenCV-2.0.0/src/highgui/cvcap_ffmpeg.cpp: In function ‘AVStream* icv_add_video_stream_FFMPEG(AVFormatContext*, CodecID, int, int, int, double, int)’:
/home/jimmy/OpenCV-2.0.0/src/highgui/cvcap_ffmpeg.cpp:883:70: error: ‘CODEC_TYPE_VIDEO’ was not declared in this scope
/home/jimmy/OpenCV-2.0.0/src/highgui/cvcap_ffmpeg.cpp: In function ‘int icv_av_write_frame_FFMPEG(AVFormatContext*, AVStream*, uint8_t*, uint32_t, AVFrame*)’:
/home/jimmy/OpenCV-2.0.0/src/highgui/cvcap_ffmpeg.cpp:982:22: error: ‘PKT_FLAG_KEY’ was not declared in this scope
/home/jimmy/OpenCV-2.0.0/src/highgui/cvcap_ffmpeg.cpp:1002:30: error: ‘PKT_FLAG_KEY’ was not declared in this scope
/home/jimmy/OpenCV-2.0.0/src/highgui/cvcap_ffmpeg.cpp: In member function ‘virtual void CvVideoWriter_FFMPEG::close()’:
/home/jimmy/OpenCV-2.0.0/src/highgui/cvcap_ffmpeg.cpp:1162:3: warning: ‘int url_fclose(AVIOContext*)’ is deprecated (declared at /usr/local/include/libavformat/avio.h:280)
/home/jimmy/OpenCV-2.0.0/src/highgui/cvcap_ffmpeg.cpp:1162:20: warning: ‘int url_fclose(AVIOContext*)’ is deprecated (declared at /usr/local/include/libavformat/avio.h:280)
/home/jimmy/OpenCV-2.0.0/src/highgui/cvcap_ffmpeg.cpp: In member function ‘virtual bool CvVideoWriter_FFMPEG::open(const char*, int, double, CvSize, bool)’:
/home/jimmy/OpenCV-2.0.0/src/highgui/cvcap_ffmpeg.cpp:1199:41: error: ‘guess_format’ was not declared in this scope
/home/jimmy/OpenCV-2.0.0/src/highgui/cvcap_ffmpeg.cpp:1213:31: error: ‘av_alloc_format_context’ was not declared in this scope
/home/jimmy/OpenCV-2.0.0/src/highgui/cvcap_ffmpeg.cpp:1270:9: warning: ‘int av_set_parameters(AVFormatContext*, AVFormatParameters*)’ is deprecated (declared at /usr/local/include/libavformat/avformat.h:1334)
/home/jimmy/OpenCV-2.0.0/src/highgui/cvcap_ffmpeg.cpp:1270:35: warning: ‘int av_set_parameters(AVFormatContext*, AVFormatParameters*)’ is deprecated (declared at /usr/local/include/libavformat/avformat.h:1334)
/home/jimmy/OpenCV-2.0.0/src/highgui/cvcap_ffmpeg.cpp:1274:5: warning: ‘void dump_format(AVFormatContext*, int, const char*, int)’ is deprecated (declared at /usr/local/include/libavformat/avformat.h:1434)
/home/jimmy/OpenCV-2.0.0/src/highgui/cvcap_ffmpeg.cpp:1274:35: warning: ‘void dump_format(AVFormatContext*, int, const char*, int)’ is deprecated (declared at /usr/local/include/libavformat/avformat.h:1434)
/home/jimmy/OpenCV-2.0.0/src/highgui/cvcap_ffmpeg.cpp:1336:13: warning: ‘int url_fopen(AVIOContext**, const char*, int)’ is deprecated (declared at /usr/local/include/libavformat/avio.h:279)
/home/jimmy/OpenCV-2.0.0/src/highgui/cvcap_ffmpeg.cpp:1336:52: warning: ‘int url_fopen(AVIOContext**, const char*, int)’ is deprecated (declared at /usr/local/include/libavformat/avio.h:279)
make[2]: *** [src/highgui/CMakeFiles/highgui.dir/cvcap_ffmpeg.o] Error 1
make[1]: *** [src/highgui/CMakeFiles/highgui.dir/all] Error 2
make: *** [all] Error 2For you further information, I have used the latest code from x264 and ffmpeg git, and opencv2.0 from sourceforge.net

I have googled for a while but just cannot find a right solution to me. I know this similar compiling errors have been posted for many times, but different versions might have different fixes. So I hope any of you could help in this. Thank you in advance.

Regards,
Jingming

Don_Shifty
August 30th, 2011, 02:18 PM
still would like help on this topic!
i have the same error!

tpap
September 13th, 2011, 04:56 PM
I'm having the same problem... Did anyone solve it?

arthursa
October 3rd, 2011, 11:39 PM
Had the same problem under Debian. Solved installing the 0.8.x ffmpeg http://ffmpeg.org/download.html

https://code.ros.org/trac/opencv/ticket/1020