@@ -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
5065There 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
6179Below 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
142160import 'package:ffmpeg_kit_flutter/ffmpeg_kit.dart';
143161
144162FFmpegKit.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';
160178final outputPath = 'file2.mp4';
161179
162180FFmpegKit.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` ` `
1671852. 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` ` `
1942123. Execute `FFmpeg` commands by providing session specific `execute`/`log`/`session` callbacks.
195213
196214` ` ` dart
197215FFmpegKit.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` ` `
2052234. 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` ` `
2122305. 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` ` `
2272456. 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
250268FFmpegKitConfig.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` ` `
2562748. 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+ });
264282FFprobeKit.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+ });
269287FFprobeKit.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` ` `
2752939. Enable global callbacks.
@@ -278,20 +296,20 @@ FFprobeKit.listMediaInformationSessions().then((sessionList) {
278296
279297` ` ` dart
280298FFmpegKitConfig.enableFFmpegSessionCompleteCallback((session) {
281- final sessionId = session.getSessionId();
282- });
299+ final sessionId = session.getSessionId();
300+ });
283301FFmpegKitConfig.enableFFprobeSessionCompleteCallback((session) {
284- final sessionId = session.getSessionId();
285- });
302+ final sessionId = session.getSessionId();
303+ });
286304FFmpegKitConfig.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
0 commit comments