简体   繁体   English

Opencv 3.0使用哪个版本的FFMPEG?

[英]Opencv 3.0 with which Version of FFMPEG?

I can't seem to get OpenCV 3.0 to build properly with ffmpeg 2.7 or 2.4. 我似乎无法让ffmpeg 2.7或2.4正确构建OpenCV 3.0。 Does anyone know which version works? 有人知道哪个版本有效吗? I am running Mac OSX Yosemite. 我正在运行Mac OSX Yosemite。 I seem to get linking errors when attempting to build opencv with ffmpeg support: 尝试使用ffmpeg支持构建opencv时,似乎出现链接错误:

Linking CXX shared library ../../lib/libopencv_videoio.dylib
Undefined symbols for architecture x86_64:
  "_iconv", referenced from:
      _avcodec_decode_subtitle2 in libavcodec.a(utils.o)
  "_iconv_close", referenced from:
      _avcodec_open2 in libavcodec.a(utils.o)
      _avcodec_decode_subtitle2 in libavcodec.a(utils.o)
  "_iconv_open", referenced from:
      _avcodec_open2 in libavcodec.a(utils.o)
      _avcodec_decode_subtitle2 in libavcodec.a(utils.o)
  "_lzma_code", referenced from:
      _decode_frame in libavcodec.a(tiff.o)
  "_lzma_end", referenced from:
      _decode_frame in libavcodec.a(tiff.o)
  "_lzma_stream_decoder", referenced from:
      _decode_frame in libavcodec.a(tiff.o)
  "_swr_alloc", referenced from:
      _opus_decode_init in libavcodec.a(opusdec.o)
  "_swr_close", referenced from:
      _opus_decode_packet in libavcodec.a(opusdec.o)
      _opus_decode_flush in libavcodec.a(opusdec.o)
  "_swr_convert", referenced from:
      _opus_decode_packet in libavcodec.a(opusdec.o)
  "_swr_free", referenced from:
      _opus_decode_close in libavcodec.a(opusdec.o)
  "_swr_init", referenced from:
      _opus_decode_packet in libavcodec.a(opusdec.o)
  "_swr_is_initialized", referenced from:
      _opus_decode_packet in libavcodec.a(opusdec.o)
  "_x264_bit_depth", referenced from:
      _X264_init_static in libavcodec.a(libx264.o)
      _X264_frame in libavcodec.a(libx264.o)
  "_x264_encoder_close", referenced from:
      _X264_close in libavcodec.a(libx264.o)
  "_x264_encoder_delayed_frames", referenced from:
      _X264_frame in libavcodec.a(libx264.o)
  "_x264_encoder_encode", referenced from:
      _X264_frame in libavcodec.a(libx264.o)
  "_x264_encoder_headers", referenced from:
      _X264_init in libavcodec.a(libx264.o)
  "_x264_encoder_open_142", referenced from:
      _X264_init in libavcodec.a(libx264.o)
  "_x264_encoder_reconfig", referenced from:
      _X264_frame in libavcodec.a(libx264.o)
  "_x264_levels", referenced from:
      _X264_init in libavcodec.a(libx264.o)
  "_x264_param_apply_fastfirstpass", referenced from:
      _X264_init in libavcodec.a(libx264.o)
  "_x264_param_apply_profile", referenced from:
      _X264_init in libavcodec.a(libx264.o)
  "_x264_param_default", referenced from:
      _X264_init in libavcodec.a(libx264.o)
  "_x264_param_default_preset", referenced from:
      _X264_init in libavcodec.a(libx264.o)
  "_x264_param_parse", referenced from:
      _X264_init in libavcodec.a(libx264.o)
  "_x264_picture_init", referenced from:
      _X264_frame in libavcodec.a(libx264.o)
  "_xvid_encore", referenced from:
      _xvid_encode_init in libavcodec.a(libxvid.o)
      _xvid_encode_frame in libavcodec.a(libxvid.o)
      _xvid_encode_close in libavcodec.a(libxvid.o)
  "_xvid_global", referenced from:
      _xvid_encode_init in libavcodec.a(libxvid.o)
  "_xvid_plugin_2pass2", referenced from:
      _xvid_encode_init in libavcodec.a(libxvid.o)
      _ff_xvid_rate_control_init in libavcodec.a(libxvid_rc.o)
      _ff_xvid_rate_estimate_qscale in libavcodec.a(libxvid_rc.o)
      _ff_xvid_rate_control_uninit in libavcodec.a(libxvid_rc.o)
  "_xvid_plugin_lumimasking", referenced from:
      _xvid_encode_init in libavcodec.a(libxvid.o)
  "_xvid_plugin_single", referenced from:
      _xvid_encode_init in libavcodec.a(libxvid.o)
  "_xvid_plugin_ssim", referenced from:
      _xvid_encode_init in libavcodec.a(libxvid.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [lib/libopencv_videoio.3.0.0.dylib] Error 1
make[1]: *** [modules/videoio/CMakeFiles/opencv_videoio.dir/all] Error 2
make: *** [all] Error 2

Here are the flags which I compiled ffmpeg, maybe that could be the cause?: 这是我编译ffmpeg的标志,也许这可能是原因?:

./configure --prefix=~/Software/ffmpeg-2.4.10/ --enable-shared --enable-avresample --enable-libx264 --enable-libxvid --enable-opencl --enable-gpl ./configure --prefix =〜/ Software / ffmpeg-2.4.10 / --enable-shared --enable-avresample --enable-libx264 --enable-libxvid --enable-opencl --enable-gpl

Most of those aren't ffmpeg (libavcodec, libavformat, libavutils, libswscale, etc.) linker errors. 其中大多数不是ffmpeg(libavcodec,libavformat,libavutils,libswscale等)链接器错误。 They're dependencies ffmpeg was built with: iconv, swresample (which is part of ffmpeg), lzma, x264, and xvid. 它们是ffmpeg的依赖项,它们是用以下格式构建的:iconv,swresample(ffmpeg的一部分),lzma,x264和xvid。 You need to link to libiconv, libswresample, liblzma, libx264, and libxvid. 您需要链接到libiconv,libswresample,liblzma,libx264和libxvid。

A particular version of ffmpeg isn't the problem here. ffmpeg的特定版本在这里不是问题。 The problem is that ffmpeg has some dependencies you need to link to. 问题是ffmpeg有一些依赖项需要链接到。

You can --enable-libx264 if you want, but you need to actually have libx264 on your machine for OpenCV/ffmpeg to be able to link to. 如果需要,可以--enable-libx264 ,但实际上需要在计算机上安装libx264才能链接到OpenCV / ffmpeg。 Same with all the others. 与其他所有人一样。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM