Fading Coder

One Final Commit for the Last Sprint

Home > Tech > Content

Cross-compiling FFmpeg for MIPS Architecture

Tech 1

FFmpeg Cross-compilation Configuraton

Initial configuration for cross-compiling FFmpeg targeting MIPS architecture:

./configure \
--prefix=$(pwd)/output \
--enable-cross-compile --arch=mips --target-os=linux \
--cross-prefix=mips-linux-gnu- --cc=mips-linux-gnu-gcc-7.2.0 \
--disable-everything \
--disable-autodetect \
--enable-avdevice \
--enable-avfilter \
--disable-msa \
--disable-debug \
--disable-protocols --enable-protocol=file \
--disable-demuxers --enable-demuxer=mov \
--disable-muxers --enable-muxer=mp4 --enable-muxer=mov \
--disable-decoders --enable-decoder=pcm_alaw --enable-decoder=h264 --enable-decoder=mpeg4 \
--disable-encoders --enable-encoder=pcm_s16le \
--disable-bsfs --enable-bsf=h264_mp4toannexb \
--enable-static --enable-shared \
--disable-programs --enable-ffmpeg \
--extra-cflags=-muclibc --extra-cxxflags=-muclibc \
--enable-small

Resolving Compilation Issues

After encountering linking errors, the configuration was adjusted:

./configure \
--prefix=$(pwd)/output \
--enable-cross-compile --arch=mips --target-os=linux \
--cross-prefix=mips-linux-gnu- --cc=mips-linux-gnu-gcc \
--disable-mipsdsp --disable-mipsdspr2 --disable-mips32r2 --disable-mipsfpu --disable-mips64r2 --disable-mips32r6 \
--disable-everything \
--disable-autodetect \
--enable-avdevice \
--enable-avfilter \
--disable-msa \
--disable-debug \
--disable-protocols --enable-protocol=file \
--disable-demuxers --enable-demuxer=mov \
--disable-muxers --enable-muxer=mp4 --enable-muxer=mov \
--disable-decoders --enable-decoder=pcm_s16le --enable-decoder=pcm_alaw --enable-decoder=h264 --enable-decoder=mpeg4 \
--disable-encoders --enable-encoder=pcm_s16le \
--disable-bsfs --enable-bsf=h264_mp4toannexb \
--enable-static --disable-shared \
--disable-programs --enable-ffmpeg \
--extra-cflags=-muclibc --extra-cxxflags=-muclibc \
--enable-small

Minimal Build Configuraton

Further optimization led to a streamlined configuration excluding unnecessary components:

./configure \
--prefix=$(pwd)/output \
--enable-cross-compile --arch=mips --target-os=linux \
--cross-prefix=mips-linux-gnu- --cc=mips-linux-gnu-gcc \
--disable-mipsdsp --disable-mipsdspr2 --disable-mips32r2 --disable-mipsfpu --disable-mips64r2 --disable-mips32r6 \
--enable-avdevice \
--enable-avfilter \
--disable-msa \
--disable-debug \
--disable-protocols --enable-protocol=file \
--disable-decoders --enable-decoder=pcm_s16le \
--disable-encoders --enable-encoder=pcm_s16le \
--enable-static --disable-shared \
--disable-programs --enable-ffmpeg \
--disable-doc \
--extra-cflags=-muclibc --extra-cxxflags=-muclibc \
--enable-small

Missing Function Definitions

To resolve undefined function references, add the following macros to common.h:

#define fmin(x, y) ((x) > (y) ? (y) : ((x) == (x) ? (x) : (y)))
#define fmax(x, y) ((x) < (y) ? (y) : ((x) == (x) ? (x) : (y)))
#define fminf(x, y) fmin(x, y)
#define fmaxf(x, y) fmax(x, y)

Related Articles

Understanding Strong and Weak References in Java

Strong References Strong reference are the most prevalent type of object referencing in Java. When an object has a strong reference pointing to it, the garbage collector will not reclaim its memory. F...

Comprehensive Guide to SSTI Explained with Payload Bypass Techniques

Introduction Server-Side Template Injection (SSTI) is a vulnerability in web applications where user input is improper handled within the template engine and executed on the server. This exploit can r...

Implement Image Upload Functionality for Django Integrated TinyMCE Editor

Django’s Admin panel is highly user-friendly, and pairing it with TinyMCE, an effective rich text editor, simplifies content management significantly. Combining the two is particular useful for bloggi...

Leave a Comment

Anonymous

◎Feel free to join the discussion and share your thoughts.