ffmpeg + opencv + pc + arm 完整

 pc :
清除之前在usr目录下错误编译时产生的痕迹!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1
xvidcore:
./configure --prefix=/usr/local/pc/ffmpeg/ --enable-shared
x264:
./configure --enable-shared --prefix=/usr/local/pc/ffmpeg/

ffmpeg:
 ./configure --prefix=/usr/local/pc/ffmpeg/ --disable-static --enable-shared --enable-gpl --enable-swscaler --enable-libx264 --enable-libxvid --disable-strip --arch=libavcodec/i386/ --enable-ffplay --enable-ffserver  --disable-zlib  --enable-gpl --disable-opts --disable-network --extra-libs=-L/usr/local/pc/ffmpeg/lib --extra-ldflags=-L/usr/local/pc/ffmpeg/lib --extra-cflags=-I/usr/local/pc/ffmpeg/include --disable-ipv6 --enable-pthreads
测试:
export LD_LIBRARY_PATH=/usr/local/pc/ffmpeg/lib:$LD_LIBRARY_PATH
# /usr/local/pc/ffmpeg/bin/ffmpeg -i rh.avi -y -f image2 -ss 00:00:02 -t 0.001 -s 320x240 test.jpg
root@ubuntu:/home/thinkpad/tools/ffmpeg_x264_src_20071007# /usr/local/pc/ffmpeg/bin/ffmpeg -i OPPO3.mp4 -y -f image2 -ss 00:00:02 -t 0.001 -s 320x240 test.jpg
opencv
root@ubuntu:/home/thinkpad/tools/opencv-1.1.0# ./configure  --prefix=/usr/local/pc/opencv/ --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/pc/ffmpeg/include CPPFLAGS=-I/usr/local/pc/ffmpeg/include LDFLAGS=-L/usr/local/pc/ffmpeg/lib
得到pc内容:
checking for library containing av_open_input_file... -lavformat
checking ffmpeg/swscale.h usability... yes
checking ffmpeg/swscale.h presence... yes
checking for ffmpeg/swscale.h... yes
checking for sws_getContext in -lswscale... yes
checking linux/videodev.h usability... yes
checking linux/videodev.h presence... yes
checking for linux/videodev.h... yes
checking for linux/videodev2.h... yes
。。。。。
HighGUI configuration ================================================

    Windowing system --------------
    Use Carbon / Mac OS X:    no
    Use gtk+ 2.x:             no
    Use gthread:              no

    Image I/O ---------------------
    Use ImageIO / Mac OS X:   no
    Use libjpeg:              yes
    Use zlib:                 yes
    Use libpng:               yes
    Use libtiff:              no
    Use libjasper:            no
    Use libIlmImf:            no

    Video I/O ---------------------
    Use QuickTime / Mac OS X: no
    Use xine:                 no
    Use gstreamer:            no
    Use ffmpeg:               yes
    Use dc1394 & raw1394:     no
    Use v4l:                  yes
    Use v4l2:                 yes
    Use unicap:               no

Wrappers for other languages =========================================
    SWIG                     
    Python                    no
    Octave                    no

Additional build settings ============================================
    Build demo apps           yes

Now run make ...
如此pc机上可以通过opencv来处理摄像头(代测试)。
arm一直一有问题,再看看。
root@ubuntu:/home/thinkpad/tools/xvidcore-1.1.3/build/generic# CC=arm-linux-gcc ./configure --prefix=/usr/local/arm/arm-linux/ffmpeg --build=i686-pc-linux --host=arm-linux --target=arm-linux --enable-shared
x264:
./configure --enable-shared --prefix=/usr/local/arm/arm-linux/ffmpeg --host=arm-linux
修改config.mak文件
CC=gcc
改为
CC=arm-linux-gcc

ffmpeg:
root@ubuntu:/home/thinkpad/tools/ffmpeg_x264_src_20071007/ffmpeg# ./configure --prefix=/usr/local/arm/arm-linux/ffmpeg/ --disable-static --enable-shared --enable-gpl --enable-swscaler --enable-libx264 --enable-libxvid --disable-strip --arch=libavcodec/armv4l/ --enable-ffplay --enable-ffserver --disable-armv5te --disable-armv6 --disable-zlib --cross-compile --cross-prefix=/usr/local/arm/3.4.1/bin/arm-linux- --cc=gcc --enable-gpl --disable-opts --disable-network --extra-libs=-L/usr/local/arm/arm-linux/ffmpeg/lib/ --extra-ldflags=-L/usr/local/arm/arm-linux/ffmpeg/lib/ --extra-cflags=-I/usr/local/arm/arm-linux/ffmpeg/include/ --disable-ipv6 --enable-pthreads
ok之后,应该先下载到arm测试
root@ubuntu:/home/thinkpad/tools/opencv-1.1.0# export LD_LIBRARY_PATH=/usr/local/arm/arm-linux/ffmpeg/lib:$LD_LIBRARY_PATH

出错:

error while loading shared libraries libavcodec.so.51: file too short

查看文件属性:

root@ubuntu:/usr/local/arm/arm-linux/ffmpeg/lib# file *
libavcodec.so:          symbolic link to `libavcodec.so.51.44.0'
libavcodec.so.51:       symbolic link to `libavcodec.so.51.44.0'
libavcodec.so.51.44.0:  ELF 32-bit LSB shared object, ARM, version 1, dynamically linked, not stripped
libavformat.so:         symbolic link to `libavformat.so.51.14.0'
libavformat.so.51:      symbolic link to `libavformat.so.51.14.0'
libavformat.so.51.14.0: ELF 32-bit LSB shared object, ARM, version 1, dynamically linked, not stripped
libavutil.so:           symbolic link to `libavutil.so.49.5.0'
libavutil.so.49:        symbolic link to `libavutil.so.49.5.0'
libavutil.so.49.5.0:    ELF 32-bit LSB shared object, ARM, version 1, dynamically linked, not stripped
libswscale.so:          symbolic link to `libswscale.so.0.5.0'
libswscale.so.0:        symbolic link to `libswscale.so.0.5.0'
libswscale.so.0.5.0:    ELF 32-bit LSB shared object, ARM, version 1, dynamically linked, not stripped
libx264.a:              current ar archive
libx264.so:             symbolic link to `libx264.so.56'
libx264.so.56:          ELF 32-bit LSB shared object, ARM, version 1, dynamically linked, stripped
libxvidcore.a:          current ar archive
libxvidcore.so.4.1:     ELF 32-bit LSB shared object, ARM, version 1, dynamically linked, not stripped
pkgconfig:              directory
vhook:                  directory
根据网络友人的回答:

There was probably an error copying/extracting the libraries. libvtkWidgets.so and libvtkWidgets.so.5.4 should not be files but symbolic links. Try the following:

rm libvtkWidgets.so.5.4 libvtkWidgets.so ln -s libvtkWidgets.so.5.4.2 libvtkWidgets.so.5.4 ln -s libvtkWidgets.so.5.4 libvtkWidgets.so

Anyway you should check if the software that you are installing is available from the software center. If it is not available and if the above fix does not work you will need to contact the application provider.

执行ffmpeg,不能识别mp4 或者avi格式

在xvidcore测试:在进入example目录输入

arm-linux-gcc -o xvid_encraw xvid_encraw.c  -lc -lm -I../src/ -L../build/generic/=build -lxvidcore
报错,需要重新编译

opencv:
root@ubuntu:/home/thinkpad/tools/opencv-1.1.0# ./configure  --prefix=/usr/local/arm/arm-linux/opencv --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/ffmpeg/include CPPFLAGS=-I/usr/local/arm/arm-linux/ffmpeg/include LDFLAGS=-L/usr/local/arm/arm-linux/ffmpeg/lib

根据网上信息,gcc4.3.2可以,但是我没有测试成功,4.5.1+opencv2.0+ffmpeg0.5也是同样的问题,待解决。

你可能感兴趣的:(image,object,测试,ubuntu,Build,library)