Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7536359
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T06:33:12+00:00 2026-05-30T06:33:12+00:00

I did build ffmpeg for Android in winxp and scientific linux , ffmpeg is

  • 0

I did build ffmpeg for Android in winxp and scientific linux , ffmpeg is in dolphin player — an open source video player (http://code.google.com/p/dolphin-player/), and i just build the ffmpeg, its seems like the same as in rockplayer 1.7.0, they all use build_andriod.sh below, it worked in both winxp and linux,
and all successfully got bin/ffmpeg (less than 5MB), but libffmpeg.so ( > 17MB), when put libffmpeg.so in dolphin-player libs , player can’t work, the size 17MB is too large, the original libffmpeg.so in olphin-player libs is less than 5MB, please give some advice.

#!/bin/bash

######################################################
# FFmpeg builds script for Android+ARM platform
#
# This script is released under term of 
#   CDDL (http://www.opensource.org/licenses/cddl1) 
# Wrote by pinxue (~@gmail.com) from RockPlayer.com
#                                   2010-8 ~ 2011-4
######################################################

######################################################
# Usage:
#   put this script in top of FFmpeg source tree
#   ./build_android
#
# It generates binary for following architectures:
#     ARMv6 
#     ARMv6+VFP 
#     ARMv7+VFPv3-d16 (Tegra2) 
#     ARMv7+Neon (Cortex-A8)
#
# Customizing:
# 1. Feel free to change ./configure parameters for more features
# 2. To adapt other ARM variants
#       set $CPU and $OPTIMIZE_CFLAGS 
#       call build_one
######################################################

export TMPDIR=D:/tmp/android
export NDK=D:/android-ndk-r4

#PLATFORM=$NDK/build/platforms/android-8/arch-arm/
PLATFORM=$NDK/build/platforms/android-8/arch-arm
#PREBUILT=$NDK/build/prebuilt/darwin-x86/arm-eabi-4.4.0
PREBUILT=$NDK/build/prebuilt/windows/arm-eabi-4.4.0

function build_one
{

# -fasm : required. Android header file uses asm keyword instead of __asm__ , but most of c dialect (like ansi,c99,gnu99) implies -fno-asm.
#   ~/android/android-ndk-r4/build/platforms/android-5/arch-arm//usr/include/asm/byteorder.h: In function '___arch__swab32':
#   ~/android/android-ndk-r4/build/platforms/android-5/arch-arm//usr/include/asm/byteorder.h:25: error: expected ')' before ':' token

# -fno-short-enums : optimized.  Else FFmpeg obj will generate a huge number of warning for variable-size enums, 
#   though we may suppress them by --no-enum-size-warning, it would be better to avoid it.
#   .../ld: warning: cmdutils.o uses variable-size enums yet the output is to use 32-bit enums; use of enum values across objects may fail

# --extra-libs="-lgcc" : required. Else cannot solve some runtime function symbols
#   ... undefined reference to `__aeabi_f2uiz'

# --enable-protocols : required. Without this option, the file open always fails mysteriously.
#   FFmpeg's av_open_input_file will invoke file format probing functions, but because most of useful demuxers has flag of zero 
#   which cause them are ignored during file format probling and fall to url stream parsing,
#   if protocols are disabled, the file:// url cannot be opened as well.

# $PREBUILT/bin/arm-eabi-ar d libavcodec/libavcodec.a inverse.o : required.
#   FFmpeg includes two copies of inverse.c both in libavutil and libavcodec for performance consideration (not sure the benifit yet)
#   Without this step, final ld of generating libffmpeg.so will fail silently, if invoke ld through gcc, gcc will collect more reasonable error message.

# -llog: debug only, FFmpeg itself doesn't require it at all.
#   With this option, we may simply includes "utils/Log.h" and use LOGx() to observe FFmpeg's behavior
#   PS, it seems the toolchain implies -DNDEBUG somewhere, it would be safer to use following syntax
#    #ifdef NDEBUG
#        #undef NDEBUG
#        #define HAVE_NDEBUG
#    #endif
#    #include "utils/Log.h"
#    #ifdef HAVE_NDEBUG
#        #define NDEBUG
#        #undef HAVE_NDEBUG
#    #endif

# --whole-archive : required. Else ld generate a small .so file (about 15k)

# --no-stdlib : required. Android doesn't use standard c runtime but invited its own wheal (bionic libc) because of license consideration.

# space before \ of configure lines: required for some options. Else next line will be merged into previous lines's content and cause problem.
#   Especially the --extra-cflags, the next line will pass to gcc in this case and configure will say gcc cannot create executable.

# many options mentioned by articles over internet are implied by -O2 or -O3 already, need not repeat at all.

# two or three common optimization cflags are omitted because not sure about the trade off yet. invoke NDK build system with V=1 to find them.

# -Wl,-T,$PREBUILT/arm-eabi/lib/ldscripts/armelf.x mentioned by almost every articles over internet, but it is not required to specify at all.

# -Dipv6mr_interface=ipv6mr_ifindex : required. Android inet header doesn't use ipv6mr_interface which is required by rfc, seems it generate this user space header file directly from kernel header file, but Linux kernel has decided to keep its own name for ever and ask user space header to use rfc name.

# HAVE_SYS_UIO_H : required. Else:
# In file included from ~/android/android-ndk-r4/build/platforms/android-5/arch-arm//usr/include/linux/socket.h:29,
#                 from ~/android/android-ndk-r4/build/platforms/android-5/arch-arm//usr/include/sys/socket.h:33,
#                 from libavformat/network.h:35,
#                 from libavformat/utils.c:46:
#~/android/android-ndk-r4/build/platforms/android-5/arch-arm//usr/include/linux/uio.h:19: error: redefinition of 'struct iovec'
#

# --disable-doc : required because of strange bug of toolchain.
#

#
#--extra-ldflags=-Wl,-T,$PREBUILT/arm-eabi/lib/ldscripts/armelf.x -Wl,-rpath-link=$PLATFORM/usr/lib -L$PLATFORM/usr/lib -nostdlib $PREBUILT/lib/gcc/arm-eabi/4.4.0/crtbegin.o $PREBUILT/lib/gcc/arm-eabi/4.4.0/crtend.o -lc -lm -ldl"
#

./configure --target-os=linux \
    --prefix=$PREFIX \
    --enable-cross-compile \
    --extra-libs="-lgcc" \
    --arch=arm \
    --cc=$PREBUILT/bin/arm-eabi-gcc \
    --cross-prefix=$PREBUILT/bin/arm-eabi- \
    --nm=$PREBUILT/bin/arm-eabi-nm \
    --sysroot=$PLATFORM \
   --extra-cflags=" -O3 -fpic -DANDROID -DHAVE_SYS_UIO_H=1 -Dipv6mr_interface=ipv6mr_ifindex -fasm -Wno-psabi -fno-short-enums  -fno-strict-aliasing -finline-limit=300 $OPTIMIZE_CFLAGS " \
    --disable-shared \
    --enable-static \
    --extra-ldflags="-Wl,-rpath-link=$PLATFORM/usr/lib -L$PLATFORM/usr/lib  -nostdlib -lc -lm -ldl -llog" \
    --enable-parsers \
    --disable-encoders  \
    --enable-decoders \
    --disable-muxers \
    --enable-demuxers \
    --enable-swscale  \
    --disable-ffplay \
    --disable-ffprobe \
    --disable-ffserver \
    --enable-network \
    --enable-indevs \
    --disable-bsfs \
    --disable-filters \
    --enable-protocols  \
    --enable-asm \
    --disable-doc \
    $ADDITIONAL_CONFIGURE_FLAG

##make clean
make  -j4 install


$PREBUILT/bin/arm-eabi-ar d libavcodec/libavcodec.a inverse.o

$PREBUILT/bin/arm-eabi-ld -rpath-link=$PLATFORM/usr/lib -L$PLATFORM/usr/lib  -soname libffmpeg.so -shared -nostdlib  -z,noexecstack -Bsymbolic --whole-archive --no-undefined -o $PREFIX/libffmpeg.so libavcodec/libavcodec.a libavformat/libavformat.a libavutil/libavutil.a  -lc -lm -lz -ldl -llog  --warn-once  --dynamic-linker=/system/bin/linker $PREBUILT/lib/gcc/arm-eabi/4.4.0/libgcc.a

}


#arm v6
CPU=armv6
OPTIMIZE_CFLAGS="-marm -march=$CPU"
PREFIX=./android/$CPU 
ADDITIONAL_CONFIGURE_FLAG=
build_one

#arm v7vfpv3
CPU=armv7-a
OPTIMIZE_CFLAGS="-mfloat-abi=softfp -mfpu=vfpv3-d16 -marm -march=$CPU "
PREFIX=./android/$CPU 
ADDITIONAL_CONFIGURE_FLAG=
build_one

#arm v7vfp
CPU=armv7-a
OPTIMIZE_CFLAGS="-mfloat-abi=softfp -mfpu=vfp -marm -march=$CPU "
PREFIX=./android/$CPU-vfp
ADDITIONAL_CONFIGURE_FLAG=
build_one

#arm v7n
CPU=armv7-a
OPTIMIZE_CFLAGS="-mfloat-abi=softfp -mfpu=neon -marm -march=$CPU -mtune=cortex-a8"
PREFIX=./android/$CPU-neon 
ADDITIONAL_CONFIGURE_FLAG=--enable-neon
build_one

#arm v6+vfp
CPU=armv6
OPTIMIZE_CFLAGS="-DCMP_HAVE_VFP -mfloat-abi=softfp -mfpu=vfp -marm -march=$CPU"
PREFIX=./android/${CPU}_vfp 
ADDITIONAL_CONFIGURE_FLAG=
build_one
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T06:33:13+00:00Added an answer on May 30, 2026 at 6:33 am

    You should strip, strip the .so, add this line

    $PREBUILT/bin/arm-eabi-strip -g $PREFIX/libffmpeg.so

    below

    $PREBUILT/bin/arm-eabi-ld -rpath-link=$PLATFORM/usr/lib …

    Then the size of .so will be small enough,

    but player may still can’t work, libswscale/libswscale.a should add to libffmpeg.so, add it in this line :

    $PREBUILT/bin/arm-eabi-ld -rpath-link=$PLATFORM/usr/lib -L$PLATFORM/usr/lib -soname libffmpeg.so -shared -nostdlib -z,noexecstack -Bsymbolic –whole-archive –no-undefined -o $PREFIX/libffmpeg.so libavcodec/libavcodec.a libavformat/libavformat.a libswscale/libswscale.a …

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I download and build android 1.5r3 source. I did 'launch 1' and then 'make'.
I've the source code of ffmpeg and would like to build it in my
when tried to build a AIR application for android using flex builder I did
Is it possible to bulk update? I did a build insert, now I would
On my first job interview, I was asked why did I build my own
Did you ever had a bug in your code, you could not resolve? I
I'm trying to compile the ffmpeg by using the make and build files in
This Android application on Google uses the following method to refresh the database after
I just did a clean build and reinstall of lighttpd 1.4.20 on Mac OS
Did somebody tried to build Qt 4.5 with Visual Studio 2010 (Beta 2)? Any

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.