下载ffmpeg
https://github.com/FFmpeg/FFmpeg/blob/release/4.4/configure
这个是4.4版本的ffmpeg,看自己需求下载。
编译ffmpeg
解压ffmpeg源码,进入源码目录进行编译。
./configure --prefix=$PWD/_install_uclibc --enable-cross-compile --cross-prefix=mips-linux-gnu- --arch=mips --target-os=linux --disable-asm --enable-mips32r2 --disable-mips32r5 --disable-mips32r6 --disable-mips64r2 --disable-mips64r6 --disable-mipsdsp --disable-mipsdspr2 --extra-cflags='-muclibc -march=mips32r2 -fPIC' --extra-cxxflags='-muclibc -march=mips32r2 -fPIC' --extra-ldflags='-muclibc -march=mips32r2 -fPIC' --enable-static --enable-shared --enable-small --disable-programs --disable-network --disable-everything --disable-decoders --enable-decoder=aac --enable-decoder=aac_fixed --enable-decoder=aac_latm --enable-decoder=h264 --enable-decoder=hevc --disable-encoders --enable-encoder=aac --enable-encoder=mpeg4 --disable-hwaccels --disable-parsers --disable-demuxers --enable-demuxer=aac --enable-demuxer=h264 --enable-demuxer=hevc --enable-demuxer=mov --disable-muxers --enable-muxer=mp4 --enable-muxer=hevc --enable-muxer=h264 --enable-muxer=adts --disable-protocols --enable-protocol=file --disable-filters --disable-bsfs --enable-bsf=aac_adtstoasc --enable-bsf=hevc_mp4toannexb --enable-bsf=h264_mp4toannexb --disable-devices --disable-debug make make install
生成资源位于_install_uclibc下
前面可能会报tools no such Makefile在这个文件,但是进入到tools文件夹发现是有的,这个时候我们再执行一次make就可以了。
如果编译报ffmpeg的例子的时候报,这个错的话,这个问题是环境问题,需要注意,编译器使能mips架构,然后对应的开发板的架构。
lib/ffmpeg/lib/libavformat.so: undefined reference to `__sync_fetch_and_sub_8'
lib/ffmpeg/lib/libavformat.so: undefined reference to `__sync_fetch_and_add_8'
mips架构参数
下面这个自行去翻译
--enable-mips32r2 --disable-mips32r5 --disable-mips32r6 --disable-mips64r2 --disable-mips64r6 --disable-mipsdsp --disable-mipsdspr2 --extra-cflags='-muclibc -march=mips32r2 -fPIC ' --extra-cxxflags='-muclibc -march=mips32r2 -fPIC' --extra-ldflags='-muclibc -march=mips32r2 -fPIC
It looks like you've provided a set of options that might be used with a compiler or build system for configuring the compilation process of a software project. Let me break down what each of these options does:
- --enable-mips32r2
: This option is likely enabling support for the MIPS32 Release 2 (R2) architecture.
- --disable-mips32r5
and --disable-mips32r6: These options are disabling support for the MIPS32 Release 5 (R5) and Release 6 (R6) architectures, respectively.
- --disable-mips64r2
and --disable-mips64r6: Similar to the previous ones, these options are disabling support for the MIPS64 Release 2 (R2) and Release 6 (R6) architectures, respectively.
- --disable-mipsdsp
and --disable-mipsdspr2: These options might be disabling support for certain DSP (Digital Signal Processing) extensions on the MIPS architecture.
- --extra-cflags='-muclibc -march=mips32r2 -fPIC'
: These extra C compiler flags are being added to the compilation process. The flags are:
-
- -muclibc
- -march=mips32r2
- -fPIC
- --extra-cxxflags='-muclibc -march=mips32r2 -fPIC'
: Similar to the previous flags, these extra C++ compiler flags are being added to the compilation process for C++ code.
- --extra-ldflags='-muclibc -march=mips32r2 -fPIC'
: These extra linker flags are being added to the linking process. They likely match the compiler flags mentioned above and ensure that the linker produces an executable that is compatible with the specified uClibc and MIPS32 R2 architecture.
In summary, it seems like you're configuring the compilation process for a software project to target the MIPS32 R2 architecture while using the uClibc C library and generating position-independent code. This configuration is designed to optimize the software for a specific MIPS architecture and runtime environment.