Skip to content

Commit d08e33b

Browse files
committed
## 1.0.0
* Initial release * FFmpeg version 7.1.1 * Removed bundled Android FFmpeg (jniLibs, cpp, bindings) * Added FFmpeg min using new Maven Central package * Downgraded Kotlin version to `1.8.22` * Updated `example` project and README.md
1 parent 6cca096 commit d08e33b

File tree

7 files changed

+287
-225
lines changed

7 files changed

+287
-225
lines changed

README.md

Lines changed: 117 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,37 @@ _Fork of the original FFmpeg Kit library to work with Android V2 bindings and Fl
1919

2020
### 1. Features
2121

22-
- Updated Android and MacOS bindings
23-
- Includes both `FFmpeg` and `FFprobe`
24-
- Supports
25-
- `Android`, `iOS` and `macOS`
26-
- FFmpeg `v7.1.1`
27-
- Kotlin `v1.8.0`
28-
- `arm-v7a`, `arm-v7a-neon`, `arm64-v8a`, `x86` and `x86_64` architectures on Android
29-
- `Android API Level 24` or later
30-
- `armv7`, `armv7s`, `arm64`, `x86_64`, `x86_64-mac-catalyst` and `arm64-mac-catalyst`
31-
architectures on iOS
32-
- `iOS SDK 14.0` or later
33-
- `arm64` and `x86_64` architectures on macOS
34-
- `macOS SDK 10.15` or later
35-
- Can process Storage Access Framework (SAF) Uris on Android
36-
37-
- Licensed under `LGPL 3.0`
22+
- **Updated Bindings**: Android and macOS
23+
- **Includes**: Both `FFmpeg` and `FFprobe`
24+
- **Supported Platforms**:
25+
- `Android`
26+
- `iOS`
27+
- `macOS`
28+
- **FFmpeg Version**: `v7.1.1`
29+
- **Kotlin Version**: `v1.8.22`
30+
- **Supported Architectures**:
31+
- **Android**:
32+
- `arm-v7a`
33+
- `arm-v7a-neon`
34+
- `arm64-v8a`
35+
- `x86`
36+
- `x86_64`
37+
- Requires `Android API Level 24` or later
38+
- **iOS**:
39+
- `armv7`
40+
- `armv7s`
41+
- `arm64`
42+
- `x86_64`
43+
- `x86_64-mac-catalyst`
44+
- `arm64-mac-catalyst`
45+
- Requires `iOS SDK 14.0` or later
46+
- **macOS**:
47+
- `arm64`
48+
- `x86_64`
49+
- Requires `macOS SDK 10.15` or later
50+
- **Storage Access**: Can process Storage Access Framework (SAF) Uris on Android
51+
- **License**: Licensed under `LGPL 3.0`
52+
3853

3954
### 2. Installation
4055

@@ -49,14 +64,17 @@ dependencies:
4964
5065
There are eight different `ffmpeg-kit` packages:
5166

52-
- [Minimal](https://pub.dev/packages/ffmpeg_kit_flutter_new_min)
53-
- [Minimal-GPL](https://pub.dev/packages/ffmpeg_kit_flutter_new_min_gpl)
54-
- [HTTPS](https://pub.dev/packages/ffmpeg_kit_flutter_new_https)
55-
- [HTTPS-GPL](https://pub.dev/packages/ffmpeg_kit_flutter_new_https_gpl)
56-
- [Audio](https://pub.dev/packages/ffmpeg_kit_flutter_new_audio)
57-
- Video
58-
- Full
59-
- [Full-GPL](https://pub.dev/packages/ffmpeg_kit_flutter_new)
67+
| Package Name | Description
68+
|----------------------------------|-----------------------------------------------
69+
| [Minimal](https://pub.dev/packages/ffmpeg_kit_flutter_new_min) | A minimal version of FFmpeg Kit |
70+
| [Minimal-GPL](https://pub.dev/packages/ffmpeg_kit_flutter_new_min_gpl) | Minimal version with GPL licensing
71+
| [HTTPS](https://pub.dev/packages/ffmpeg_kit_flutter_new_https) | FFmpeg Kit with HTTPS support |
72+
| [HTTPS-GPL](https://pub.dev/packages/ffmpeg_kit_flutter_new_https_gpl) | HTTPS version with GPL licensing |
73+
| [Audio](https://pub.dev/packages/ffmpeg_kit_flutter_new_audio) | FFmpeg Kit focused on audio processing |
74+
| Video | FFmpeg Kit focused on video processing |
75+
| Full | Full version of FFmpeg Kit |
76+
| [Full-GPL](https://pub.dev/packages/ffmpeg_kit_flutter_new) | Full version with GPL licensing |
77+
6078

6179
Below you can see which system libraries and external libraries are enabled in each one of them.
6280

@@ -142,14 +160,14 @@ The following table shows Android API level, iOS deployment target and macOS dep
142160
import 'package:ffmpeg_kit_flutter/ffmpeg_kit.dart';
143161
144162
FFmpegKit.execute('-i file1.mp4 -c:v mpeg4 file2.mp4').then((session) async {
145-
final returnCode = await session.getReturnCode();
146-
if (ReturnCode.isSuccess(returnCode)) {
147-
// SUCCESS
148-
} else if (ReturnCode.isCancel(returnCode)) {
149-
// CANCEL
150-
} else {
151-
// ERROR
152-
}
163+
final returnCode = await session.getReturnCode();
164+
if (ReturnCode.isSuccess(returnCode)) {
165+
// SUCCESS
166+
} else if (ReturnCode.isCancel(returnCode)) {
167+
// CANCEL
168+
} else {
169+
// ERROR
170+
}
153171
});
154172
```
155173

@@ -160,68 +178,68 @@ import 'package:ffmpeg_kit_flutter/ffmpeg_kit.dart';
160178
final outputPath = 'file2.mp4';
161179
162180
FFmpegKit.execute('-i file1.mp4 -c:v mpeg4 file2.mp4').thenReturnResultOrLogs(
163-
(_) => outputPath,
181+
(_) => outputPath,
164182
).then((result) => print('FFmpeg command executed successfully: $result'))
165-
.catchError((error) => print('FFmpeg command failed with error: $error'));
183+
.catchError((error) => print('FFmpeg command failed with error: $error'));
166184
```
167185
2. Each `execute` call creates a new session. Access every detail about your execution from the session created.
168186

169187
```dart
170-
FFmpegKit.execute('-i file1.mp4 -c:v mpeg4 file2.mp4').then((session) async {
171-
// Unique session id created for this execution
172-
final sessionId = session.getSessionId();
173-
// Command arguments as a single string
174-
final command = session.getCommand();
175-
// Command arguments
176-
final commandArguments = session.getArguments();
177-
// State of the execution. Shows whether it is still running or completed
178-
final state = await session.getState();
179-
// Return code for completed sessions. Will be undefined if session is still running or FFmpegKit fails to run it
180-
final returnCode = await session.getReturnCode();
181-
final startTime = session.getStartTime();
182-
final endTime = await session.getEndTime();
183-
final duration = await session.getDuration();
184-
// Console output generated for this execution
185-
final output = await session.getOutput();
186-
// The stack trace if FFmpegKit fails to run a command
187-
final failStackTrace = await session.getFailStackTrace();
188-
// The list of logs generated for this execution
189-
final logs = await session.getLogs();
190-
// The list of statistics generated for this execution (only available on FFmpegSession)
191-
final statistics = await (session as FFmpegSession).getStatistics();
188+
FFmpegKit.execute('-i file1.mp4 -c:v mpeg4 file2.mp4').then((session) async {
189+
// Unique session id created for this execution
190+
final sessionId = session.getSessionId();
191+
// Command arguments as a single string
192+
final command = session.getCommand();
193+
// Command arguments
194+
final commandArguments = session.getArguments();
195+
// State of the execution. Shows whether it is still running or completed
196+
final state = await session.getState();
197+
// Return code for completed sessions. Will be undefined if session is still running or FFmpegKit fails to run it
198+
final returnCode = await session.getReturnCode();
199+
final startTime = session.getStartTime();
200+
final endTime = await session.getEndTime();
201+
final duration = await session.getDuration();
202+
// Console output generated for this execution
203+
final output = await session.getOutput();
204+
// The stack trace if FFmpegKit fails to run a command
205+
final failStackTrace = await session.getFailStackTrace();
206+
// The list of logs generated for this execution
207+
final logs = await session.getLogs();
208+
// The list of statistics generated for this execution (only available on FFmpegSession)
209+
final statistics = await (session as FFmpegSession).getStatistics();
192210
});
193211
```
194212
3. Execute `FFmpeg` commands by providing session specific `execute`/`log`/`session` callbacks.
195213

196214
```dart
197215
FFmpegKit.executeAsync('-i file1.mp4 -c:v mpeg4 file2.mp4', (Session session) async {
198-
// CALLED WHEN SESSION IS EXECUTED
199-
}, (Log log) {
200-
// CALLED WHEN SESSION PRINTS LOGS
201-
}, (Statistics statistics) {
202-
// CALLED WHEN SESSION GENERATES STATISTICS
216+
// CALLED WHEN SESSION IS EXECUTED
217+
}, (Log log) {
218+
// CALLED WHEN SESSION PRINTS LOGS
219+
}, (Statistics statistics) {
220+
// CALLED WHEN SESSION GENERATES STATISTICS
203221
});
204222
```
205223
4. Execute `FFprobe` commands.
206224

207225
```dart
208-
FFprobeKit.execute(ffprobeCommand).then((session) async {
209-
// CALLED WHEN SESSION IS EXECUTED
226+
FFprobeKit.execute(ffprobeCommand).then((session) async {
227+
// CALLED WHEN SESSION IS EXECUTED
210228
});
211229
```
212230
5. Get media information for a file/url.
213231

214232
```dart
215-
FFprobeKit.getMediaInformation('<file path or url>').then((session) async {
216-
final information = await session.getMediaInformation();
217-
if (information == null) {
218-
// CHECK THE FOLLOWING ATTRIBUTES ON ERROR
219-
final state = FFmpegKitConfig.sessionStateToString(await session.getState());
220-
final returnCode = await session.getReturnCode();
221-
final failStackTrace = await session.getFailStackTrace();
222-
final duration = await session.getDuration();
223-
final output = await session.getOutput();
224-
}
233+
FFprobeKit.getMediaInformation('<file path or url>').then((session) async {
234+
final information = await session.getMediaInformation();
235+
if (information == null) {
236+
// CHECK THE FOLLOWING ATTRIBUTES ON ERROR
237+
final state = FFmpegKitConfig.sessionStateToString(await session.getState());
238+
final returnCode = await session.getReturnCode();
239+
final failStackTrace = await session.getFailStackTrace();
240+
final duration = await session.getDuration();
241+
final output = await session.getOutput();
242+
}
225243
});
226244
```
227245
6. Stop ongoing FFmpeg operations.
@@ -239,37 +257,37 @@ FFmpegKit.cancel(sessionId);
239257

240258
- Reading a file:
241259
```dart
242-
FFmpegKitConfig.selectDocumentForRead('*/*').then((uri) {
243-
FFmpegKitConfig.getSafParameterForRead(uri!).then((safUrl) {
244-
FFmpegKit.executeAsync("-i ${safUrl!} -c:v mpeg4 file2.mp4");
245-
});
260+
FFmpegKitConfig.selectDocumentForRead('*/*').then((uri) {
261+
FFmpegKitConfig.getSafParameterForRead(uri!).then((safUrl) {
262+
FFmpegKit.executeAsync("-i ${safUrl!} -c:v mpeg4 file2.mp4");
263+
});
246264
});
247265
```
248266
- Writing to a file:
249267
```dart
250268
FFmpegKitConfig.selectDocumentForWrite('video.mp4', 'video/*').then((uri) {
251-
FFmpegKitConfig.getSafParameterForWrite(uri!).then((safUrl) {
252-
FFmpegKit.executeAsync("-i file1.mp4 -c:v mpeg4 ${safUrl}");
253-
});
269+
FFmpegKitConfig.getSafParameterForWrite(uri!).then((safUrl) {
270+
FFmpegKit.executeAsync("-i file1.mp4 -c:v mpeg4 ${safUrl}");
271+
});
254272
});
255273
```
256274
8. Get previous `FFmpeg`, `FFprobe` and `MediaInformation` sessions from the session history.
257275

258276
```dart
259-
FFmpegKit.listSessions().then((sessionList) {
260-
sessionList.forEach((session) {
261-
final sessionId = session.getSessionId();
262-
});
263-
});
277+
FFmpegKit.listSessions().then((sessionList) {
278+
sessionList.forEach((session) {
279+
final sessionId = session.getSessionId();
280+
});
281+
});
264282
FFprobeKit.listFFprobeSessions().then((sessionList) {
265-
sessionList.forEach((session) {
266-
final sessionId = session.getSessionId();
267-
});
268-
});
283+
sessionList.forEach((session) {
284+
final sessionId = session.getSessionId();
285+
});
286+
});
269287
FFprobeKit.listMediaInformationSessions().then((sessionList) {
270-
sessionList.forEach((session) {
271-
final sessionId = session.getSessionId();
272-
});
288+
sessionList.forEach((session) {
289+
final sessionId = session.getSessionId();
290+
});
273291
});
274292
```
275293
9. Enable global callbacks.
@@ -278,20 +296,20 @@ FFprobeKit.listMediaInformationSessions().then((sessionList) {
278296

279297
```dart
280298
FFmpegKitConfig.enableFFmpegSessionCompleteCallback((session) {
281-
final sessionId = session.getSessionId();
282-
});
299+
final sessionId = session.getSessionId();
300+
});
283301
FFmpegKitConfig.enableFFprobeSessionCompleteCallback((session) {
284-
final sessionId = session.getSessionId();
285-
});
302+
final sessionId = session.getSessionId();
303+
});
286304
FFmpegKitConfig.enableMediaInformationSessionCompleteCallback((session) {
287-
final sessionId = session.getSessionId();
305+
final sessionId = session.getSessionId();
288306
});
289307
```
290308
- Log Callback, called when a session generates logs
291309

292310
```dart
293-
FFmpegKitConfig.enableLogCallback((log) {
294-
final message = log.getMessage();
311+
FFmpegKitConfig.enableLogCallback((log) {
312+
final message = log.getMessage();
295313
});
296314
```
297315
- Statistics Callback, called when a session generates statistics

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
buildscript {
2-
ext.kotlin_version = "1.8.0"
2+
ext.kotlin_version = "1.8.22"
33

44
repositories {
55
google()

example/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ migrate_working_dir/
3131
.flutter-plugins-dependencies
3232
.pub-cache/
3333
.pub/
34+
pubspec.lock
3435
/build/
3536

3637
# Symbolication related

example/analysis_options.yaml

Lines changed: 1 addition & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1 @@
1-
analyzer:
2-
strong-mode:
3-
implicit-dynamic: false
4-
errors:
5-
missing_required_param: warning
6-
missing_return: warning
7-
8-
linter:
9-
rules:
10-
- avoid_catching_errors
11-
- avoid_function_literals_in_foreach_calls
12-
- avoid_private_typedef_functions
13-
- avoid_renaming_method_parameters
14-
- avoid_returning_null_for_void
15-
- avoid_unused_constructor_parameters
16-
- avoid_void_async
17-
- await_only_futures
18-
- camel_case_types
19-
- cancel_subscriptions
20-
- comment_references
21-
- constant_identifier_names
22-
- control_flow_in_finally
23-
- directives_ordering
24-
- empty_statements
25-
- file_names
26-
- hash_and_equals
27-
- implementation_imports
28-
- join_return_with_assignment
29-
- lines_longer_than_80_chars
30-
- missing_whitespace_between_adjacent_strings
31-
- no_runtimeType_toString
32-
- non_constant_identifier_names
33-
- only_throw_errors
34-
- overridden_fields
35-
- package_names
36-
- package_prefixed_library_names
37-
- prefer_asserts_in_initializer_lists
38-
- prefer_const_constructors
39-
- prefer_const_declarations
40-
- prefer_expression_function_bodies
41-
- prefer_final_locals
42-
- prefer_function_declarations_over_variables
43-
- prefer_initializing_formals
44-
- prefer_inlined_adds
45-
- prefer_interpolation_to_compose_strings
46-
- prefer_is_not_operator
47-
- prefer_null_aware_operators
48-
- prefer_relative_imports
49-
- prefer_typing_uninitialized_variables
50-
- prefer_void_to_null
51-
- provide_deprecation_message
52-
- sort_pub_dependencies
53-
- test_types_in_equals
54-
- throw_in_finally
55-
- unnecessary_brace_in_string_interps
56-
- unnecessary_lambdas
57-
- unnecessary_null_aware_assignments
58-
- unnecessary_overrides
59-
- unnecessary_parenthesis
60-
- unnecessary_statements
61-
- unnecessary_string_interpolations
62-
- use_string_buffers
63-
- void_checks
1+
include: package:flutter_lints/flutter.yaml

example/android/settings.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ pluginManagement {
1919
plugins {
2020
id("dev.flutter.flutter-plugin-loader") version "1.0.0"
2121
id("com.android.application") version "8.7.0" apply false
22-
id("org.jetbrains.kotlin.android") version "2.2.0" apply false
22+
id("org.jetbrains.kotlin.android") version "1.8.22" apply false
2323
}
2424

2525
include(":app")

example/assets/sample_audio.wav

551 KB
Binary file not shown.

0 commit comments

Comments
 (0)