├── .gitignore ├── .gitmodules ├── AndroidManifest.xml ├── README ├── build.properties ├── build.sh ├── build.xml ├── build_mconf.sh ├── default.properties ├── jni ├── .gitignore ├── Android.mk └── Application.mk ├── proguard.cfg ├── res ├── drawable-hdpi │ └── icon.png ├── drawable-ldpi │ └── icon.png ├── drawable-mdpi │ └── icon.png ├── layout │ └── main.xml └── values │ └── strings.xml └── src └── org └── fake └── project └── FakeActivity.java /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | obj/ 3 | local.properties 4 | libs/ 5 | config.log 6 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "jni/ffmpeg"] 2 | path = jni/ffmpeg 3 | url = git@github.com:mconf/ffmpeg.git 4 | -------------------------------------------------------------------------------- /AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | In order to compile the FFmpeg for Android, you will need to download the Android NDK. After that, open the 'build.sh' script and replace the path to the NDK (variable NDK_DIR) with yours. 2 | 3 | Before compile, you need to update the FFmpeg repository. To do that, execute: 4 | 5 | git submodule init 6 | git submodule update 7 | 8 | Then execute 'sh build.sh', and after that the compiled libraries will be at 'libs/armeabi/'. -------------------------------------------------------------------------------- /build.properties: -------------------------------------------------------------------------------- 1 | # This file is used to override default values used by the Ant build system. 2 | # 3 | # This file must be checked in Version Control Systems, as it is 4 | # integral to the build system of your project. 5 | 6 | # This file is only used by the Ant script. 7 | 8 | # You can use this to override default values such as 9 | # 'source.dir' for the location of your java source folder and 10 | # 'out.dir' for the location of your output folder. 11 | 12 | # You can also use it define how the release builds are signed by declaring 13 | # the following properties: 14 | # 'key.store' for the location of your keystore and 15 | # 'key.alias' for the name of the key to use. 16 | # The password will be asked during the build when you use the 'release' target. 17 | 18 | -------------------------------------------------------------------------------- /build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | NDK_DIR=~/Codes/android-ndk-r6b 4 | 5 | if [ ! -d "$NDK_DIR" ]; then 6 | echo "Please set correctly your Android Native Development Kit path" 7 | echo "Current path: $NDK_DIR" 8 | return 9 | fi 10 | 11 | if [ `cat $NDK_DIR/RELEASE.TXT | grep 'r6b' | wc -l` -eq 0 ]; then 12 | echo "This script is prepared to compile FFmpeg using the NDK version r6b" 13 | echo "Please download the right version of NDK" 14 | return 15 | fi 16 | 17 | PREBUILT=$NDK_DIR/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86 18 | PLATFORM=$NDK_DIR/platforms/android-8/arch-arm 19 | 20 | clean() { 21 | rm -f jni/*.tmp 22 | rm -f jni/*_files.mk 23 | } 24 | 25 | list_files() { 26 | rm -f ../$1_source.tmp 27 | 28 | # run a fake make 29 | make --dry-run | \ 30 | # select the just the files from the wanted library 31 | egrep -i "$1/" | \ 32 | # select all the occurrences of .c and .S filenames 33 | grep "[^ ]*\.[cS]" -o | \ 34 | # put the result on .mk file 35 | sort >> ../$1_source.tmp 36 | 37 | echo 'LOCAL_SRC_FILES := \' > ../$1_files.mk 38 | cat ../$1_source.tmp | \ 39 | # put a \ at the end of each line 40 | sed -e 's:$: \\:g' >> ../$1_files.mk 41 | 42 | cat ../$1_source.tmp > ../base.tmp 43 | rm -f ../$1_header.tmp; touch ../$1_header.tmp 44 | 45 | while [ `cat ../base.tmp | wc -l` -gt 0 ] 46 | do 47 | rm -f ../include.tmp 48 | 49 | for filename in `cat ../base.tmp` 50 | do 51 | if [ -e $filename ] 52 | then 53 | folder=`dirname $filename` 54 | cat $filename | \ 55 | # keeps the lines with #include "" 56 | # grep '^#include "[^"]*"' | \ 57 | grep '^#include "[^"]*"' >> ../include.tmp 58 | # keeps only the header name 59 | # sed -e 's:\([^"]*\)\"\([^"]*\)\".*:\2:' | \ 60 | # include the folder name (in case it is not already there) 61 | # sed -e "/^lib/!s/.*/\0\n$folder\/\0/g" >> ../include.tmp 62 | fi 63 | done 64 | # keeps only the header name 65 | sed -i 's:\([^"]*\)\"\([^"]*\)\".*:\2:' ../include.tmp 66 | # include the folder name (in case it is not already there) 67 | sed -i "/^lib/!s/.*/\0\n$folder\/\0/g" ../include.tmp 68 | 69 | rm -f ../base.tmp; touch ../base.tmp 70 | for filename in `cat ../include.tmp` 71 | do 72 | if [ -e $filename ] 73 | then 74 | if [ `cat ../$1_header.tmp | grep "$filename" | wc -l` -eq 0 ] 75 | then 76 | echo $filename >> ../$1_header.tmp 77 | echo $filename >> ../base.tmp 78 | fi 79 | fi 80 | done 81 | done 82 | 83 | # copy all the headers to a specific folder 84 | for filename in `cat ../$1_header.tmp` 85 | do 86 | if [ -e $filename ] 87 | then 88 | mkdir -p `dirname ../built_headers/$filename` 89 | cp $filename ../built_headers/$filename > /dev/null 2>&1 90 | fi 91 | done 92 | } 93 | 94 | clean 95 | cd jni/ffmpeg 96 | 97 | ./configure --target-os=linux \ 98 | --disable-ffmpeg \ 99 | --disable-ffprobe \ 100 | --arch=arm \ 101 | --enable-version3 \ 102 | --enable-gpl \ 103 | --enable-nonfree \ 104 | --enable-cross-compile \ 105 | --cc=$PREBUILT/bin/arm-linux-androideabi-gcc \ 106 | --cross-prefix=$PREBUILT/bin/arm-linux-androideabi- \ 107 | --nm=$PREBUILT/bin/arm-linux-androideabi-nm \ 108 | --extra-cflags="-fPIC -DANDROID -I$PLATFORM/usr/include" \ 109 | --enable-armv5te \ 110 | --extra-ldflags="-Wl,-T,$PREBUILT/arm-linux-androideabi/lib/ldscripts/armelf_linux_eabi.x -Wl,-rpath-link=$PLATFORM/usr/lib -L$PLATFORM/usr/lib -nostdlib $PREBUILT/lib/gcc/arm-linux-androideabi/4.4.3/crtbegin.o $PREBUILT/lib/gcc/arm-linux-androideabi/4.4.3/crtend.o -lc -lm -ldl" \ 111 | --logfile=../configure.log 112 | 113 | rm -rf ../built_headers 114 | mkdir ../built_headers 115 | 116 | list_files 'libavutil' 117 | list_files 'libavcodec' 118 | list_files 'libavformat' 119 | list_files 'libswscale' 120 | #list_files 'libavdevice' 121 | #list_files 'libpostproc' 122 | #list_files 'libavfilter' 123 | 124 | cd ../.. 125 | 126 | $NDK_DIR/ndk-build clean 127 | $NDK_DIR/ndk-build -j 8 128 | clean -------------------------------------------------------------------------------- /build.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 10 | 27 | 28 | 29 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 42 | 54 | 55 | 77 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /build_mconf.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | NDK_DIR=~/Codes/android-ndk-r6b 4 | 5 | if [ ! -d "$NDK_DIR" ]; then 6 | echo "Please set correctly your Android Native Development Kit path" 7 | echo "Current path: $NDK_DIR" 8 | return 9 | fi 10 | 11 | if [ `cat $NDK_DIR/RELEASE.TXT | grep 'r6b' | wc -l` -eq 0 ]; then 12 | echo "This script is prepared to compile FFmpeg using the NDK version r6b" 13 | echo "Please download the right version of NDK" 14 | return 15 | fi 16 | 17 | PREBUILT=$NDK_DIR/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86 18 | PLATFORM=$NDK_DIR/platforms/android-8/arch-arm 19 | 20 | clean() { 21 | rm -f jni/*.tmp 22 | rm -f jni/*_files.mk 23 | } 24 | 25 | list_files() { 26 | rm -f ../$1_source.tmp 27 | 28 | # run a fake make 29 | make --dry-run | \ 30 | # select the just the files from the wanted library 31 | egrep -i "$1/" | \ 32 | # select all the occurrences of .c and .S filenames 33 | grep "[^ ]*\.[cS]" -o | \ 34 | # put the result on .mk file 35 | sort >> ../$1_source.tmp 36 | 37 | # point corrections 38 | if [ $1 = 'libavcodec' ]; 39 | then 40 | echo 'libavcodec/rawdec.c' >> ../$1_source.tmp 41 | fi 42 | 43 | echo 'LOCAL_SRC_FILES := \' > ../$1_files.mk 44 | cat ../$1_source.tmp | \ 45 | # put a \ at the end of each line 46 | sed -e 's:$: \\:g' >> ../$1_files.mk 47 | 48 | cat ../$1_source.tmp > ../base.tmp 49 | rm -f ../$1_header.tmp; touch ../$1_header.tmp 50 | 51 | while [ `cat ../base.tmp | wc -l` -gt 0 ] 52 | do 53 | rm -f ../include.tmp 54 | 55 | for filename in `cat ../base.tmp` 56 | do 57 | if [ -e $filename ] 58 | then 59 | folder=`dirname $filename` 60 | cat $filename | \ 61 | # keeps the lines with #include "" 62 | # grep '^#include "[^"]*"' | \ 63 | grep '^#include "[^"]*"' >> ../include.tmp 64 | # keeps only the header name 65 | # sed -e 's:\([^"]*\)\"\([^"]*\)\".*:\2:' | \ 66 | # include the folder name (in case it is not already there) 67 | # sed -e "/^lib/!s/.*/\0\n$folder\/\0/g" >> ../include.tmp 68 | fi 69 | done 70 | # keeps only the header name 71 | sed -i 's:\([^"]*\)\"\([^"]*\)\".*:\2:' ../include.tmp 72 | # include the folder name (in case it is not already there) 73 | sed -i "/^lib/!s/.*/\0\n$folder\/\0/g" ../include.tmp 74 | 75 | rm -f ../base.tmp; touch ../base.tmp 76 | for filename in `cat ../include.tmp` 77 | do 78 | if [ -e $filename ] 79 | then 80 | if [ `cat ../$1_header.tmp | grep "$filename" | wc -l` -eq 0 ] 81 | then 82 | echo $filename >> ../$1_header.tmp 83 | echo $filename >> ../base.tmp 84 | fi 85 | fi 86 | done 87 | done 88 | 89 | # copy all the headers to a specific folder 90 | for filename in `cat ../$1_header.tmp` 91 | do 92 | if [ -e $filename ] 93 | then 94 | mkdir -p `dirname ../built_headers/$filename` 95 | cp $filename ../built_headers/$filename > /dev/null 2>&1 96 | fi 97 | done 98 | } 99 | 100 | clean 101 | cd jni/ffmpeg 102 | 103 | ./configure --target-os=linux \ 104 | --disable-everything \ 105 | --disable-postproc \ 106 | --disable-avfilter \ 107 | --disable-network \ 108 | --disable-ffmpeg \ 109 | --disable-ffprobe \ 110 | --arch=arm \ 111 | --enable-version3 \ 112 | --enable-gpl \ 113 | --enable-nonfree \ 114 | --enable-cross-compile \ 115 | --enable-encoder=flv \ 116 | --enable-decoder=flv \ 117 | --cc=$PREBUILT/bin/arm-linux-androideabi-gcc \ 118 | --cross-prefix=$PREBUILT/bin/arm-linux-androideabi- \ 119 | --nm=$PREBUILT/bin/arm-linux-androideabi-nm \ 120 | --extra-cflags="-fPIC -DANDROID -I$PLATFORM/usr/include" \ 121 | --enable-armv5te \ 122 | --extra-ldflags="-Wl,-T,$PREBUILT/arm-linux-androideabi/lib/ldscripts/armelf_linux_eabi.x -Wl,-rpath-link=$PLATFORM/usr/lib -L$PLATFORM/usr/lib -nostdlib $PREBUILT/lib/gcc/arm-linux-androideabi/4.4.3/crtbegin.o $PREBUILT/lib/gcc/arm-linux-androideabi/4.4.3/crtend.o -lc -lm -ldl" \ 123 | --logfile=../configure.log 124 | 125 | rm -rf ../built_headers 126 | mkdir ../built_headers 127 | 128 | list_files 'libavutil' 129 | list_files 'libavcodec' 130 | list_files 'libavformat' 131 | list_files 'libswscale' 132 | 133 | cd ../.. 134 | 135 | $NDK_DIR/ndk-build clean 136 | $NDK_DIR/ndk-build -j 8 137 | clean -------------------------------------------------------------------------------- /default.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system use, 7 | # "build.properties", and override values to adapt the script to your 8 | # project structure. 9 | 10 | # Project target. 11 | target=Google Inc.:Google APIs:8 12 | -------------------------------------------------------------------------------- /jni/.gitignore: -------------------------------------------------------------------------------- 1 | *_files.mk 2 | *.log 3 | *.options 4 | built_headers/ 5 | -------------------------------------------------------------------------------- /jni/Android.mk: -------------------------------------------------------------------------------- 1 | #this directory variable declaration 2 | LOCAL_PATH := $(call my-dir)/ffmpeg 3 | 4 | #swscale module 5 | include $(CLEAR_VARS) 6 | LOCAL_MODULE := swscale 7 | LOCAL_ARM_MODE := arm 8 | LOCAL_CFLAGS := -DHAVE_AV_CONFIG_H 9 | LOCAL_SHARED_LIBRARIES := avutil 10 | LOCAL_LDFLAGS := 11 | include $(LOCAL_PATH)/../lib$(LOCAL_MODULE)_files.mk 12 | include $(BUILD_SHARED_LIBRARY) 13 | #end of swscale module 14 | 15 | #avutil module 16 | include $(CLEAR_VARS) 17 | LOCAL_MODULE := avutil 18 | LOCAL_ARM_MODE := arm 19 | LOCAL_CFLAGS := -DHAVE_AV_CONFIG_H 20 | include $(LOCAL_PATH)/../lib$(LOCAL_MODULE)_files.mk 21 | include $(BUILD_SHARED_LIBRARY) 22 | #end of avutil module 23 | 24 | #avformat module 25 | include $(CLEAR_VARS) 26 | LOCAL_MODULE := avformat 27 | LOCAL_ARM_MODE := arm 28 | LOCAL_CFLAGS := -DHAVE_AV_CONFIG_H 29 | include $(LOCAL_PATH)/../lib$(LOCAL_MODULE)_files.mk 30 | LOCAL_SHARED_LIBRARIES := avutil avcodec 31 | LOCAL_LDFLAGS := -L$(SYSROOT)/usr/lib -lz 32 | include $(BUILD_SHARED_LIBRARY) 33 | #end of avformat module 34 | 35 | #avcodec module 36 | include $(CLEAR_VARS) 37 | LOCAL_MODULE := avcodec 38 | LOCAL_ARM_MODE := arm 39 | LOCAL_CFLAGS := -DHAVE_AV_CONFIG_H 40 | include $(LOCAL_PATH)/../lib$(LOCAL_MODULE)_files.mk 41 | LOCAL_SHARED_LIBRARIES := avutil 42 | LOCAL_LDFLAGS := -L$(SYSROOT)/usr/lib -lz -lm 43 | include $(BUILD_SHARED_LIBRARY) 44 | #end of avcodec module -------------------------------------------------------------------------------- /jni/Application.mk: -------------------------------------------------------------------------------- 1 | APP_MODULES := avcodec avutil avformat swscale -------------------------------------------------------------------------------- /proguard.cfg: -------------------------------------------------------------------------------- 1 | -optimizationpasses 5 2 | -dontusemixedcaseclassnames 3 | -dontskipnonpubliclibraryclasses 4 | -dontpreverify 5 | -verbose 6 | -optimizations !code/simplification/arithmetic,!field/*,!class/merging/* 7 | 8 | -keep public class * extends android.app.Activity 9 | -keep public class * extends android.app.Application 10 | -keep public class * extends android.app.Service 11 | -keep public class * extends android.content.BroadcastReceiver 12 | -keep public class * extends android.content.ContentProvider 13 | -keep public class * extends android.app.backup.BackupAgentHelper 14 | -keep public class * extends android.preference.Preference 15 | -keep public class com.android.vending.licensing.ILicensingService 16 | 17 | -keepclasseswithmembernames class * { 18 | native ; 19 | } 20 | 21 | -keepclasseswithmembernames class * { 22 | public (android.content.Context, android.util.AttributeSet); 23 | } 24 | 25 | -keepclasseswithmembernames class * { 26 | public (android.content.Context, android.util.AttributeSet, int); 27 | } 28 | 29 | -keepclassmembers enum * { 30 | public static **[] values(); 31 | public static ** valueOf(java.lang.String); 32 | } 33 | 34 | -keep class * implements android.os.Parcelable { 35 | public static final android.os.Parcelable$Creator *; 36 | } 37 | -------------------------------------------------------------------------------- /res/drawable-hdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mconf/android-ffmpeg/c027b514b01c139348ce4f740a0410119182807b/res/drawable-hdpi/icon.png -------------------------------------------------------------------------------- /res/drawable-ldpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mconf/android-ffmpeg/c027b514b01c139348ce4f740a0410119182807b/res/drawable-ldpi/icon.png -------------------------------------------------------------------------------- /res/drawable-mdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mconf/android-ffmpeg/c027b514b01c139348ce4f740a0410119182807b/res/drawable-mdpi/icon.png -------------------------------------------------------------------------------- /res/layout/main.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | FakeActivity 4 | 5 | -------------------------------------------------------------------------------- /src/org/fake/project/FakeActivity.java: -------------------------------------------------------------------------------- 1 | package org.fake.project; 2 | 3 | import android.app.Activity; 4 | import android.os.Bundle; 5 | 6 | public class FakeActivity extends Activity 7 | { 8 | /** Called when the activity is first created. */ 9 | @Override 10 | public void onCreate(Bundle savedInstanceState) 11 | { 12 | super.onCreate(savedInstanceState); 13 | setContentView(R.layout.main); 14 | } 15 | } 16 | --------------------------------------------------------------------------------