2

I know this question may be possible duplicate of many others questions but there is no good answer nor a good tutorial available for it

I want to use ffmpeg in my project I am using android ndk7 on windows don't have a clue what ffmpeg code to download,compile tutorial available is for UBUNTU nothing much for windows

I would really appreciate a really good answer.

2 Answers 2

1

I was never able to build FFMPEG for Android under Windows but successfully did so under Ubuntu (after having some hard time though).

I used Oracle VM Virtual Box freeware to emulate Ubuntu machine under Windows.

I then built FFMPEG using the scripts from bambuser http://bambuser.com/opensource.

I then moved the resulting directory into the windows under my project's jni folder and referred the libs from my Android.mk

FFMPEG_DIR := ffmpeg
ifeq ($(TARGET_ARCH_ABI), armeabi)
FFMPEG_DIR := $(FFMPEG_DIR)/armeabi
else 
ifeq ($(TARGET_ARCH_ABI), armeabi-v7a) 
FFMPEG_DIR := $(FFMPEG_DIR)/armeabi-v7a
endif 
endif 

include $(CLEAR_VARS) 
LOCAL_MODULE := libavcodec
LOCAL_SRC_FILES := $(FFMPEG_DIR)/lib/$(LOCAL_MODULE).a
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
include $(PREBUILT_STATIC_LIBRARY)

include $(CLEAR_VARS) 
LOCAL_MODULE := libavcore
LOCAL_SRC_FILES := $(FFMPEG_DIR)/lib/$(LOCAL_MODULE).a
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
include $(PREBUILT_STATIC_LIBRARY)

include $(CLEAR_VARS) 
LOCAL_MODULE := libavdevice
LOCAL_SRC_FILES := $(FFMPEG_DIR)/lib/$(LOCAL_MODULE).a
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
include $(PREBUILT_STATIC_LIBRARY)

include $(CLEAR_VARS) 
LOCAL_MODULE := libavfilter
LOCAL_SRC_FILES := $(FFMPEG_DIR)/lib/$(LOCAL_MODULE).a
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
include $(PREBUILT_STATIC_LIBRARY)

include $(CLEAR_VARS) 
LOCAL_MODULE := libavformat
LOCAL_SRC_FILES := $(FFMPEG_DIR)/lib/$(LOCAL_MODULE).a
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
include $(PREBUILT_STATIC_LIBRARY)

include $(CLEAR_VARS) 
LOCAL_MODULE := libavutil
LOCAL_SRC_FILES := $(FFMPEG_DIR)/lib/$(LOCAL_MODULE).a
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
include $(PREBUILT_STATIC_LIBRARY)

include $(CLEAR_VARS) 
LOCAL_MODULE := libswscale
LOCAL_SRC_FILES := $(FFMPEG_DIR)/lib/$(LOCAL_MODULE).a
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
include $(PREBUILT_STATIC_LIBRARY)
Sign up to request clarification or add additional context in comments.

7 Comments

as I got your answer I should use ubuntu to compile ffmpeg bambuser.com/opensource. script using method specified here roman10.net/how-to-build-ffmpeg-for-android and then use it???
roman10's method didn't work for me. I've just used the build.sh script they on bambuser site have in their open-source distribution (take the latest version)
thanks alot for your efforts but since I don't know anything about it I am having a hard time understanding you I have installed ubuntu and downloaded bambuser code what should I do next shall I download ndk7 or ndk 5?? and how should I build the script in bambuser
ok I run build.sh it created a directory with one subfolder which contains two text files
There's a README file in the distribution. First run extract.sh then build. I don't rememeber everything by now but it builds pretty well
|
0

You can use this as build_android.sh i tested it and it worked with me

#!/bin/bash
NDK=D:/android/ndk/android-ndk-r10d
SYSROOT=$NDK/platforms/android-8/arch-arm/
TOOLCHAIN=$NDK/toolchains/arm-linux-androideabi-4.8/prebuilt/windows
function build_one
{
./configure \
--prefix=$PREFIX \
--disable-shared \
--enable-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

you need also to run this commands :

dos2unix build_android.sh
chmod +x build_android.sh
./build_android.sh

Use this Tutorial as reference

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.