opencv support ffmpeg

万俟皓
2023-12-01
 
使用opencv1.1.0 编译得到结果:
checking for  library containting avcodec_decode_video ... no
checking for sws_getcontext in -lswscale ... no
编译ffmpeg时候,xvoid的问题。ffmpeg 版本需要大于0.4.9_p20070616-r1或者vlc-0.8.x
在/etc/ld.so.conf 中添加 include /usr/local/lib这里面有ffmpeg的库文件
opencv的配置:
./configure --without-quicktime --without-1394libs --with-ffmpeg --enable-shared --enable-swscale --enable-gpl
编译arm版本的时候opencv有ffmpeg编译不过:
config.log 错误内容:
configure:23424: checking for library containing avcodec_decode_video
configure:23465: arm-linux-gcc -o conftest -I/usr/local/arm/arm-linux/include -DNDEBUG -I/usr/local/arm/arm-linux/include -L/usr/local/arm/arm-linux/lib conftest.c -lpthread -ldl -lm  >&5
/tmp/ccgeK9FN.o(.text+0xc): In function `main':
: undefined reference to `avcodec_decode_video'
collect2: ld returned 1 exit status
configure:23471: $? = 1

root@ubuntu:/home/thinkpad/tools/opencv-1.1.0# ./configure  --prefix=/usr/local/arm/arm-linux/ --host=arm-linux --without-gtk --with-v4l --without-python --without-swig --without-carbon --without-quicktime --without-1394libs --with-ffmpeg --enable-shared --enable-swscale --enable-gpl CXXFLAGS=-fno-strict-aliasing CFLAGS=-I/usr/local/arm/arm-linux/include CPPFLAGS=-I/usr/local/arm/arm-linux/include LDFLAGS=-L/usr/local/arm/arm-linux/lib
 
在网上得到:
See http://bbs.archlinux.org/viewtopic.php?p=170060#170060 for more details.

Basically, applications requiring to link in libavcodec.so might not work if a call to avcodec_decode_video is made (and probably other functions) since this function requries the xvidcore shared libraries.

This can be demonstrated using the way ./configure scripts check for library compatibility. For example, the openCV application checks for avcodec_decode_video in libavcodec.so by writing a test app and attempting to compile it.
To reproduce, uninstall xvidcore, install ffmpeg and run:
echo 'int main(){ avcodec_decode_video(); return 0; }' | gcc -lavcodec -x c -o /dev/null -
You should see:
/usr/bin/ld: warning: libxvidcore.so.4, needed by /usr/lib/gcc/i686-pc-linux-gnu/4.0.3/../../../libavcodec.so, not found (try using -rpath or -rpath-link)
Now install xvidcore and rerun, there should be no output indicating a successful compile.
需要确定ffmpeg各个相关库文件编译成功!
另外,在pc机上建议不修改ld.so.conf文件添加支持库目录,可以在移植的时候使用设定环境变量。pc机上使用
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
来保证环境的兼容性
 
O(∩_∩)O哈哈~,
终于看到use ffmpeg : yes了。
opencv的configure:
--without-quicktime --without-1394libs --with-ffmpeg --enable-shared --enable-swscale --enable-gpl LDFLAGS=-L/usr/local/lib
注:这个是pc机上编译的,在ubuntu 9 或者 10上编译的时候,始终找不到ffmpeg,google + baidu +soso。。。。得到的结果是:使用的3.4.1的编译器和系统有一定的兼容性问题,我估计ubuntu7应该可以。待测试。。。
 类似资料:

相关阅读

相关文章

相关问答