Skip to content

Commit 116d33a

Browse files
committed
- Initial release (v1.0.0)
- FFmpeg version 7.1.1 - Updated README.md
1 parent 51f37e1 commit 116d33a

File tree

133 files changed

+31755
-1507
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

133 files changed

+31755
-1507
lines changed

CHANGELOG.md

Lines changed: 1 addition & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,4 @@
1-
## 2.0.0
2-
3-
* Uploaded updated Android .aar, compatible with Google 16 KB requirement
4-
* Updated `setup_ios.sh` script
5-
* Removed resource shrinking for Android
6-
* Updated `setup_ios.sh` script
7-
* Updated `setup_android.sh` script to include latest FFmpeg 7.0 kit
8-
* Upgraded `ffmpeg_kit_flutter_android` to 1.7.0
9-
* Merged @nischhalcodetrade fix for .aar post processing
10-
11-
## 1.6.1
12-
13-
* Removed manual packaging of prebuilt dependencies for Android
14-
* Cleaned up unnecessary logs
15-
16-
## 1.6.0
17-
18-
* Added new seamless Android .aar support
19-
20-
## 1.5.0
21-
22-
* Added MacOS support by directly downloading and unpacking frameworks
23-
24-
## 1.4.1
25-
26-
* Updated README.md
27-
28-
## 1.4.0
29-
30-
* Added build.bat jni
31-
* Updated Gradle script in order to be able to download and unpack .aar on Windows.
32-
33-
## 1.3.0
34-
35-
* Moved from FFmpeg `http` to `full_gpl` for Android
36-
* Added downloading and unpacking of 6.0.2 `full-gpl` .aar
37-
38-
## 1.2.1
39-
40-
* Added displaying of Android platform to pub.dev
41-
* Fixed static analysis issues
42-
43-
## 1.2.0
44-
45-
* New example project
46-
* Resurrected Android by creating new `ffmpeg_kit_flutter_android` library with `com.arthenica:ffmpeg-kit-https:6.0-2.LTS` implementation
47-
* iOS deployment target is increased to 14.0
48-
* Upgraded plugin_platform_interface version
49-
50-
## 1.1.0
51-
52-
* Moved from `https` to `full-gpl` binding for MacOS
53-
* Upgraded Flutter and Dart versions
54-
551
## 1.0.0
562

573
* Initial release
58-
* Fixed Android and MacOS bindings
59-
* Upgraded FFmpegKitFlutterPlugin.java to work with Flutter 3.29
4+
* FFmpeg version 7.1.1

LICENSE.GPLv3

Lines changed: 0 additions & 674 deletions
This file was deleted.

README.md

Lines changed: 105 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,117 @@
1+
<div align="center">
12

2-
# FFmpegKit for Flutter [![pub](https://img.shields.io/badge/pub-2.0.0-blue)](https://pub.dev/packages/ffmpeg_kit_flutter_new) [![discord](https://img.shields.io/badge/discord-purple)](https://discord.gg/s2HCWep9)
3+
# FFmpegKit for Flutter. Minimal version.
4+
5+
_Fork of the original FFmpeg Kit library to work with Android V2 bindings and Flutter 3+_
6+
7+
<p align="center">
8+
<a href="https://pub.dev/packages/ffmpeg_kit_flutter_new_min">
9+
<img src="https://img.shields.io/badge/pub-1.0.0-blue?logo=dart" alt="pub">
10+
</a>
11+
<a href="https://discord.gg/8NVwykjA">
12+
<img src="https://img.shields.io/discord/1387108888452665427?logo=discord&logoColor=white&label=Join+Us&color=blueviolet" alt="Discord">
13+
</a>
14+
<a href="https://buymeacoffee.com/sk3llo" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-orange.png" alt="Buy Me A Coffee" height="21" width="114"></a>
15+
</p>
16+
</div>
317

418
## Upgraded version of the original [Flutter FFmpegKit](https://github.com/arthenica/ffmpeg-kit/tree/main/flutter/flutter).
519

620
### 1. Features
721

8-
- Updated Android and MacOS bindings to work with Flutter 3.29
22+
- Updated Android and MacOS bindings
923
- Includes both `FFmpeg` and `FFprobe`
1024
- Supports
1125
- `Android`, `iOS` and `macOS`
12-
- FFmpeg `v6.0.2-LTS`
26+
- FFmpeg `v7.1.1`
1327
- `arm-v7a`, `arm-v7a-neon`, `arm64-v8a`, `x86` and `x86_64` architectures on Android
1428
- `Android API Level 24` or later
15-
- `armv7`, `armv7s`, `arm64`, `arm64-simulator`, `i386`, `x86_64`, `x86_64-mac-catalyst` and `arm64-mac-catalyst`
16-
architectures on iOS
29+
- `armv7`, `armv7s`, `arm64`, `x86_64`, `x86_64-mac-catalyst` and `arm64-mac-catalyst`
30+
architectures on iOS
1731
- `iOS SDK 14.0` or later
18-
- `arm64` and `x86_64` architectures on macOS
32+
- `arm64` and `x86_64` architectures on macOS
1933
- `macOS SDK 10.15` or later
2034
- Can process Storage Access Framework (SAF) Uris on Android
21-
- 25 external libraries
2235

23-
`dav1d`, `fontconfig`, `freetype`, `fribidi`, `gmp`, `gnutls`, `kvazaar`, `lame`, `libass`, `libiconv`, `libilbc`
24-
, `libtheora`, `libvorbis`, `libvpx`, `libwebp`, `libxml2`, `opencore-amr`, `opus`, `shine`, `snappy`, `soxr`
25-
, `speex`, `twolame`, `vo-amrwbenc`, `zimg`
36+
- Licensed under `LGPL 3.0`
2637

27-
- 4 external libraries with GPL license
38+
### 2. Installation
2839

29-
`vid.stab`, `x264`, `x265`, `xvidcore`
40+
Add `ffmpeg_kit_flutter_new_min` as a dependency in your `pubspec.yaml file`.
3041

31-
- Licensed under `LGPL 3.0` by default, some packages licensed by `GPL v3.0` effectively
42+
```yaml
43+
dependencies:
44+
ffmpeg_kit_flutter_new_min: ^1.0.0
45+
```
3246
33-
### 2. Known issues
47+
### 3. Packages
3448
35-
#### Android:
36-
```
37-
...
38-
Running Gradle task 'assembleDebug'...
39-
*** DOWNLOADING AAR ***
40-
...android/src/main/java/com/arthenica/ffmpegkit/flutter FFmpegSessionExecuteTask.java:5: error: cannot find symbol
41-
import com.arthenica.ffmpegkit.FFmpegKitConfig;
42-
...100 more lines...
43-
```
44-
The error above is going to happen during the first run only ONCE. It occurs because downloaded `.aar` cannot be found after Gradle assemble task. Sadly, mentioned `.aar` cannot be bundled along with the package [because of the pub.dev package restrictions](https://dart.dev/tools/pub/publishing#prepare-your-package-for-publication) and always have to be downloaded first.
49+
There are eight different `ffmpeg-kit` packages:
4550

46-
### 3. Installation
51+
- [Minimal](https://pub.dev/packages/ffmpeg_kit_flutter_new_min)
52+
- Minimal-GPL
53+
- HTTPS
54+
- HTTPS-GPL
55+
- Audio
56+
- Video
57+
- Full
58+
- [Full-GPL](https://pub.dev/packages/ffmpeg_kit_flutter_new)
4759

48-
Add `ffmpeg_kit_flutter_new` as a dependency in your `pubspec.yaml file`.
60+
Below you can see which system libraries and external libraries are enabled in each one of them.
4961

50-
```yaml
51-
dependencies:
52-
ffmpeg_kit_flutter_new: ^2.0.0
53-
```
62+
Please remember that some parts of `FFmpeg` are licensed under the `GPL` and only `GPL` licensed `ffmpeg-kit` packages
63+
include them.
5464

55-
NOTE: Android know issue:
65+
<table>
66+
<thead>
67+
<tr>
68+
<th align="center"></th>
69+
<th align="center"><sup>min</sup></th>
70+
<th align="center"><sup>min-gpl</sup></th>
71+
<th align="center"><sup>https</sup></th>
72+
<th align="center"><sup>https-gpl</sup></th>
73+
<th align="center"><sup>audio</sup></th>
74+
<th align="center"><sup>video</sup></th>
75+
<th align="center"><sup>full</sup></th>
76+
<th align="center"><sup>full-gpl</sup></th>
77+
</tr>
78+
</thead>
79+
<tbody>
80+
<tr>
81+
<td align="center"><sup>external libraries</sup></td>
82+
<td align="center">-</td>
83+
<td align="center"><sup>vid.stab</sup><br><sup>x264</sup><br><sup>x265</sup><br><sup>xvidcore</sup></td>
84+
<td align="center"><sup>gmp</sup><br><sup>gnutls</sup></td>
85+
<td align="center"><sup>gmp</sup><br><sup>gnutls</sup><br><sup>vid.stab</sup><br><sup>x264</sup><br><sup>x265</sup><br><sup>xvidcore</sup></td>
86+
<td align="center"><sup>lame</sup><br><sup>libilbc</sup><br><sup>libvorbis</sup><br><sup>opencore-amr</sup><br><sup>opus</sup><br><sup>shine</sup><br><sup>soxr</sup><br><sup>speex</sup><br><sup>twolame</sup><br><sup>vo-amrwbenc</sup></td>
87+
<td align="center"><sup>dav1d</sup><br><sup>fontconfig</sup><br><sup>freetype</sup><br><sup>fribidi</sup><br><sup>kvazaar</sup><br><sup>libass</sup><br><sup>libiconv</sup><br><sup>libtheora</sup><br><sup>libvpx</sup><br><sup>libwebp</sup><br><sup>snappy</sup><br><sup>zimg</sup></td>
88+
<td align="center"><sup>dav1d</sup><br><sup>fontconfig</sup><br><sup>freetype</sup><br><sup>fribidi</sup><br><sup>gmp</sup><br><sup>gnutls</sup><br><sup>kvazaar</sup><br><sup>lame</sup><br><sup>libass</sup><br><sup>libiconv</sup><br><sup>libilbc</sup><br><sup>libtheora</sup><br><sup>libvorbis</sup><br><sup>libvpx</sup><br><sup>libwebp</sup><br><sup>libxml2</sup><br><sup>opencore-amr</sup><br><sup>opus</sup><br><sup>shine</sup><br><sup>snappy</sup><br><sup>soxr</sup><br><sup>speex</sup><br><sup>twolame</sup><br><sup>vo-amrwbenc</sup><br><sup>zimg</sup></td>
89+
<td align="center"><sup>dav1d</sup><br><sup>fontconfig</sup><br><sup>freetype</sup><br><sup>fribidi</sup><br><sup>gmp</sup><br><sup>gnutls</sup><br><sup>kvazaar</sup><br><sup>lame</sup><br><sup>libass</sup><br><sup>libiconv</sup><br><sup>libilbc</sup><br><sup>libtheora</sup><br><sup>libvorbis</sup><br><sup>libvpx</sup><br><sup>libwebp</sup><br><sup>libxml2</sup><br><sup>opencore-amr</sup><br><sup>opus</sup><br><sup>shine</sup><br><sup>snappy</sup><br><sup>soxr</sup><br><sup>speex</sup><br><sup>twolame</sup><br><sup>vid.stab</sup><br><sup>vo-amrwbenc</sup><br><sup>x264</sup><br><sup>x265</sup><br><sup>xvidcore</sup><br><sup>zimg</sup></td>
90+
</tr>
91+
<tr>
92+
<td align="center"><sup>android system libraries</sup></td>
93+
<td align="center" colspan=8><sup>zlib</sup><br><sup>MediaCodec</sup></td>
94+
</tr>
95+
<tr>
96+
<td align="center"><sup>ios system libraries</sup></td>
97+
<td align="center" colspan=8><sup>bzip2</sup><br><sup>AudioToolbox</sup><br><sup>AVFoundation</sup><br><sup>iconv</sup><br><sup>VideoToolbox</sup><br><sup>zlib</sup></td>
98+
</tr>
99+
<tr>
100+
<tr>
101+
<td align="center"><sup>macos system libraries</sup></td>
102+
<td align="center" colspan=8><sup>bzip2</sup><br><sup>AudioToolbox</sup><br><sup>AVFoundation</sup><br><sup>Core Image</sup><br><sup>iconv</sup><br><sup>OpenCL</sup><br><sup>OpenGL</sup><br><sup>VideoToolbox</sup><br><sup>zlib</sup></td>
103+
</tr>
104+
<tr>
105+
<td align="center"><sup>tvos system libraries</sup></td>
106+
<td align="center" colspan=8><sup>bzip2</sup><br><sup>AudioToolbox</sup><br><sup>iconv</sup><br><sup>VideoToolbox</sup><br><sup>zlib</sup></td>
107+
</tr>
108+
</tbody>
109+
</table>
56110

57-
#### 4. Platform Support
111+
### 4. Platform Support
58112

59113
The following table shows Android API level, iOS deployment target and macOS deployment target requirements in
60-
`ffmpeg_kit_flutter_new` releases.
114+
`ffmpeg_kit_flutter_new_min` releases.
61115

62116
<table align="center">
63117
<thead>
@@ -79,7 +133,7 @@ The following table shows Android API level, iOS deployment target and macOS dep
79133
</tbody>
80134
</table>
81135

82-
### 4. Using
136+
### 5. Using
83137

84138
1. Execute FFmpeg commands.
85139

@@ -109,8 +163,8 @@ FFmpegKit.execute('-i file1.mp4 -c:v mpeg4 file2.mp4').thenReturnResultOrLogs(
109163
).then((result) => print('FFmpeg command executed successfully: $result'))
110164
.catchError((error) => print('FFmpeg command failed with error: $error'));
111165
```
112-
2. Each `execute` call creates a new session. Access every detail about your execution from the session created.
113-
166+
2. Each `execute` call creates a new session. Access every detail about your execution from the session created.
167+
114168
```dart
115169
FFmpegKit.execute('-i file1.mp4 -c:v mpeg4 file2.mp4').then((session) async {
116170
// Unique session id created for this execution
@@ -147,8 +201,8 @@ FFmpegKit.executeAsync('-i file1.mp4 -c:v mpeg4 file2.mp4', (Session session) as
147201
// CALLED WHEN SESSION GENERATES STATISTICS
148202
});
149203
```
150-
4. Execute `FFprobe` commands.
151-
204+
4. Execute `FFprobe` commands.
205+
152206
```dart
153207
FFprobeKit.execute(ffprobeCommand).then((session) async {
154208
// CALLED WHEN SESSION IS EXECUTED
@@ -169,13 +223,13 @@ FFprobeKit.getMediaInformation('<file path or url>').then((session) async {
169223
}
170224
});
171225
```
172-
6. Stop ongoing FFmpeg operations.
173-
174-
- Stop all sessions
226+
6. Stop ongoing FFmpeg operations.
227+
228+
- Stop all sessions
175229
```dart
176230
FFmpegKit.cancel();
177231
```
178-
- Stop a specific session
232+
- Stop a specific session
179233
```dart
180234
FFmpegKit.cancel(sessionId);
181235
```
@@ -190,7 +244,7 @@ FFmpegKitConfig.selectDocumentForRead('*/*').then((uri) {
190244
});
191245
});
192246
```
193-
- Writing to a file:
247+
- Writing to a file:
194248
```dart
195249
FFmpegKitConfig.selectDocumentForWrite('video.mp4', 'video/*').then((uri) {
196250
FFmpegKitConfig.getSafParameterForWrite(uri!).then((safUrl) {
@@ -217,10 +271,10 @@ FFprobeKit.listMediaInformationSessions().then((sessionList) {
217271
});
218272
});
219273
```
220-
9. Enable global callbacks.
221-
222-
- Session type specific Complete Callbacks, called when an async session has been completed
223-
274+
9. Enable global callbacks.
275+
276+
- Session type specific Complete Callbacks, called when an async session has been completed
277+
224278
```dart
225279
FFmpegKitConfig.enableFFmpegSessionCompleteCallback((session) {
226280
final sessionId = session.getSessionId();
@@ -239,11 +293,11 @@ FFmpegKitConfig.enableLogCallback((log) {
239293
final message = log.getMessage();
240294
});
241295
```
242-
- Statistics Callback, called when a session generates statistics
243-
296+
- Statistics Callback, called when a session generates statistics
297+
244298
```dart
245-
FFmpegKitConfig.enableStatisticsCallback((statistics) {
246-
final size = statistics.getSize();
299+
FFmpegKitConfig.enableStatisticsCallback((statistics) {
300+
final size = statistics.getSize();
247301
});
248302
```
249303
10. Register system fonts and custom font directories.

android/build.gradle

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ android {
4949
versionName "1.0.0"
5050
}
5151

52+
// Enable MediaCodec features
53+
packagingOptions {
54+
pickFirst '**/libc++_shared.so'
55+
pickFirst '**/libjsc.so'
56+
}
57+
5258
dependencies {
5359
implementation("androidx.annotation:annotation:1.9.1")
5460
}

android/src/main/cpp/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/android_lts_support.o
2+
/libandroidltssupport.a
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
/*
2+
* Copyright (C) 2008 The Android Open Source Project
3+
* All rights reserved.
4+
*
5+
* Redistribution and use in source and binary forms, with or without
6+
* modification, are permitted provided that the following conditions
7+
* are met:
8+
* * Redistributions of source code must retain the above copyright
9+
* notice, this list of conditions and the following disclaimer.
10+
* * Redistributions in binary form must reproduce the above copyright
11+
* notice, this list of conditions and the following disclaimer in
12+
* the documentation and/or other materials provided with the
13+
* distribution.
14+
*
15+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
18+
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19+
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20+
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21+
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
22+
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23+
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
25+
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26+
* SUCH DAMAGE.
27+
*/
28+
29+
#include <math.h>
30+
#include <errno.h>
31+
#include <malloc.h>
32+
#include <stdlib.h>
33+
34+
#ifdef __cplusplus
35+
extern "C" {
36+
#endif
37+
38+
#if __ANDROID_API__ < 17
39+
40+
int posix_memalign(void** memptr, size_t alignment, size_t size) {
41+
if ((alignment & (alignment - 1)) != 0 || alignment == 0) {
42+
return EINVAL;
43+
}
44+
45+
if (alignment % sizeof(void*) != 0) {
46+
return EINVAL;
47+
}
48+
49+
*memptr = memalign(alignment, size);
50+
if (*memptr == NULL) {
51+
return errno;
52+
}
53+
54+
return 0;
55+
}
56+
57+
#endif /* __ANDROID_API__ < 17 */
58+
59+
double log2(double x) {
60+
return (log(x) / M_LN2);
61+
}
62+
63+
float log2f(float x) {
64+
return (float) log2((double) x);
65+
}
66+
67+
#ifdef __cplusplus
68+
}; /* end of extern "C" */
69+
#endif

0 commit comments

Comments
 (0)