Hello,
OpenCV was building fine untill I added FFMPEG libraries. The FFMPEG version I use is 2.8.
This is the error i'm getting:
Scanning dependencies of target opencv_videoio [ 39%] Building CXX object modules/videoio/CMakeFiles/opencv_videoio.dir/src/cap.cpp.o [ 39%] Building CXX object modules/videoio/CMakeFiles/opencv_videoio.dir/src/cap_images.cpp.o [ 39%] Building CXX object modules/videoio/CMakeFiles/opencv_videoio.dir/src/cap_mjpeg_encoder.cpp.o [ 39%] Building CXX object modules/videoio/CMakeFiles/opencv_videoio.dir/src/cap_mjpeg_decoder.cpp.o [ 39%] Building CXX object modules/videoio/CMakeFiles/opencv_videoio.dir/src/cap_dc1394_v2.cpp.o [ 39%] Building CXX object modules/videoio/CMakeFiles/opencv_videoio.dir/src/cap_libv4l.cpp.o [ 40%] Building CXX object modules/videoio/CMakeFiles/opencv_videoio.dir/src/cap_ffmpeg.cpp.o In file included from /home/carlaptop/Projects/opencv-3.0.0/modules/videoio/src/cap_ffmpeg.cpp:45:0: /home/carlaptop/Projects/opencv-3.0.0/modules/videoio/src/cap_ffmpeg_impl.hpp: In member function ‘void CvCapture_FFMPEG::close()’: /home/carlaptop/Projects/opencv-3.0.0/modules/videoio/src/cap_ffmpeg_impl.hpp:317:36: error: ‘avcodec_free_frame’ was not declared in this scope avcodec_free_frame(&picture); ^ /home/carlaptop/Projects/opencv-3.0.0/modules/videoio/src/cap_ffmpeg_impl.hpp: In member function ‘bool CvCapture_FFMPEG::open(const char*)’: /home/carlaptop/Projects/opencv-3.0.0/modules/videoio/src/cap_ffmpeg_impl.hpp:632:43: error: ‘avcodec_alloc_frame’ was not declared in this scope picture = avcodec_alloc_frame(); ^ /home/carlaptop/Projects/opencv-3.0.0/modules/videoio/src/cap_ffmpeg_impl.hpp:635:41: error: ‘PIX_FMT_BGR24’ was not declared in this scope avpicture_get_size( PIX_FMT_BGR24, ^ /home/carlaptop/Projects/opencv-3.0.0/modules/videoio/src/cap_ffmpeg_impl.hpp: In member function ‘bool CvCapture_FFMPEG::retrieveFrame(int, unsigned char**, int*, int*, int*, int*)’: /home/carlaptop/Projects/opencv-3.0.0/modules/videoio/src/cap_ffmpeg_impl.hpp:738:67: error: ‘PIX_FMT_RGB24’ was not declared in this scope avpicture_fill((AVPicture*)&rgb_picture, rgb_picture.data[0], PIX_FMT_RGB24, ^ /home/carlaptop/Projects/opencv-3.0.0/modules/videoio/src/cap_ffmpeg_impl.hpp:756:17: error: ‘PIX_FMT_BGR24’ was not declared in this scope PIX_FMT_BGR24, ^ /home/carlaptop/Projects/opencv-3.0.0/modules/videoio/src/cap_ffmpeg_impl.hpp: In function ‘AVFrame* icv_alloc_picture_FFMPEG(int, int, int, bool)’: /home/carlaptop/Projects/opencv-3.0.0/modules/videoio/src/cap_ffmpeg_impl.hpp:1110:35: error: ‘avcodec_alloc_frame’ was not declared in this scope picture = avcodec_alloc_frame(); ^ /home/carlaptop/Projects/opencv-3.0.0/modules/videoio/src/cap_ffmpeg_impl.hpp:1113:33: error: ‘PixelFormat’ was not declared in this scope size = avpicture_get_size( (PixelFormat) pix_fmt, width, height); ^ /home/carlaptop/Projects/opencv-3.0.0/modules/videoio/src/cap_ffmpeg_impl.hpp:1122:38: error: expected ‘)’ before ‘pix_fmt’ (PixelFormat) pix_fmt, width, height); ^ /home/carlaptop/Projects/opencv-3.0.0/modules/videoio/src/cap_ffmpeg_impl.hpp: In function ‘AVStream* icv_add_video_stream_FFMPEG(AVFormatContext*, AVCodecID, int, int, int, double, int)’: /home/carlaptop/Projects/opencv-3.0.0/modules/videoio/src/cap_ffmpeg_impl.hpp:1230:19: error: ‘PixelFormat’ was not declared in this scope c->pix_fmt = (PixelFormat) pixel_format; ^ /home/carlaptop/Projects/opencv-3.0.0/modules/videoio/src/cap_ffmpeg_impl.hpp: In member function ‘bool CvVideoWriter_FFMPEG::writeFrame(const unsigned char*, int, int, int, int, int)’: /home/carlaptop/Projects/opencv-3.0.0/modules/videoio/src/cap_ffmpeg_impl.hpp:1405:26: error: ‘PIX_FMT_BGR24’ was not declared in this scope if (input_pix_fmt == PIX_FMT_BGR24) { ^ /home/carlaptop/Projects/opencv-3.0.0/modules/videoio/src/cap_ffmpeg_impl.hpp:1410:31: error: ‘PIX_FMT_GRAY8’ was not declared in this scope else if (input_pix_fmt == PIX_FMT_GRAY8) { ^ /home/carlaptop/Projects/opencv-3.0.0/modules/videoio/src/cap_ffmpeg_impl.hpp:1423:25: error: ‘PixelFormat’ was not declared in this scope (PixelFormat)input_pix_fmt, width, height); ^ /home/carlaptop/Projects/opencv-3.0.0/modules/videoio/src/cap_ffmpeg_impl.hpp:1429:59: error: expected ‘)’ before ‘input_pix_fmt’ (PixelFormat)input_pix_fmt, ^ /home/carlaptop/Projects/opencv-3.0.0/modules/videoio/src/cap_ffmpeg_impl.hpp:1447:25: error: ‘PixelFormat’ was not declared in this scope (PixelFormat)input_pix_fmt, width, height); ^ In file included from /home/carlaptop/Projects/opencv-3.0.0/modules/videoio/src/cap_ffmpeg.cpp:45:0: /home/carlaptop/Projects/opencv-3.0.0/modules/videoio/src/cap_ffmpeg_impl.hpp: In member function ‘bool CvVideoWriter_FFMPEG::open(const char*, int, double, int, int, bool)’: /home/carlaptop/Projects/opencv-3.0.0/modules/videoio/src/cap_ffmpeg_impl.hpp:1604:25: error: ‘PIX_FMT_BGR24’ was not declared in this scope input_pix_fmt = PIX_FMT_BGR24; ^ /home/carlaptop/Projects/opencv-3.0.0/modules/videoio/src/cap_ffmpeg_impl.hpp:1607:25: error: ‘PIX_FMT_GRAY8’ was not declared in this scope input_pix_fmt = PIX_FMT_GRAY8; ^ /home/carlaptop/Projects/opencv-3.0.0/modules/videoio/src/cap_ffmpeg_impl.hpp:1683:25: error: ‘PIX_FMT_YUV422P’ was not declared in this scope codec_pix_fmt = PIX_FMT_YUV422P; ^ /home/carlaptop/Projects/opencv-3.0.0/modules/videoio/src/cap_ffmpeg_impl.hpp:1687:25: error: ‘PIX_FMT_YUVJ420P’ was not declared in this scope codec_pix_fmt = PIX_FMT_YUVJ420P; ^ /home/carlaptop/Projects/opencv-3.0.0/modules/videoio/src/cap_ffmpeg_impl.hpp:1691:42: error: ‘PIX_FMT_GRAY8’ was not declared in this scope codec_pix_fmt = input_pix_fmt == PIX_FMT_GRAY8 || ^ /home/carlaptop/Projects/opencv-3.0.0/modules/videoio/src/cap_ffmpeg_impl.hpp:1692:42: error: ‘PIX_FMT_GRAY16LE’ was not declared in this scope input_pix_fmt == PIX_FMT_GRAY16LE || ^ /home/carlaptop/Projects/opencv-3.0.0/modules/videoio/src/cap_ffmpeg_impl.hpp:1693:42: error: ‘PIX_FMT_GRAY16BE’ was not declared in this scope input_pix_fmt == PIX_FMT_GRAY16BE ? input_pix_fmt : PIX_FMT_YUV420P; ^ /home/carlaptop/Projects/opencv-3.0.0/modules/videoio/src/cap_ffmpeg_impl.hpp:1693:77: error: ‘PIX_FMT_YUV420P’ was not declared in this scope input_pix_fmt == PIX_FMT_GRAY16BE ? input_pix_fmt : PIX_FMT_YUV420P; ^ /home/carlaptop/Projects/opencv-3.0.0/modules/videoio/src/cap_ffmpeg_impl.hpp: At global scope: /home/carlaptop/Projects/opencv-3.0.0/modules/videoio/src/cap_ffmpeg_impl.hpp:1922:119: error: ‘PixelFormat’ has not been declared static AVStream* addVideoStream(AVFormatContext *oc, CV_CODEC_ID codec_id, int w, int h, int bitrate, double fps, PixelFormat pixel_format); ^ /home/carlaptop/Projects/opencv-3.0.0/modules/videoio/src/cap_ffmpeg_impl.hpp:1969:134: error: ‘PixelFormat’ has not been declared AVStream* OutputMediaStream_FFMPEG::addVideoStream(AVFormatContext *oc, CV_CODEC_ID codec_id, int w, int h, int bitrate, double fps, PixelFormat pixel_format) ^ /home/carlaptop/Projects/opencv-3.0.0/modules/videoio/src/cap_ffmpeg_impl.hpp: In static member function ‘static AVStream* OutputMediaStream_FFMPEG::addVideoStream(AVFormatContext*, AVCodecID, int, int, int, double, int)’: /home/carlaptop/Projects/opencv-3.0.0/modules/videoio/src/cap_ffmpeg_impl.hpp:2047:16: error: invalid conversion from ‘int’ to ‘AVPixelFormat’ [-fpermissive] c->pix_fmt = pixel_format; ^ /home/carlaptop/Projects/opencv-3.0.0/modules/videoio/src/cap_ffmpeg_impl.hpp: In member function ‘bool OutputMediaStream_FFMPEG::open(const char*, int, int, double)’: /home/carlaptop/Projects/opencv-3.0.0/modules/videoio/src/cap_ffmpeg_impl.hpp:2107:5: error: ‘PixelFormat’ was not declared in this scope PixelFormat codec_pix_fmt = PIX_FMT_YUV420P; ^ /home/carlaptop/Projects/opencv-3.0.0/modules/videoio/src/cap_ffmpeg_impl.hpp:2111:99: error: ‘codec_pix_fmt’ was not declared in this scope video_st_ = addVideoStream(oc_, codec_id, width, height, width * height * bitrate_scale, fps, codec_pix_fmt); ^ /home/carlaptop/Projects/opencv-3.0.0/modules/videoio/src/cap_ffmpeg_impl.hpp: In member function ‘bool InputMediaStream_FFMPEG::open(const char*, int*, int*, int*, int*)’: /home/carlaptop/Projects/opencv-3.0.0/modules/videoio/src/cap_ffmpeg_impl.hpp:2316:18: error: ‘PIX_FMT_YUV420P’ was not declared in this scope case PIX_FMT_YUV420P: ^ /home/carlaptop/Projects/opencv-3.0.0/modules/videoio/src/cap_ffmpeg_impl.hpp:2320:18: error: ‘PIX_FMT_YUV422P’ was not declared in this scope case PIX_FMT_YUV422P: ^ /home/carlaptop/Projects/opencv-3.0.0/modules/videoio/src/cap_ffmpeg_impl.hpp:2324:18: error: ‘PIX_FMT_YUV444P’ was not declared in this scope case PIX_FMT_YUV444P: ^ modules/videoio/CMakeFiles/opencv_videoio.dir/build.make:192: recipe for target 'modules/videoio/CMakeFiles/opencv_videoio.dir/src/cap_ffmpeg.cpp.o' failed make[2]: *** [modules/videoio/CMakeFiles/opencv_videoio.dir/src/cap_ffmpeg.cpp.o] Error 1 CMakeFiles/Makefile2:4273: recipe for target 'modules/videoio/CMakeFiles/opencv_videoio.dir/all' failed make[1]: *** [modules/videoio/CMakeFiles/opencv_videoio.dir/all] Error 2 Makefile:127: recipe for target 'all' failed make: *** [all] Error 2
Could anyone help me with this?