Alin
Alin

Reputation: 14571

Error on building ffmpeg for android using NDK in ubuntu


An ffmpeg android for android 2.3+ which allows me to decompress/add watermark/recompress a video file. I need to have it working on all current CPUs.

What I did so far

I looked in a lot of sources for guidance. Most of the articles are obsolete or simply not work. Not to mention the whole struggle I went to from installing ubuntu on virtualBox, an OS which I never seen before. The whole java/sdk/ndk install was pretty easy but I had hard times in setting the PATH variables and most importantly WHERE to set them.

So, here is my structure: The default folder path is /home/alin in which I have enter image description here

The PATH is set in etc/profile and I can confirm that it works. I know that it works because running java -version or ndk-build run just fine

> ANDROID_SDK=/home/alin/android/sdk ANDROID_NDK=/home/alin/android/ndk
> JAVA_HOME=/usr/local/java/jdk1.8.0_20
> PATH=$PATH:$HOME/bin:$JAVA_HOME/bin:$ANDROID_SDK/platform-tools:$ANDROID_SDK/tools:$ANDROID_NDK
> export JAVA_HOME export ANDROID_SDK export ANDROID_NDK export PATH

I have downloaded the latest sources from ffmpeg.org and saved it in ndk/sources folder, in sources I have created an android_build.sh file as from (http://www.roman10.net/how-to-build-ffmpeg-with-ndk-r9/)

enter image description here

#!/bin/bash

NDK=/home/alin/android/ndk
SYSROOT=$NDK/platforms/android-9/arch-arm/
TOOLCHAIN=$NDK/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64

function build_one

{

./configure \
    --prefix=$PREFIX \
    --enable-shared \
    --disable-static \
    --disable-doc \
    --disable-ffmpeg \
    --disable-ffplay \
    --disable-ffprobe \
    --disable-ffserver \
    --disable-avdevice \
    --disable-doc \
    --disable-symver \
    --cross-prefix=$TOOLCHAIN/bin/arm-linux-androideabi- \
    --target-os=linux \
    --arch=arm \
    --enable-cross-compile \
    --sysroot=$SYSROOT \
    --extra-cflags="-Os -fpic $ADDI_CFLAGS" \
    --extra-ldflags="$ADDI_LDFLAGS" \
    $ADDITIONAL_CONFIGURE_FLAG

make clean
make
make install
}

CPU=arm

PREFIX=$(pwd)/android/$CPU 

ADDI_CFLAGS="-marm"

build_one

When running the .sh file I get this: enter image description here

Trying different build.sh sometimes I got different errors... so I have no idea what to do next.

Please guide me to:

Thank you.

Upvotes: 0

Views: 1000

Answers (2)

Palak Darji
Palak Darji

Reputation: 1114

I know, its too late.. but it may help somebody who come across this problem:

Just put that build_android.sh file inside source/ffmpeg folder.

Upvotes: 2

G3M
G3M

Reputation: 1031

I have compiled FFMPEG from 2 different different sources here https://github.com/android-native-libraries

please feel free to use the library files

Upvotes: 0

Related Questions