全志D1-H,官方SDK Tina2.0 移植 ffmpeg (交叉编译成功,运行时出问题)
-
移植ffmpeg
CompilationGuide/Generic – FFmpeg
FFmpeg-4.3.2 嵌入式Linux交叉编译_qq_29994663的博客-CSDN博客_交叉编译ffmpeg下载源码
wget https://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2 tar xvf ffmpeg-snapshot.tar.bz2 cd ffmpeg
环境配置
在
ffmpeg
源码根目录创建自动配置文件autogen.sh
export PATH=$PATH:/home/leesum/tina-d1-h/prebuilt/gcc/linux-x86/riscv/toolchain-thead-glibc/riscv64-glibc-gcc-thead_20200702/bin/ ./configure \ --prefix="./riscv-ffmpeg"\ --enable-shared \ --enable-cross-compile \ --cross-prefix=riscv64-unknown-linux-gnu- \ --target-os=linux \ --arch=riscv \ --enable-gpl \ --enable-libx264 \ --enable-libfdk-aac \ --enable-nonfree \ --extra-cflags="-I/home/leesum/tina-d1-h/out/d1-h-nezha/staging_dir/target/usr/include/ -I/home/leesum/tina-d1-h/out/d1-h-nezha/staging_dir/target/usr/include/allwinner/ -I/home/leesum/tina-d1-h/out/d1-h-nezha/staging_dir/target/usr/include/allwinner/include/" \ --extra-ldflags="-L/home/leesum/tina-d1-h/out/d1-h-nezha/staging_dir/target/usr/lib/" \ --extra-libs=-ldl
激活环境
chmod +x autogen.sh source ./autogen.sh
没有报错就是配置成功
交叉编译ffmpeg
make -j2
大约十分钟会编译成功,按照如上配置,我一次编译成功没有报错
make install
进入设定的
--prefix
目录,cd riscv-ffmpeg cd bin file ffmpeg
查看可执行文件类型,确实为
riscv64
可执行文件➜ bin file ffmpeg ffmpeg: ELF 64-bit LSB executable, UCB RISC-V, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-riscv64xthead-lp64d.so.1, for GNU/Linu ➜ bin
将
riscv-ffmpeg
目录下的文件打包发送至开发板找不到动态库
ffmpeg环境变量设置和安装后不能加载共享库的错误解决_Jensen Lee的博客-程序员宅基地 - 程序员宅基地 (cxyzjd.com)
报错:报错找不到动态库
./ffmpeg: error while loading shared libraries: libx264.so: cannot open shared object file: No such file or directory
根据报错信息可知缺少
libx264.so
这个动态库,进入TinaSDK
根目录,搜索libx264.so
将这个动态库复制到开发板中。find -name "libx264.so"
进入目录ls
file
命令查看文件属性libx264.so.157: ELF 64-bit LSB shared object, UCB RISC-V, version 1 (SYSV), dynamically linked, with debug_info, not stripped
libx264.so
是libx264.so.157
的软连接,需要将这两个文件复制到开发板中的lib
目录,或者ffmpeg
根目录中的lib
目录。
在这里我将这两个文件复制到了riscv-ffmpeg/lib
目录下。
添加动态链接库的位置和环境变量的位置export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/root/riscv-ffmpeg/lib export PATH=$PATH:/root/riscv-ffmpeg/bin
运行
ffmpeg
显示下图则移植成功。
出现问题
虽然
ffmpeg
有显示,但是运行命令时会出现Segmentation fault
错误,不知道如何解决,可能是配置的问题。 -
-
大佬真6,赞一个
-
@ccl_whc 在 全志D1-H,官方SDK Tina2.0 移植 ffmpeg (交叉编译成功,运行时出问题) 中说:
大佬真6,赞一个
2.0的tina没有ffmpeg把 -
解压丢到 package/mutimedia
Copyright © 2021 深圳全志在线有限公司 粤ICP备2021084185号 粤公网安备44030502007680号