c - 使用ffmpeg安装Open-CV出错

标签 c opencv ffmpeg makefile cmake

我正在尝试安装在 Ubuntu 11.04 上运行的库 Open-CV。

我遵循了 InstallationGuide 中的所有说明.

但是在安装成功后我意识到我没有FFMPEG支持因为在我的配置文件中FFMPEG被禁用了:

Video I/O: 
--     DC1394 1.x:                 NO 
--     DC1394 2.x:                 YES 
--     FFMPEG:                     NO 
--       codec:                    YES 
--       format:                   YES 
--       util:                     YES 
--       swscale:                  NO 
--       gentoo-style:             YES 
--     GStreamer:                  YES 
--     UniCap:                     NO 
--     PvAPI:                      NO 
--     V4L/V4L2:                   Using libv4l 
--     Xine:                       NO

所以我按照描述安装 FFMEPG 后尝试重建所有内容 here .

按照说明配置安装后

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_PYTHON_SUPPORT=ON ../OpenCV-2.3.1

我运行 make 命令得到了这个错误:

make[2]: *** [bin/opencv_test_calib3d] Error 1
make[1]: *** [modules/calib3d/CMakeFiles/opencv_test_calib3d.dir/all] Error 2
make: *** [all] Error 2

这是错误出现的编译点:

Linking CXX executable ../../bin/opencv_test_calib3d
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `vorbis_analysis_headerout'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `lame_set_out_samplerate'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `lame_set_disable_reservoir'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `lame_encode_buffer'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `vaUnmapBuffer'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `vaDestroyBuffer'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `th_comment_clear'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `x264_param_default'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `x264_param_apply_profile'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `lame_set_brate'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `x264_encoder_headers'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `faacEncGetCurrentConfiguration'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `vorbis_analysis_blockout'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `vorbis_info_clear'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `vorbis_analysis_buffer'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `th_comment_init'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `vaCreateBuffer'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `lame_set_bWriteVbrTag'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `faacEncSetConfiguration'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `th_encode_ctl'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `D_IF_decode'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `faacEncGetDecoderSpecificInfo'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `vorbis_block_clear'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `lame_close'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `x264_encoder_encode'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `lame_set_VBR'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `Encoder_Interface_init'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `vorbis_analysis'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `lame_get_framesize'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `faacEncOpen'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `lame_init'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `th_encode_packetout'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `lame_set_quality'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `Decoder_Interface_exit'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `th_encode_alloc'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `vorbis_encode_setup_vbr'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `th_info_clear'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `lame_set_in_samplerate'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `x264_encoder_reconfig'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `x264_param_apply_fastfirstpass'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `lame_set_VBR_quality'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `lame_set_mode'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `D_IF_init'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `lame_set_num_channels'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `faacEncEncode'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `vorbis_encode_setup_managed'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `Encoder_Interface_exit'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `Decoder_Interface_init'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `vaRenderPicture'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `vorbis_encode_ctl'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `th_info_init'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `vorbis_analysis_init'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `x264_encoder_delayed_frames'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `x264_param_parse'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `th_encode_free'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `D_IF_exit'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `vorbis_dsp_clear'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `Decoder_Interface_Decode'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `vaMapBuffer'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `vorbis_block_init'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `x264_bit_depth'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `x264_picture_init'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `x264_encoder_close'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `x264_encoder_open_120'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `faacEncClose'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `vaEndPicture'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `lame_encode_flush'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `lame_encode_buffer_interleaved'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `vorbis_comment_init'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `vorbis_comment_clear'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `lame_init_params'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `x264_param_default_preset'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `vorbis_encode_setup_init'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `vorbis_bitrate_addblock'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `vorbis_comment_add_tag'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `th_encode_flushheader'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `lame_encode_buffer_int'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `th_encode_ycbcr_in'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `vorbis_bitrate_flushpacket'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `vorbis_analysis_wrote'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `vorbis_info_init'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `Encoder_Interface_Encode'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `vaBeginPicture'
collect2: ld returned 1 exit status

任何人都可以告诉我我正在执行的安装过程有什么问题吗?

为什么会出现这个库引用错误?

最佳答案

这些错误来自链接过程,它们通常意味着您在系统中缺少某些库,或者它们位于构建过程未搜索的位置。

我建议您谷歌这些符号以了解您需要安装的包是什么。

编辑:

总结一下我们的私下聊天,主要问题是 x264 是静态构建的。 使用--enable-shared 构建库的共享版本是必不可少的。 OP 建议在所有配置选项中添加 --prefix=/usr/local

关于c - 使用ffmpeg安装Open-CV出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8771334/

相关文章:

在 C 中从 x 到 y 的给定位置复制 n 位

c - 将 'defined' 与 'ifdef' 一起使用?

python-3.x - Flask 应用程序上的 Google App Engine : cv2 libSM. so.6 错误

docker - ffmpeg 和 docker 导致 averror_invaliddata

batch-file - 使用 HandBrake 命令行将所有 avi 转换为 mp4 并在转换后删除的批处理脚本

c - libev:如何将自定义数据与观察者相关联?

C:有时会出现段错误?

c++ - 每隔确定的秒数捕获图像

c++ - 在 OpenCV C++ 中将图像区域设置为零的最佳方法?

php - 如何在 FFMPEG 和 PHP 代码的帮助下并排合并两个 mp4 视频?