-1

I am trying to build my customised ffmpeg of version 4.1. As we know that ffmpeg4.1 needs libavcodec.so.58 and other related libraries(newest). I have some functions related to opencv in my code such as cvLoadImage and other. I updated the libopencv-highgui-dev, libopencv_core-dev and libopencv_imgproc-dev libraries. When I run the makefile I got the following errors,

/usr/lib/x86_64-linux-gnu/libopencv_highgui.so: undefined reference to `av_free_packet@LIBAVCODEC_57'
/usr/lib/x86_64-linux-gnu/libopencv_highgui.so: undefined reference to `av_write_frame@LIBAVFORMAT_57'
/usr/lib/x86_64-linux-gnu/libopencv_highgui.so: undefined reference to `av_frame_alloc@LIBAVUTIL_55'
/usr/lib/x86_64-linux-gnu/libopencv_highgui.so: undefined reference to `avformat_free_context@LIBAVFORMAT_57'
/usr/lib/x86_64-linux-gnu/libopencv_highgui.so: undefined reference to `avformat_write_header@LIBAVFORMAT_57'
/usr/lib/x86_64-linux-gnu/libopencv_highgui.so: undefined reference to `av_rescale_q@LIBAVUTIL_55'
/usr/lib/x86_64-linux-gnu/libopencv_highgui.so: undefined reference to `av_write_trailer@LIBAVFORMAT_57'
/usr/lib/x86_64-linux-gnu/libopencv_highgui.so: undefined reference to `sws_getCachedContext@LIBSWSCALE_4'
/usr/lib/x86_64-linux-gnu/libopencv_highgui.so: undefined reference to `avcodec_find_encoder@LIBAVCODEC_57'
/usr/lib/x86_64-linux-gnu/libopencv_highgui.so: undefined reference to `av_free@LIBAVUTIL_55'
/usr/lib/x86_64-linux-gnu/libopencv_highgui.so: undefined reference to `avcodec_encode_video2@LIBAVCODEC_57'
/usr/lib/x86_64-linux-gnu/libopencv_highgui.so: undefined reference to `av_seek_frame@LIBAVFORMAT_57'
/usr/lib/x86_64-linux-gnu/libopencv_highgui.so: undefined reference to `av_lockmgr_register@LIBAVCODEC_57'
/usr/lib/x86_64-linux-gnu/libopencv_highgui.so: undefined reference to `avcodec_decode_video2@LIBAVCODEC_57'
/usr/lib/x86_64-linux-gnu/libopencv_highgui.so: undefined reference to `avcodec_open2@LIBAVCODEC_57'
/usr/lib/x86_64-linux-gnu/libopencv_highgui.so: undefined reference to `av_malloc@LIBAVUTIL_55'
/usr/lib/x86_64-linux-gnu/libopencv_highgui.so: undefined reference to `avio_close@LIBAVFORMAT_57'
/usr/lib/x86_64-linux-gnu/libopencv_highgui.so: undefined reference to `av_init_packet@LIBAVCODEC_57'
/usr/lib/x86_64-linux-gnu/libopencv_highgui.so: undefined reference to `av_log_set_level@LIBAVUTIL_55'
/usr/lib/x86_64-linux-gnu/libopencv_highgui.so: undefined reference to `avpicture_get_size@LIBAVCODEC_57'
/usr/lib/x86_64-linux-gnu/libopencv_highgui.so: undefined reference to `avformat_get_riff_video_tags@LIBAVFORMAT_57'
/usr/lib/x86_64-linux-gnu/libopencv_highgui.so: undefined reference to `avformat_close_input@LIBAVFORMAT_57'
/usr/lib/x86_64-linux-gnu/libopencv_highgui.so: undefined reference to `avpicture_fill@LIBAVCODEC_57'
/usr/lib/x86_64-linux-gnu/libopencv_highgui.so: undefined reference to `avformat_network_init@LIBAVFORMAT_57'
/usr/lib/x86_64-linux-gnu/libopencv_highgui.so: undefined reference to `avformat_find_stream_info@LIBAVFORMAT_57'
/usr/lib/x86_64-linux-gnu/libopencv_highgui.so: undefined reference to `avcodec_close@LIBAVCODEC_57'
/usr/lib/x86_64-linux-gnu/libopencv_highgui.so: undefined reference to `av_guess_codec@LIBAVFORMAT_57'
/usr/lib/x86_64-linux-gnu/libopencv_highgui.so: undefined reference to `avio_open@LIBAVFORMAT_57'
/usr/lib/x86_64-linux-gnu/libopencv_highgui.so: undefined reference to `av_guess_format@LIBAVFORMAT_57'
/usr/lib/x86_64-linux-gnu/libopencv_highgui.so: undefined reference to `avformat_open_input@LIBAVFORMAT_57'
/usr/lib/x86_64-linux-gnu/libopencv_highgui.so: undefined reference to `av_register_all@LIBAVFORMAT_57'
/usr/lib/x86_64-linux-gnu/libopencv_highgui.so: undefined reference to `sws_getContext@LIBSWSCALE_4'
/usr/lib/x86_64-linux-gnu/libopencv_highgui.so: undefined reference to `avformat_new_stream@LIBAVFORMAT_57'
/usr/lib/x86_64-linux-gnu/libopencv_highgui.so: undefined reference to `av_frame_free@LIBAVUTIL_55'
/usr/lib/x86_64-linux-gnu/libopencv_highgui.so: undefined reference to `av_sub_q@LIBAVUTIL_55'
/usr/lib/x86_64-linux-gnu/libopencv_highgui.so: undefined reference to `av_freep@LIBAVUTIL_55'
/usr/lib/x86_64-linux-gnu/libopencv_highgui.so: undefined reference to `avcodec_find_decoder@LIBAVCODEC_57'
/usr/lib/x86_64-linux-gnu/libopencv_highgui.so: undefined reference to `sws_freeContext@LIBSWSCALE_4'
/usr/lib/x86_64-linux-gnu/libopencv_highgui.so: undefined reference to `sws_scale@LIBSWSCALE_4'
/usr/lib/x86_64-linux-gnu/libopencv_highgui.so: undefined reference to `avformat_alloc_context@LIBAVFORMAT_57'
/usr/lib/x86_64-linux-gnu/libopencv_highgui.so: undefined reference to `av_read_frame@LIBAVFORMAT_57'
/usr/lib/x86_64-linux-gnu/libopencv_highgui.so: undefined reference to `av_codec_get_id@LIBAVFORMAT_57'
/usr/lib/x86_64-linux-gnu/libopencv_highgui.so: undefined reference to `avcodec_flush_buffers@LIBAVCODEC_57'
collect2: error: ld returned 1 exit status
make: *** [new-ffmpeg] Error 1

I have clearly linked the newest libraries and included them in my makefile. Errors list suggesting me that, libopencv-highgui.so is pointing to libavcodec.57 version api's. Has opencv not upgraded to support libavXX.so.58 libs? or am I doing anything wrong here.

Please help me with this, or any suggestions would be helpful.

geo-freak
  • 327
  • 3
  • 20
  • It's clearly looking for libavcodec_57 in the log provided. Without knowing how exactly are you building OpenCV is hard to tell. And the errors provided are not about "API", but the libraries and references it's trying to link with. – Kamiccolo Dec 19 '19 at 13:49
  • @Kamiccolo thanks for the response, so whats the solution to build my customised ffmpeg? Can't we do anything? can we link this libopencv_highgui library to point to libav? or should I need to compile and build the binaries of libopencv_highgui with libav newer libraries? Is it possible? – geo-freak Dec 19 '19 at 15:33
  • What OS/Version you are using? – Manthan Tilva Dec 20 '19 at 04:01
  • @Manthan Tilva I'm using Debian Stretch, 64 bit. – geo-freak Dec 20 '19 at 04:06
  • And what is version of OpenCV you are using? – Manthan Tilva Dec 20 '19 at 04:20
  • @Manthan opencv is of version 2.4 – geo-freak Dec 20 '19 at 05:55

1 Answers1

0

It's possible that there is a problem with your opencv installation please refer to this issue Here

  • I followed the process you suggested, but I got this error, /usr/bin/ld: warning: libavcodec.so.57, needed by /usr/lib/x86_64-linux-gnu/libopencv_highgui.so, may conflict with libavcodec.so.58 /usr/bin/ld: warning: libavformat.so.57, needed by /usr/lib/x86_64-linux-gnu/libopencv_highgui.so, may conflict with libavformat.so.58 /usr/bin/ld: warning: libavutil.so.55, needed by /usr/lib/x86_64-linux-gnu/libopencv_highgui.so, may conflict with libavutil.so.56 /usr/bin/ld: warning: libswscale.so.4, needed by /usr/lib/x86_64-linux-gnu/libopencv_highgui.so, may conflict with libswscale.so.5 – geo-freak Dec 27 '19 at 08:25
  • See this https://askubuntu.com/questions/378673/conflicting-libraries-in-usr-local-lib-and-usr-lib-x86-64-linux-gnu – professional debugger Dec 27 '19 at 10:19