├── .gitignore
├── AndroidManifest.xml
├── README.md
├── build.sh
├── libs
└── android-support-v4.jar
├── proguard-project.txt
├── project.properties
├── res
├── drawable-hdpi
│ └── ic_launcher.png
├── drawable-mdpi
│ └── ic_launcher.png
├── drawable-xhdpi
│ └── ic_launcher.png
├── layout
│ └── activity_main.xml
├── menu
│ └── main.xml
├── raw
│ └── ffmpeg
├── values-sw600dp
│ └── dimens.xml
├── values-sw720dp-land
│ └── dimens.xml
├── values-v11
│ └── styles.xml
├── values-v14
│ └── styles.xml
└── values
│ ├── dimens.xml
│ ├── strings.xml
│ └── styles.xml
├── screenshots
└── 2013-04-01 00.44.25.png
└── src
└── za
└── jamie
└── androidffmpegcmdline
├── MainActivity.java
└── ffmpeg
├── FfmpegJob.java
├── ProcessRunnable.java
└── Utils.java
/.gitignore:
--------------------------------------------------------------------------------
1 | # built application files
2 | *.apk
3 | *.ap_
4 |
5 | # files for the dex VM
6 | *.dex
7 |
8 | # Java class files
9 | *.class
10 |
11 | # generated files
12 | bin/
13 | gen/
14 |
15 | # Local configuration file (sdk path, etc)
16 | local.properties
17 |
18 | # Eclipse project files
19 | .classpath
20 | .project
21 |
--------------------------------------------------------------------------------
/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
10 |
11 |
12 |
17 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | android-ffmpeg-cmdline
2 | ======================
3 |
4 | Command-line ffmpeg for android (very loosely based on https://github.com/guardianproject/android-ffmpeg-java).
5 | This implementation has a number of (fairly severe) issues (see 'Other notes') but for a quick-and-dirty application of ffmpeg it may be useful.
6 |
7 | 
8 |
9 | Included in this repo is:
10 | -------------------------
11 | 1. A build script for ffmpeg for Android (build.sh)
12 |
13 | 2. Prebuilt static library of ffmpeg for Android (res/raw/ffmpeg)
14 |
15 | 3. The Java wrapper for the ffmpeg static library, which is really just a wrapper for access to the commandline through Java's Process class.
16 |
17 | 4. A demo app. The screenshot should explain everything. (Requires Android 2.3)
18 |
19 | About this ffmpeg build:
20 | ------------------------
21 | - Based on ffmpeg 1.2
22 | - Built using the Android NDK r8e with the GCC 4.6 compiler (should be able to build back to r8b by changing build script to use x86 instead of x86_64)
23 | - This is the standard ffmpeg build (so with all the options switched on). By switching off options in the build script you could get the binary file size down to below 4MB from 8MB.
24 |
25 | Other notes:
26 | ------------
27 | - The key problem with ffmpeg on command-line is working around the Android permissions. As far as I can see, in Android 4.1, when you run a command line native program it runs as a user of some kind (in the Unix sense) that has virtually no access to any files. I could chmod and gain access to files in the application's directory but only on the internal memory (not the SD card) on my phone.
28 | - The binary file size is fairly large - 8MB - and there have to be 2 copies of it once the app is installed.
29 | - There are no nice callbacks from the Java Process that things have gone well or not. We only have stdout and stderr to work with.
30 |
--------------------------------------------------------------------------------
/build.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # set the base path to your Android NDK (or export NDK to environment)
4 |
5 | if [[ "x$NDK_BASE" == "x" ]]; then
6 | NDK_BASE=/opt/android-ndk
7 | echo "No NDK_BASE set, using $NDK_BASE"
8 | fi
9 |
10 | NDK_PLATFORM_VERSION=8
11 | NDK_ABI=arm
12 | NDK_COMPILER_VERSION=4.6
13 | NDK_SYSROOT=$NDK_BASE/platforms/android-$NDK_PLATFORM_VERSION/arch-$NDK_ABI
14 | NDK_UNAME=`uname -s | tr '[A-Z]' '[a-z]'` # Convert Linux -> linux
15 | HOST=$NDK_ABI-linux-androideabi
16 | NDK_TOOLCHAIN_BASE=$NDK_BASE/toolchains/$HOST-$NDK_COMPILER_VERSION/prebuilt/$NDK_UNAME-x86_64
17 | CC="$NDK_TOOLCHAIN_BASE/bin/$HOST-gcc --sysroot=$NDK_SYSROOT"
18 | LD=$NDK_TOOLCHAIN_BASE/bin/$HOST-ld
19 |
20 | BUILD_PATH=build/ffmpeg
21 |
22 | ./configure \
23 | $DEBUG_FLAG \
24 | --arch=arm \
25 | --target-os=linux \
26 | --enable-runtime-cpudetect \
27 | --enable-pic \
28 | --disable-shared \
29 | --enable-static \
30 | --cross-prefix=$NDK_TOOLCHAIN_BASE/bin/$NDK_ABI-linux-androideabi- \
31 | --sysroot="$NDK_SYSROOT" \
32 | --extra-cflags="-march=armv6" \
33 | --extra-ldflags="" \
34 | --enable-ffmpeg \
35 | --disable-ffplay \
36 | --disable-ffprobe \
37 | --disable-ffserver \
38 | --disable-network \
39 |
--------------------------------------------------------------------------------
/libs/android-support-v4.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JayH5/android-ffmpeg-cmdline/643903bd4e30ef594bde8234ad7a3f6e17c4fc38/libs/android-support-v4.jar
--------------------------------------------------------------------------------
/proguard-project.txt:
--------------------------------------------------------------------------------
1 | # To enable ProGuard in your project, edit project.properties
2 | # to define the proguard.config property as described in that file.
3 | #
4 | # Add project specific ProGuard rules here.
5 | # By default, the flags in this file are appended to flags specified
6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt
7 | # You can edit the include path and order by changing the ProGuard
8 | # include property in project.properties.
9 | #
10 | # For more details, see
11 | # http://developer.android.com/guide/developing/tools/proguard.html
12 |
13 | # Add any project specific keep options here:
14 |
15 | # If your project uses WebView with JS, uncomment the following
16 | # and specify the fully qualified class name to the JavaScript interface
17 | # class:
18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
19 | # public *;
20 | #}
21 |
--------------------------------------------------------------------------------
/project.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 edit
7 | # "ant.properties", and override values to adapt the script to your
8 | # project structure.
9 | #
10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
12 |
13 | # Project target.
14 | target=android-17
15 |
--------------------------------------------------------------------------------
/res/drawable-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JayH5/android-ffmpeg-cmdline/643903bd4e30ef594bde8234ad7a3f6e17c4fc38/res/drawable-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JayH5/android-ffmpeg-cmdline/643903bd4e30ef594bde8234ad7a3f6e17c4fc38/res/drawable-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/res/drawable-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JayH5/android-ffmpeg-cmdline/643903bd4e30ef594bde8234ad7a3f6e17c4fc38/res/drawable-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
20 |
21 |
22 |
23 |
24 |
33 |
34 |
41 |
42 |
49 |
50 |
58 |
59 |
65 |
66 |
73 |
74 |
79 |
80 |
89 |
90 |
99 |
100 |
101 |
102 |
110 |
111 |
119 |
120 |
127 |
128 |
135 |
136 |
137 |
138 |
144 |
145 |
152 |
153 |
161 |
162 |
169 |
170 |
178 |
179 |
186 |
187 |
194 |
195 |
196 |
197 |
198 |
199 |
206 |
207 |
--------------------------------------------------------------------------------
/res/menu/main.xml:
--------------------------------------------------------------------------------
1 |