在Nanopi-NEO上编译带Cedrus硬件编码器的ffmpeg动态链接库

使用自带ffmpeg的静态库报错 所以改成 动态库

https://pan.baidu.com/s/1pLkMYmR


Ubuntu 16.04 

交叉工具arm-cortexa9-linux-gnueabihf-4.9.3-20160512.tar.xz

[email protected]:/home/sun/nanopineo# ./4.9.3/bin/arm-linux-gcc -v
Using built-in specs.
COLLECT_GCC=./4.9.3/bin/arm-linux-gcc
COLLECT_LTO_WRAPPER=/home/sun/nanopineo/4.9.3/bin/../libexec/gcc/arm-cortexa9-linux-gnueabihf/4.9.3/lto-wrapper
Target: arm-cortexa9-linux-gnueabihf
Configured with: /work/toolchain/build/src/gcc-4.9.3/configure --build=x86_64-build_pc-linux-gnu --host=x86_64-build_pc-linux-gnu --target=arm-cortexa9-linux-gnueabihf --prefix=/opt/FriendlyARM/toolchain/4.9.3 --with-sysroot=/opt/FriendlyARM/toolchain/4.9.3/arm-cortexa9-linux-gnueabihf/sys-root --enable-languages=c,c++ --with-arch=armv7-a --with-tune=cortex-a9 --with-fpu=vfpv3 --with-float=hard --with-pkgversion=ctng-1.21.0-229g-FA --with-bugurl=http://www.friendlyarm.com/ --enable-__cxa_atexit --disable-libmudflap --disable-libgomp --disable-libssp --disable-libquadmath --disable-libquadmath-support --disable-libsanitizer --with-gmp=/work/toolchain/build/arm-cortexa9-linux-gnueabihf/buildtools --with-mpfr=/work/toolchain/build/arm-cortexa9-linux-gnueabihf/buildtools --with-mpc=/work/toolchain/build/arm-cortexa9-linux-gnueabihf/buildtools --with-isl=/work/toolchain/build/arm-cortexa9-linux-gnueabihf/buildtools --with-cloog=/work/toolchain/build/arm-cortexa9-linux-gnueabihf/buildtools --with-libelf=/work/toolchain/build/arm-cortexa9-linux-gnueabihf/buildtools --enable-lto --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --enable-threads=posix --enable-linker-build-id --with-linker-hash-style=gnu --enable-plugin --enable-gold --disable-multilib --with-local-prefix=/opt/FriendlyARM/toolchain/4.9.3/arm-cortexa9-linux-gnueabihf/sys-root --enable-long-long
Thread model: posix
gcc version 4.9.3 (ctng-1.21.0-229g-FA) 

nano-pi-neo内核 nanopi-neo_ubuntu-core-xenial_3.4.39_20170908.img.zip

linux 3.4

FFmpeg文件

ffmpeg_h264_H3-master.zip

FFmpeg-Cedrus-master.zip


1. git clone https://github.com/stulluk/FFmpeg-Cedrus
   git clone  https://github.com/uboborov/ffmpeg_h264_H3

  将补丁中的相关文件复制到FFmpeg-Cedrus中,覆盖掉原有文件:

  1.1  将 ffmpeg_h264_H3 目录下cedrus264.c文件复制到 FFmpeg-Cedrus/libavcodec 目录下覆盖原文件。

  1.2  将 ffmpeg_h264_H3/sunxi 目录下所有文件复制到 FFmpeg-Cedrus/libavcodec/arm/sunxi 目录下覆盖原文件。


配置成动态链接库
./configure --cross-prefix=../4.9.3/bin/arm-linux-  --prefix=/ffmpeg-h3 --enable-nonfree --enable-gpl --enable-version3 --enable-vdpau --target-os=linux --arch=arm --enable-shared --disable-static

make -j2
make install

然后

把/ffmpeg-h3 中的lib include bin 复制到nano-pi-neo的usr/lib usr/bin usr/include 要删除原来的静态库

然后复制 /ffmpeg-h3 中的lib include  到交叉工具链的 ./4.9.3/lib/gcc/arm-cortexa9-linux-gnueabihf/4.9.3/ 对应的目录



然后测试 写个c文件编译下

rm ff3;./4.9.3/bin/arm-linux-gcc my_ffmpeg.c -o ff3  -lavformat -lavcodec -lavdevice  -lavutil  -lavfilter -lswscale -lswresample -lpostproc



[email protected]:/home/pi# ./ff3 
[video4linux2,v4l2 @ 0x22020] The driver changed the time per frame from 1/20 to 1/10
Input #0, video4linux2,v4l2, from '/dev/video0':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 960x720, 110592 kb/s, 10 fps, 10 tbr, 1000k tbn
codec_type :0
picture width   =  960 
picture height  =  720 
Pixel   Format  =  1 
ok
Output #0, avi, to 'mytest.avi':
    Stream #0:0: Video: h264, nv12, 960x720, q=3-30, 8000 kb/s, 10 tbc
[VDPAU SUNXI] VE version 0x1680 opened.
cedrus264_encode_init

呕吐_ok
[avi @ 0x33f20] Using AVStream.codec.time_base as a timebase hint to the muxer is deprecated. Set AVStream.time_base instead.

在Nanopi-NEO上编译带Cedrus硬件编码器的ffmpeg动态链接库