Building OpenCV 2.4.11 on Ubuntu 15.04

asked 2015-10-28 20:00:28 -0600

Hi!

I am trying to build OpenCV 2.4.11 on Ubuntu 15.04. I am followin the installation guide and installed the required packages, e.g libavcodec-dev libavformat-dev libswscale-dev, etc.

My build is failing where the cap_ffmpeg.cpp object is to be compiled. It looks like it doesn't find the correct ffmpeg codecs. My build error is:

2/opencv-2.4.11/modules/highgui/src/ffmpeg_codecs.hpp:104:7: error: ‘CODEC_ID_H264’ was not declared in this scope { CODEC_ID_H264, MKTAG('H', '2', '6', '4') },

This is followed by about 50 similar messages of other codec definitions and finishes with

In file included from /home/username/working/opencv2/opencv-2.4.11/modules/highgui/src/cap_ffmpeg.cpp:45:0: /home/username/working/opencv2/opencv-2.4.11/modules/highgui/src/cap_ffmpeg_impl.hpp: In member function ‘double CvCapture_FFMPEG::getProperty(int)’: /home/username/working/opencv2/opencv-2.4.11/modules/highgui/src/cap_ffmpeg_impl.hpp:796:33: error: ‘AVStream’ has no member named ‘r_frame_rate’ return av_q2d(video_st->r_frame_rate); ^ /home/username/working/opencv2/opencv-2.4.11/modules/highgui/src/cap_ffmpeg_impl.hpp: In member function ‘double CvCapture_FFMPEG::get_fps()’: /home/username/working/opencv2/opencv-2.4.11/modules/highgui/src/cap_ffmpeg_impl.hpp:843:49: error: ‘AVStream’ has no member named ‘r_frame_rate’ double fps = r2d(ic->streams[video_stream]->r_frame_rate); ^ In file included from /home/username/working/opencv2/opencv-2.4.11/modules/highgui/src/cap_ffmpeg.cpp:45:0: /home/username/working/opencv2/opencv-2.4.11/modules/highgui/src/cap_ffmpeg_impl.hpp: In function ‘int icv_av_write_frame_FFMPEG(AVFormatContext, AVStream, uint8_t, uint32_t, AVFrame)’: /home/username/working/opencv2/opencv-2.4.11/modules/highgui/src/cap_ffmpeg_impl.hpp:1259:72: error: ‘avcodec_encode_video’ was not declared in this scope out_size = avcodec_encode_video(c, outbuf, outbuf_size, picture);

How can I fix my build?

Thanks in advance!

edit retag flag offensive close merge delete