skip to Main Content

Is it possible to build ffmpeg with decoding support for Raspberry Pi? I’ve read that mmal can do hardware accelerated decoding on the Raspberry Pi.

I’ve tried on debian 10 x86_64:

./configure 
    --prefix=${BUILD_DIR}/desktop/${FFMPEG_ARCH_FLAG} 
    --disable-doc 
    --enable-cross-compile 
    --cross-prefix=${CROSS_PREFIX} 
    --target-os=linux 
    --arch=${FFMPEG_ARCH_FLAG} 
    --extra-cflags="-O3 -fPIC $EXTRA_CFLAGS" 
    --enable-mmal 
    --enable-omx 
    --enable-omx-rpi 
    --enable-shared 
    --disable-debug 
    --disable-runtime-cpudetect 
    --disable-programs 
    --disable-muxers 
    --disable-encoders 
    --disable-bsfs 
    --disable-pthreads 
    --disable-avdevice 
    --disable-network 
    --disable-postproc 

where CROSS_PREFIX=aarch64-linux-gnu- and FFMPEG_ARCH_FLAG=aarch64 but obviously I get ERROR: mmal not found. I couldn’t find MMAL to compile and install.

2

Answers


  1. This is possible. You can use this build script, which you will need to run on the Raspberry Pi itself. The part you probably care most about is towards the end:

    git clone --depth 1 https://github.com/FFmpeg/FFmpeg.git ~/FFmpeg 
      && cd ~/FFmpeg 
      && ./configure 
        --extra-cflags="-I/usr/local/include" 
        --extra-ldflags="-L/usr/local/lib" 
        --extra-libs="-lpthread -lm -latomic" 
        --arch=armel 
        --enable-gmp 
        --enable-gpl 
        --enable-libaom 
        --enable-libass 
        --enable-libdav1d 
        --enable-libfdk-aac 
        --enable-libfreetype 
        --enable-libkvazaar 
        --enable-libmp3lame 
        --enable-libopencore-amrnb 
        --enable-libopencore-amrwb 
        --enable-libopus 
        --enable-librtmp 
        --enable-libsnappy 
        --enable-libsoxr 
        --enable-libssh 
        --enable-libvorbis 
        --enable-libvpx 
        --enable-libzimg 
        --enable-libwebp 
        --enable-libx264 
        --enable-libx265 
        --enable-libxml2 
        --enable-mmal 
        --enable-nonfree 
        --enable-omx 
        --enable-omx-rpi 
        --enable-version3 
        --target-os=linux 
        --enable-pthreads 
        --enable-openssl 
        --enable-hardcoded-tables 
      && make -j$(nproc) 
      && sudo make install
    
    

    Note this caveat from RaspberryPi.org:

    MMAL is a Broadcom-specific API used only on VideoCore 4 systems

    This makes me think the chances of cross-compiling are low, but you can always give it a shot with this script.

    Login or Signup to reply.
  2. To build ffmpeg with mmal support you need to install the raspberry userland which provides the mmal interface. Note that mmal is not supported on 64bit userland systems (See https://github.com/raspberrypi/userland/issues/688)

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search