使用opencv构建自定义ffmpeg4.1时出错

问题描述 投票:0回答:1

我正在尝试构建自定义的ffmpeg版本4.1。众所周知,ffmpeg4.1需要libavcodec.so.58和其他相关库(最新)。我的代码中有一些与opencv相关的功能,例如cvLoadImage等。我更新了libopencv-highgui-dev,libopencv_core-dev和libopencv_imgproc-dev库。运行makefile时,出现以下错误,

/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

我清楚地链接了最新的库,并将它们包含在我的makefile中。错误列表提示我,libopencv-highgui.so指向libavcodec.57版本的api。 opencv是否未升级为支持libavXX.so.58库?还是我在这里做错了。

请对此提供帮助,否则任何建议都会有所帮助。

c opencv ffmpeg libav
1个回答
0
投票

您的opencv安装可能存在问题,请参考此问题Here

© www.soinside.com 2019 - 2024. All rights reserved.