[FFmpeg-user] Using latest NDK and ffmpeg version results in very slow video processing on android

Srikanth Kommineni srikanth0569 at gmail.com
Tue Feb 2 01:03:53 CET 2016


Hello all,
This is my first-time emailing the ffmpeg user mailing list, forgive me for
noob mistakes.

I have an android app which does video processing using FFmpeg. I am using
a binary rather than the native JNI method.

So the summary of my problem is, I was previously using FFmpeg-2.4.1 and
the build script I have listed below and was getting decent performance
where a 15 seconds video would take about 30 seconds to process. I upgraded
the version of ffmpeg to 2.8.2 and the latest NDK using the guarding
project for android, the result is now a 15 seconds video consistently
takes about 1 minute 30 seconds to process. It is aggravated by the fact
that I am introducing adding text to the video and the total processing is
taking upwards of 6 minutes.

Any advice on how to correct this is much appreciated.

*The following is my original build script *

#!/bin/bash

NDK="/Users/srikanth/Documents/FFmpeg/android-ndk-r10-L"
TOOL_DIR_ARM="/Users/srikanth/Documents/FFmpeg/android-ndk-r10-L/sources/ffmpeg-2.4.1/my-android-toolchain"
SYSROOT=$NDK/platforms/android-L/arch-arm
echo "removing tool chain directory if it exists"
rm -r $TOOL_DIR_ARM

$NDK/build/tools/make-standalone-toolchain.sh \
   --platform=android-L \
   --arch=arm \
   --install-dir=$TOOL_DIR_ARM \
   --toolchain=arm-linux-androideabi-4.9 \
   --llvm-version=3.4 \
   --system=darwin-x86_64

if [ -d $SYSROOT ]; then
    echo "$SYSROOT is a valid directory"
fi

function build_x264
{
cd x264-latest

# another build for phone
./configure \
--cross-prefix=$TOOL_DIR_ARM/bin/arm-linux-androideabi- \
--sysroot=$SYSROOT \
--host=arm-linux \
--enable-static \
--enable-pic \
--disable-cli

make -j4
make install

cd ../
}


function build_one
{

# another build for phone
./configure \
--sysroot=$SYSROOT \
--target-os=linux \
--arch=arm \
--cross-prefix=$TOOL_DIR_ARM/bin/arm-linux-androideabi- \
--cc=$TOOL_DIR_ARM/bin/clang \
--enable-cross-compile \
--enable-encoder=mpeg4 \
--enable-pthreads \
--enable-gpl \
--enable-libx264 \
--enable-pic \
--extra-cflags='-I/usr/local/include' \
--extra-ldflags='-L/usr/local/lib'

make clean
make -j4
make install

}
echo "Building x_264 library"
build_x264
echo "Building FFmpeg"
build_one



*The new build script is the following : *

#!/bin/bash

 # $1 = architecture

  # $2 = base directory

  # $3 = pass 1 if you want to export default compiler environment variables

. abi_settings.sh $1 $2 $3

pushd ffmpeg


case $1 in

  armeabi-v7a | armeabi-v7a-neon)

    CPU='cortex-a8'

  ;;

  x86)

    CPU='i686'

  ;;

esac


make clean


./configure \

--target-os="$TARGET_OS" \

--cross-prefix="$CROSS_PREFIX" \

--arch="$NDK_ABI" \

--cpu="$CPU" \

--enable-runtime-cpudetect \

--sysroot="$NDK_SYSROOT" \

--enable-pic \

--enable-libx264 \

--enable-libfreetype \

--enable-pthreads \

--enable-version3 \

--enable-gpl \

--disable-doc \

--disable-shared \

--enable-static \

--pkg-config="${2}/ffmpeg-pkg-config" \

--prefix="${2}/build/${1}" \

--extra-cflags="-I${TOOLCHAIN_PREFIX}/include $CFLAGS" \

--extra-ldflags="-L${TOOLCHAIN_PREFIX}/lib $LDFLAGS" \

--extra-libs="-lpng -lexpat -lm" \

--extra-cxxflags="$CXX_FLAGS" || exit 1

make -j${NUMBER_OF_CORES} && make install || exit 1

popd


-- 
Srikanth Kommineni


More information about the ffmpeg-user mailing list