@@ -6,10 +6,11 @@ This repository contains script(s) to build ffmpeg for android with RTMP (and Op
6
6
7
7
1 . Install the [ Android NDK] [ android-ndk ] (tested with version r10).
8
8
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.
13
14
14
15
For example:
15
16
@@ -36,6 +37,56 @@ $ rm -rf src build .build-config.sh
36
37
$ ./build.sh
37
38
```
38
39
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
+
39
90
## Acknowledgements
40
91
41
92
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
45
96
[ openssl-android ] :https://github.com/guardianproject/openssl-android
46
97
[ FFmpeg-Android ] :https://github.com/OnlyInAmerica/FFmpeg-Android
47
98
[ 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