|
1 | 1 | [FFmpeg-Android-Java](http://hiteshsondhi88.github.io/ffmpeg-android-java/) [](https://android-arsenal.com/details/1/931) |
2 | 2 | ============== |
3 | 3 |
|
4 | | -* FFmpeg for Android compiled with x264, libass, fontconfig, freetype and fribidi |
5 | | -* Supports Android L |
| 4 | +## About |
| 5 | +[FFmpeg Android java](http://hiteshsondhi88.github.io/ffmpeg-android-java/) is a java library that simplifies your task of using ffmpeg in Android project. |
| 6 | +There are the just two basic methods to use this library: |
| 7 | + |
| 8 | +`loadBinary(FFmpegLoadBinaryResponseHandler ffmpegLoadBinaryResponseHandler) throws FFmpegNotSupportedException` |
| 9 | +`execute(String cmd, FFmpegExecuteResponseHandler ffmpegExecuteResponseHandler) throws FFmpegCommandAlreadyRunningException` |
| 10 | + |
| 11 | +You just need to call above method and they will do the background work for you. |
| 12 | + |
| 13 | +For examples and usage instructions head over to: |
| 14 | +[hiteshsondhi88.github.io/ffmpeg-android-java] (http://hiteshsondhi88.github.io/ffmpeg-android-java/) |
6 | 15 |
|
7 | 16 | ## Supported Architecture |
8 | 17 | * armv7 |
9 | 18 | * armv7-neon |
10 | 19 | * x86 |
11 | 20 |
|
12 | | -## Adding Library to Project (Android Studio) |
13 | | -* TODO : I am still working to push this library to maven central repo |
14 | | -* Download [AAR File](https://github.com/hiteshsondhi88/ffmpeg-android-java/releases/download/v0.1.0/FFmpegAndroid.aar) |
15 | | -* Copy FFmpegAndroid.aar to app/libs |
16 | | -* In your app/build.gradle add |
17 | | -```groovy |
18 | | -repositories { |
19 | | - flatDir { |
20 | | - dirs 'libs' |
21 | | - } |
22 | | -} |
23 | | -
|
24 | | -dependencies { |
25 | | - compile(name:'FFmpegAndroid', ext:'aar') |
26 | | -} |
27 | | -``` |
28 | | -* Use the library |
29 | | - |
30 | | -## Usage |
31 | | - |
32 | | -### Load Binary |
33 | | -This method copies the ffmpeg binary to device according to device's architecture. You just need to put this once in your code, |
34 | | -whenever you are starting the application or using FFmpeg for the first time. This command does the following: |
35 | | -* Loads/Copies binary to device according to architecture |
36 | | -* Updates binary if it is using old FFmpeg version |
37 | | -* Provides callbacks through FFmpegLoadBinaryResponseHandler interface |
38 | | -```java |
39 | | -FFmpeg ffmpeg = FFmpeg.getInstance(context); |
40 | | -try { |
41 | | - ffmpeg.loadBinary(new FFmpegLoadBinaryResponseHandler() { |
42 | | - |
43 | | - @Override |
44 | | - public void onStart() {} |
45 | | - |
46 | | - @Override |
47 | | - public void onFailure() {} |
48 | | - |
49 | | - @Override |
50 | | - public void onSuccess() {} |
51 | | - |
52 | | - @Override |
53 | | - public void onFinish() {} |
54 | | - }); |
55 | | -} catch (FFmpegNotSupportedException e) { |
56 | | - // Handle if FFmpeg is not supported by device |
57 | | -} |
58 | | -``` |
59 | | - |
60 | | -### Execute Binary |
61 | | -This method executes ffmpeg command and provides callback through FFmpegExecuteResponseHandler interface. You also need to pass command as argument |
62 | | -to this method. |
63 | | -* To execute "ffmpeg -version" command you just need to pass "-version" as cmd parameter. |
64 | | -```java |
65 | | -FFmpeg ffmpeg = FFmpeg.getInstance(context); |
66 | | -try { |
67 | | - // to execute "ffmpeg -version" command you just need to pass "-version" |
68 | | - ffmpeg.execute(cmd, new FFmpegExecuteResponseHandler() { |
69 | | - |
70 | | - @Override |
71 | | - public void onStart() {} |
72 | | - |
73 | | - @Override |
74 | | - public void onProgress(String message) {} |
75 | | - |
76 | | - @Override |
77 | | - public void onFailure(String message) {} |
78 | | - |
79 | | - @Override |
80 | | - public void onSuccess(String message) {} |
81 | | - |
82 | | - @Override |
83 | | - public void onFinish() {} |
84 | | - }); |
85 | | -} catch (FFmpegCommandAlreadyRunningException e) { |
86 | | - // Handle if FFmpeg is already running |
87 | | -} |
88 | | -``` |
89 | | - |
90 | | -## Available Methods |
91 | | -* `loadBinary(FFmpegLoadBinaryResponseHandler ffmpegLoadBinaryResponseHandler) throws FFmpegNotSupportedException` |
92 | | -* `execute(Map<String, String> environvenmentVars, String cmd, FFmpegExecuteResponseHandler ffmpegExecuteResponseHandler) throws FFmpegCommandAlreadyRunningException` |
93 | | -* `execute(String cmd, FFmpegExecuteResponseHandler ffmpegExecuteResponseHandler) throws FFmpegCommandAlreadyRunningException` |
94 | | -* `getDeviceFFmpegVersion() throws FFmpegCommandAlreadyRunningException` |
95 | | -* `getLibraryFFmpegVersion()` |
96 | | -* `isFFmpegCommandRunning()` |
97 | | -* `killRunningProcesses()` |
98 | | -* `setTimeout(long timeout)` |
99 | | - |
100 | 21 | ## JavaDoc |
101 | 22 | * [Javadoc](http://hiteshsondhi88.github.io/ffmpeg-android-java/docs/) |
102 | 23 |
|
|
0 commit comments