3

I'm working on an android app, and I have to convert webm files to mp3. I really want to make a custom ffmpeg build, because it reduces the ffmpeg executable size to only 2MB.

My library works absolutely fine when running on my PC, but i'm struggling to build it for android... It seems like NDK architecture has changed and tutorials are outdated, and I can't find a proper and recent guide for android compiling...

I also would like to target all architectures (aarch64, armv7, i686, and x86_64)...

I've been on this for hours, fixed many errors, but still nothing has worked ><. Please help me ! :\

PS. I'm compiling on Linux, here is my configuration script:

#!/bin/bash

API=31 # target android api

OUTPUT=/home/romain/dev/android/ffmpeg_build

NDK=/home/romain/android-sdk/ndk/23.0.7599858
TOOLCHAIN=$NDK/toolchains/llvm/prebuilt/linux-x86_64
SYSROOT=$TOOLCHAIN/sysroot

TOOL_PREFIX="$TOOLCHAIN/bin/aarch64-linux-android"

CC="$TOOL_PREFIX$API-clang"
CXX="$TOOL_PREFIX$API-clang++"

./configure \
    --prefix=$OUTPUT \
    --target-os=android \
    --arch=$ARCH \
    --cpu=$CPU \
    --disable-everything \
    --disable-everything \
    --disable-network \
    --disable-autodetect \
    --enable-small \
    --enable-decoder=opus,vorbis \
    --enable-demuxer=matroska \
    --enable-muxer=mp3 \
    --enable-protocol=file \
    --enable-filter=aresample \
    --enable-libshine \
    --enable-encoder=libshine \
    --cc=$CC \
    --cxx=$CXX \
    --sysroot=$SYSROOT \
    --extra-cflags="-0s -fpic"

make
make install
1
  • 1
    have a look at github.com/tanersener/mobile-ffmpeg – this repo does all hard work for you, tune your parameters and run a simple script to get all architectures you care to support.
    – Alex Cohn
    Commented Jan 18, 2022 at 22:51

2 Answers 2

1

The prefix should point to $SYSROOT/usr/ and you misunderstood what --prefix mean. Its not output directory. Other than that i think nothing problematic than that (if it still happen please provide ffbuild/config.log)

0

The repository pointed to by the previous answer is no longer being maintained. Here is an updated one.

This is the android branch: https://github.com/arthenica/ffmpeg-kit/tree/main/android

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.