Skip to content

Commit 95fbf84

Browse files
committedSep 15, 2014
Update README.md
Updates to instructions and added Android notes.
1 parent 1a939b3 commit 95fbf84

File tree

1 file changed

+57
-5
lines changed

1 file changed

+57
-5
lines changed
 

‎README.md

+57-5
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ This repository contains script(s) to build ffmpeg for android with RTMP (and Op
66

77
1. Install the [Android NDK][android-ndk] (tested with version r10).
88
2. Ensure that [cURL][cURL] is installed.
9-
3. Clone this repository and `cd` into its directory.
10-
4. Run `build.sh`.
11-
5. Look in `build/dist` for the resulting libraries and executables.
12-
6. Look in `build/build.log` if something goes wrong.
9+
3. Ensure that [pkg-config][pkg-config] is installed.
10+
4. Clone this repository and `cd` into its directory.
11+
5. Run `build.sh`.
12+
6. Look in `build/dist` for the resulting libraries and executables.
13+
7. Look in `build/build.log` if something goes wrong.
1314

1415
For example:
1516

@@ -36,6 +37,56 @@ $ rm -rf src build .build-config.sh
3637
$ ./build.sh
3738
```
3839

40+
## Android
41+
42+
To use `ffmpeg` with an Android app you will need to deploy the binaries along
43+
with the libraries. Here's a listing of the `build/dist` directory.
44+
45+
```
46+
.
47+
├── bin
48+
│   ├── ffmpeg
49+
│   ├── openssl
50+
│   └── ssltest
51+
└── lib
52+
   ├── libavcodec-56.so
53+
   ├── libavdevice-56.so
54+
   ├── libavfilter-5.so
55+
   ├── libavformat-56.so
56+
   ├── libavutil-54.so
57+
   ├── libcrypto.so
58+
   ├── librtmp-1.so
59+
   ├── libssl.so
60+
   ├── libswresample-1.so
61+
   └── libswscale-3.so
62+
```
63+
64+
A simple way to deploy the binaries would be to archive (e.g. zip) these directories
65+
and copy the archive in a res/raw directory within the Android project. Then at runtime,
66+
unpack the archive into a directory accessible to the app and set the appropriate permissions,
67+
e.g. chmod 750 -R directory-name.
68+
69+
In order for the Android app to use the libraries the LD_LIBRARY_PATH must be set to the location
70+
where the libraries reside. For example:
71+
72+
```java
73+
// Change the permissions
74+
Runtime.getRuntime().exec("chmod -R 0750 "+ abspath).waitFor();
75+
76+
//...
77+
78+
ProcessBuilder processBuilder = new ProcessBuilder(cmd);
79+
80+
final Map<String, String> environment = processBuilder.environment();
81+
82+
environment.put("LD_LIBRARY_PATH", context.getDir("lib", 0).getAbsolutePath());
83+
84+
Process process = processBuilder.start();
85+
86+
//...
87+
```
88+
89+
3990
## Acknowledgements
4091

4192
Inspired by: [openssl-android][openssl-android] and [FFmpeg-Android][FFmpeg-Android].
@@ -45,4 +96,5 @@ Inspired by: [openssl-android][openssl-android] and [FFmpeg-Android][FFmpeg-Andr
4596
[openssl-android]:https://github.com/guardianproject/openssl-android
4697
[FFmpeg-Android]:https://github.com/OnlyInAmerica/FFmpeg-Android
4798
[android-ndk]:https://developer.android.com/tools/sdk/ndk/index.html
48-
[cURL]:http://curl.haxx.se/
99+
[cURL]:http://curl.haxx.se/
100+
[pkg-config]:http://www.freedesktop.org/wiki/Software/pkg-config/

0 commit comments

Comments
 (0)
Please sign in to comment.