ffmpeg 移植到arm 编译笔记

2019-07-13 03:34发布

编译笔记

Yams 移植

  1. 解压 tar -zxvf yasm-1.3.0.tar.gz
  2. 切换到目录 cd yasm-1.3.0/
  3. ./configure –enable-shared –prefix=/workspace/arm –host=arm-linux
  4. Make ;make install

X264 编译:

  1. 解压
  2. 切换到目录
  3. ./configure –enable-static –disable-asm –host=arm-none-linux-gnueabi –prefix=/workspace/arm
  4. 修改config.mak
    • CC=arm-none-linux-gnueabi-gcc
    • LD=arm-none-linux-gnueabi-gcc -o
    • AR=arm-none-linux-gnueabi-ar rc
    • RANLIB=arm-none-linux-gnueabi-ranlib
    • LDFLAGS= -lm -lpthread -ldl -lrt
    修改x264.pc 添加 -ldl,否则 用pkg-config 会报错
prefix=/workspace/arm exec_prefix=${prefix} libdir=${exec_prefix}/lib includedir=${prefix}/include Name: x264 Description: H.264 (MPEG4 AVC) encoder library Version: 0.157.x Libs: -L${exec_prefix}/lib -lx264 -lpthread -lm -ldl Libs.private: Cflags: -I${prefix}/include
  1. Make ;make install

CMAKE 安装

如cmake 低于3.xx版本,最好升级(x265 最好用 3.xx以上版本)。
删除旧版本 yum remove cmake -y
安装依赖(ccmake 需要):
yum install ncurses
yum install ncurses-devel
tar -xvf cmake-3.10.3.tar.gz
cd cmake-3.10.3 ./bootstrap
gmake
gmake install

X265 编译:

  1. 解压
  2. 切换到目录 /workspace/deps/x265-2.8/build/arm-linux
  3. 修改crosscompile.cmake 文件 找到# specify the target environment
    SET(CMAKE_FIND_ROOT_PATH /opt/devspace/arm-2011.03/bin/)
    这里说明下,我的交叉编译工具目录是/opt/devspace/arm-2011.03/bin/
  4. sh ./make-Makefiles.bash 生成makefile
  5. 修改/workspace/deps/x265-2.7/build/arm-linux/CMakeFiles/cli.dir/link.txt
    添加 -ldl c libx265.so.151 -lpthread -ldl -Wl,-rpath,/workspace/deps/x265-2.7/build/arm-linux: 修改 x265.pc 添加 -ldl -lpthread 否则 用pkg-config 会报错
prefix=/workspace/arm exec_prefix=${prefix} libdir=${exec_prefix}/lib includedir=${prefix}/include Name: x265 Description: H.265/HEVC video encoder Version: 2.6 Libs: -L${libdir} -lx265 Libs.private: -lstdc++ -lrt -ldl -lpthread Cflags: -I${includedir}
  1. Make ;make install

拷贝pkg-config(否则 找不到x265)

cp /bin/pkg-config /opt/devspace/arm-2011.03/bin/arm-none-linux-gnueabi-pkg-config

配置ffmpeg

./configure –prefix=/workspace/arm –arch=arm –target-os=linux –cross-prefix=arm-none-linux-gnueabi- –enable-shared –enable-gpl –extra-cflags=-I/workspace/arm/include –extra-ldflags=-L/workspace/arm/lib –disable-static –disable-doc –enable-libx264 –enable-libx265 –enable-static –pkg-config-flags=–static –disable-postproc –disable-swscale Make;make install