Ubuntu16.04 64位
FFmpeg3.4
OpenCv3.4
一、下载FFmpeg
https://github.com/FFmpeg/FFmpeg
1.配置
./configure --prefix=/home/zeng/ffmpeg_install --enable-cross-compile --cross-prefix=arm-linux-gnueabihf- --cc=arm-linux-gnueabihf-gcc --target-os=linux --cpu=cortex-a7 --arch=arm --disable-yasm --disable-x86asm --disable-static --enable-shared --enable-small --enable-ffmpeg
2.编译和安装
make -j4
make install
二、设置pkg-config
如果没安装pkg-config,请自行百度安装以下。
1.进入ffmpeg_instal的lib目录下的pkgconfig文件夹,拷贝pkgconfig路径
2.设置pkg-config变量PKG_CONFIG_PATH
export PKG_CONFIG_PATH=/home/zeng/FFmpeg/my_install/lib/pkgconfig
3.测试pkg-config设置是否正确
测试命令:
pkg-config --cflags libavformat
输出:
-I/home/zeng/FFmpeg/my_install/include
则设置正确。
三、下载OpenCv.
https://github.com/opencv/opencv.git
1.进入OpenCv,创建build目录
cd opencv
mkdir build
cd build
2.配置
cmake -D CMAKE_BUILD_TYPE=RELEASE \-D CMAKE_INSTALL_PREFIX=/opt/opencv3.4.1_lib/opencv3.4_arm \-D CMAKE_C_COMPILER=arm-linux-gnueabihf-gcc \-D CMAKE_CXX_COMPILER=arm-linux-gnueabihf-g++ \-D BUILD_SHARED_LIBS=ON \-D CMAKE_CXX_FLAGS=-fPIC \-D CMAKE_C_FLAGS=-fPIC \-D CMAKE_EXE_LINKER_FLAGS=-lpthread -ldl \-D ENABLE_PIC=ON \-D WITH_1394=OFF \-D WITH_ARAVIS=OFF \-D WITH_ARITH_DEC=ON \-D WITH_ARITH_ENC=ON \-D WITH_CLP=OFF \-D WITH_CUBLAS=OFF \-D WITH_CUDA=OFF \-D WITH_CUFFT=OFF \-D WITH_FFMPEG=ON \-D WITH_GSTREAMER=ON \-D WITH_GSTREAMER_0_10=OFF \-D WITH_HALIDE=OFF \-D WITH_HPX=OFF \-D WITH_IMGCODEC_HDR=ON \-D WITH_IMGCODEC_PXM=ON \-D WITH_IMGCODEC_SUNRASTER=ON \-D WITH_INF_ENGINE=OFF \-D WITH_IPP=OFF \-D WITH_ITT=OFF \-D WITH_JASPER=ON \-D WITH_JPEG=ON \-D WITH_LAPACK=ON \-D WITH_LIBREALSENSE=OFF \-D WITH_NVCUVID=OFF \-D WITH_OPENCL=OFF \-D WITH_OPENCLAMDBLAS=OFF \-D WITH_OPENCLAMDFFT=OFF \-D WITH_OPENCL_SVM=OFF \-D WITH_OPENEXR=OFF \-D WITH_OPENGL=OFF \-D WITH_OPENMP=OFF \-D WITH_OPENNNI=OFF \-D WITH_OPENNNI2=OFF \-D WITH_OPENVX=OFF \-D WITH_PNG=OFF \-D WITH_PROTOBUF=OFF \-D WITH_PTHREADS_PF=ON \-D WITH_PVAPI=OFF \-D WITH_QT=OFF \-D WITH_QUIRC=OFF \-D WITH_TBB=OFF \-D WITH_TIFF=ON \-D WITH_VULKAN=OFF \-D WITH_WEBP=ON \-D WITH_XIMEA=OFF \-D BUILD_opencv_highgui=OFF \..
注意不要忘了末尾的两个点,代表上一次目录
输出:
则配置FFmpeg正确。
3.编译安装
make -j4
sudo make install