├── .fvmrc
├── .gitignore
├── CHANGELOG.md
├── LICENSE
├── LICENSE.GPLv3
├── README.md
├── analysis_options.yaml
├── android
├── .gitignore
├── build.gradle
├── gradle.properties
├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── settings.gradle
└── src
│ └── main
│ ├── AndroidManifest.xml
│ └── java
│ └── com
│ └── antonkarpenko
│ └── ffmpegkit
│ └── MainActivity.java
├── example
├── .gitignore
├── .metadata
├── README.md
├── analysis_options.yaml
├── android
│ ├── .gitignore
│ ├── app
│ │ ├── build.gradle.kts
│ │ └── src
│ │ │ ├── debug
│ │ │ └── AndroidManifest.xml
│ │ │ ├── main
│ │ │ ├── AndroidManifest.xml
│ │ │ ├── kotlin
│ │ │ │ └── com
│ │ │ │ │ └── example
│ │ │ │ │ └── example
│ │ │ │ │ └── MainActivity.kt
│ │ │ └── res
│ │ │ │ ├── drawable-v21
│ │ │ │ └── launch_background.xml
│ │ │ │ ├── drawable
│ │ │ │ └── launch_background.xml
│ │ │ │ ├── mipmap-hdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-mdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xxhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xxxhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── values-night
│ │ │ │ └── styles.xml
│ │ │ │ └── values
│ │ │ │ └── styles.xml
│ │ │ └── profile
│ │ │ └── AndroidManifest.xml
│ ├── build.gradle.kts
│ ├── gradle.properties
│ ├── gradle
│ │ └── wrapper
│ │ │ └── gradle-wrapper.properties
│ ├── proguard-rules.pro
│ ├── proguard.txt
│ └── settings.gradle.kts
├── assets
│ └── sample_video.mp4
├── ios
│ ├── .gitignore
│ ├── Flutter
│ │ ├── AppFrameworkInfo.plist
│ │ ├── Debug.xcconfig
│ │ └── Release.xcconfig
│ ├── Podfile
│ ├── Podfile.lock
│ ├── Runner.xcodeproj
│ │ ├── project.pbxproj
│ │ ├── project.xcworkspace
│ │ │ ├── contents.xcworkspacedata
│ │ │ └── xcshareddata
│ │ │ │ ├── IDEWorkspaceChecks.plist
│ │ │ │ └── WorkspaceSettings.xcsettings
│ │ └── xcshareddata
│ │ │ └── xcschemes
│ │ │ └── Runner.xcscheme
│ ├── Runner.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcshareddata
│ │ │ ├── IDEWorkspaceChecks.plist
│ │ │ └── WorkspaceSettings.xcsettings
│ ├── Runner
│ │ ├── AppDelegate.swift
│ │ ├── Assets.xcassets
│ │ │ ├── AppIcon.appiconset
│ │ │ │ ├── Contents.json
│ │ │ │ ├── Icon-App-1024x1024@1x.png
│ │ │ │ ├── Icon-App-20x20@1x.png
│ │ │ │ ├── Icon-App-20x20@2x.png
│ │ │ │ ├── Icon-App-20x20@3x.png
│ │ │ │ ├── Icon-App-29x29@1x.png
│ │ │ │ ├── Icon-App-29x29@2x.png
│ │ │ │ ├── Icon-App-29x29@3x.png
│ │ │ │ ├── Icon-App-40x40@1x.png
│ │ │ │ ├── Icon-App-40x40@2x.png
│ │ │ │ ├── Icon-App-40x40@3x.png
│ │ │ │ ├── Icon-App-60x60@2x.png
│ │ │ │ ├── Icon-App-60x60@3x.png
│ │ │ │ ├── Icon-App-76x76@1x.png
│ │ │ │ ├── Icon-App-76x76@2x.png
│ │ │ │ └── Icon-App-83.5x83.5@2x.png
│ │ │ └── LaunchImage.imageset
│ │ │ │ ├── Contents.json
│ │ │ │ ├── LaunchImage.png
│ │ │ │ ├── LaunchImage@2x.png
│ │ │ │ ├── LaunchImage@3x.png
│ │ │ │ └── README.md
│ │ ├── Base.lproj
│ │ │ ├── LaunchScreen.storyboard
│ │ │ └── Main.storyboard
│ │ ├── Info.plist
│ │ └── Runner-Bridging-Header.h
│ └── RunnerTests
│ │ └── RunnerTests.swift
├── lib
│ └── main.dart
├── macos
│ ├── .gitignore
│ ├── Flutter
│ │ ├── Flutter-Debug.xcconfig
│ │ ├── Flutter-Release.xcconfig
│ │ └── GeneratedPluginRegistrant.swift
│ ├── Podfile
│ ├── Runner.xcodeproj
│ │ ├── project.pbxproj
│ │ ├── project.xcworkspace
│ │ │ └── xcshareddata
│ │ │ │ └── IDEWorkspaceChecks.plist
│ │ └── xcshareddata
│ │ │ └── xcschemes
│ │ │ └── Runner.xcscheme
│ ├── Runner.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcshareddata
│ │ │ └── IDEWorkspaceChecks.plist
│ ├── Runner
│ │ ├── AppDelegate.swift
│ │ ├── Assets.xcassets
│ │ │ └── AppIcon.appiconset
│ │ │ │ ├── Contents.json
│ │ │ │ ├── app_icon_1024.png
│ │ │ │ ├── app_icon_128.png
│ │ │ │ ├── app_icon_16.png
│ │ │ │ ├── app_icon_256.png
│ │ │ │ ├── app_icon_32.png
│ │ │ │ ├── app_icon_512.png
│ │ │ │ └── app_icon_64.png
│ │ ├── Base.lproj
│ │ │ └── MainMenu.xib
│ │ ├── Configs
│ │ │ ├── AppInfo.xcconfig
│ │ │ ├── Debug.xcconfig
│ │ │ ├── Release.xcconfig
│ │ │ └── Warnings.xcconfig
│ │ ├── DebugProfile.entitlements
│ │ ├── Info.plist
│ │ ├── MainFlutterWindow.swift
│ │ └── Release.entitlements
│ └── RunnerTests
│ │ └── RunnerTests.swift
├── pubspec.lock
├── pubspec.yaml
└── test
│ └── widget_test.dart
├── ios
├── Classes
│ ├── FFmpegKitFlutterPlugin.h
│ └── FFmpegKitFlutterPlugin.m
└── ffmpeg_kit_flutter_new.podspec
├── lib
├── abstract_session.dart
├── arch_detect.dart
├── chapter.dart
├── ffmpeg_kit.dart
├── ffmpeg_kit_config.dart
├── ffmpeg_session.dart
├── ffmpeg_session_complete_callback.dart
├── ffprobe_kit.dart
├── ffprobe_session.dart
├── ffprobe_session_complete_callback.dart
├── level.dart
├── log.dart
├── log_callback.dart
├── log_redirection_strategy.dart
├── media_information.dart
├── media_information_json_parser.dart
├── media_information_session.dart
├── media_information_session_complete_callback.dart
├── packages.dart
├── return_code.dart
├── session.dart
├── session_state.dart
├── signal.dart
├── src
│ ├── ffmpeg_kit_factory.dart
│ └── ffmpeg_kit_flutter_initializer.dart
├── statistics.dart
├── statistics_callback.dart
└── stream_information.dart
├── macos
├── Assets
│ └── .gitkeep
├── Classes
│ ├── FFmpegKitFlutterPlugin.h
│ └── FFmpegKitFlutterPlugin.m
└── ffmpeg_kit_flutter_new.podspec
├── pubspec.yaml
└── scripts
├── setup_android.sh
├── setup_ios.sh
└── setup_macos.sh
/.fvmrc:
--------------------------------------------------------------------------------
1 | {
2 | "flutter": "3.7.12"
3 | }
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Miscellaneous
2 | *.class
3 | *.log
4 | *.pyc
5 | *.swp
6 | .DS_Store
7 | .atom/
8 | .build/
9 | .buildlog/
10 | .history
11 | .svn/
12 | .swiftpm/
13 | migrate_working_dir/
14 | android/ffmpeg-kit-https/
15 |
16 | # IntelliJ related
17 | *.iml
18 | *.ipr
19 | *.iws
20 | .idea/
21 |
22 | # The .vscode folder contains launch configuration and tasks you configure in
23 | # VS Code which you may wish to be included in version control, so this line
24 | # is commented out by default.
25 | #.vscode/
26 |
27 | # Flutter/Dart/Pub related
28 | # Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock.
29 | /pubspec.lock
30 | **/doc/api/
31 | .dart_tool/
32 | .flutter-plugins
33 | .flutter-plugins-dependencies
34 | build/
35 |
36 | # FVM Version Cache
37 | .fvm/
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | ## 1.6.1
2 |
3 | * Removed manual packaging of prebuilt dependencies for Android
4 | * Cleaned up unnecessary logs
5 |
6 | ## 1.6.0
7 |
8 | * Added new seamless Android .aar support
9 |
10 | ## 1.5.0
11 |
12 | * Added MacOS support by directly downloading and unpacking frameworks
13 |
14 | ## 1.4.1
15 |
16 | * Updated README.md
17 |
18 | ## 1.4.0
19 |
20 | * Added build.bat jni
21 | * Updated Gradle script in order to be able to download and unpack .aar on Windows.
22 |
23 | ## 1.3.0
24 |
25 | * Moved from FFmpeg `http` to `full_gpl` for Android
26 | * Added downloading and unpacking of 6.0.2 `full-gpl` .aar
27 |
28 | ## 1.2.1
29 |
30 | * Added displaying of Android platform to pub.dev
31 | * Fixed static analysis issues
32 |
33 | ## 1.2.0
34 |
35 | * New example project
36 | * Resurrected Android by creating new `ffmpeg_kit_flutter_android` library with `com.arthenica:ffmpeg-kit-https:6.0-2.LTS` implementation
37 | * iOS deployment target is increased to 14.0
38 | * Upgraded plugin_platform_interface version
39 |
40 | ## 1.1.0
41 |
42 | * Moved from `https` to `full-gpl` binding for MacOS
43 | * Upgraded Flutter and Dart versions
44 |
45 | ## 1.0.0
46 |
47 | * Initial release
48 | * Fixed Android and MacOS bindings
49 | * Upgraded FFmpegKitFlutterPlugin.java to work with Flutter 3.29
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU LESSER GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 |
9 | This version of the GNU Lesser General Public License incorporates
10 | the terms and conditions of version 3 of the GNU General Public
11 | License, supplemented by the additional permissions listed below.
12 |
13 | 0. Additional Definitions.
14 |
15 | As used herein, "this License" refers to version 3 of the GNU Lesser
16 | General Public License, and the "GNU GPL" refers to version 3 of the GNU
17 | General Public License.
18 |
19 | "The Library" refers to a covered work governed by this License,
20 | other than an Application or a Combined Work as defined below.
21 |
22 | An "Application" is any work that makes use of an interface provided
23 | by the Library, but which is not otherwise based on the Library.
24 | Defining a subclass of a class defined by the Library is deemed a mode
25 | of using an interface provided by the Library.
26 |
27 | A "Combined Work" is a work produced by combining or linking an
28 | Application with the Library. The particular version of the Library
29 | with which the Combined Work was made is also called the "Linked
30 | Version".
31 |
32 | The "Minimal Corresponding Source" for a Combined Work means the
33 | Corresponding Source for the Combined Work, excluding any source code
34 | for portions of the Combined Work that, considered in isolation, are
35 | based on the Application, and not on the Linked Version.
36 |
37 | The "Corresponding Application Code" for a Combined Work means the
38 | object code and/or source code for the Application, including any data
39 | and utility programs needed for reproducing the Combined Work from the
40 | Application, but excluding the System Libraries of the Combined Work.
41 |
42 | 1. Exception to Section 3 of the GNU GPL.
43 |
44 | You may convey a covered work under sections 3 and 4 of this License
45 | without being bound by section 3 of the GNU GPL.
46 |
47 | 2. Conveying Modified Versions.
48 |
49 | If you modify a copy of the Library, and, in your modifications, a
50 | facility refers to a function or data to be supplied by an Application
51 | that uses the facility (other than as an argument passed when the
52 | facility is invoked), then you may convey a copy of the modified
53 | version:
54 |
55 | a) under this License, provided that you make a good faith effort to
56 | ensure that, in the event an Application does not supply the
57 | function or data, the facility still operates, and performs
58 | whatever part of its purpose remains meaningful, or
59 |
60 | b) under the GNU GPL, with none of the additional permissions of
61 | this License applicable to that copy.
62 |
63 | 3. Object Code Incorporating Material from Library Header Files.
64 |
65 | The object code form of an Application may incorporate material from
66 | a header file that is part of the Library. You may convey such object
67 | code under terms of your choice, provided that, if the incorporated
68 | material is not limited to numerical parameters, data structure
69 | layouts and accessors, or small macros, inline functions and templates
70 | (ten or fewer lines in length), you do both of the following:
71 |
72 | a) Give prominent notice with each copy of the object code that the
73 | Library is used in it and that the Library and its use are
74 | covered by this License.
75 |
76 | b) Accompany the object code with a copy of the GNU GPL and this license
77 | document.
78 |
79 | 4. Combined Works.
80 |
81 | You may convey a Combined Work under terms of your choice that,
82 | taken together, effectively do not restrict modification of the
83 | portions of the Library contained in the Combined Work and reverse
84 | engineering for debugging such modifications, if you also do each of
85 | the following:
86 |
87 | a) Give prominent notice with each copy of the Combined Work that
88 | the Library is used in it and that the Library and its use are
89 | covered by this License.
90 |
91 | b) Accompany the Combined Work with a copy of the GNU GPL and this license
92 | document.
93 |
94 | c) For a Combined Work that displays copyright notices during
95 | execution, include the copyright notice for the Library among
96 | these notices, as well as a reference directing the user to the
97 | copies of the GNU GPL and this license document.
98 |
99 | d) Do one of the following:
100 |
101 | 0) Convey the Minimal Corresponding Source under the terms of this
102 | License, and the Corresponding Application Code in a form
103 | suitable for, and under terms that permit, the user to
104 | recombine or relink the Application with a modified version of
105 | the Linked Version to produce a modified Combined Work, in the
106 | manner specified by section 6 of the GNU GPL for conveying
107 | Corresponding Source.
108 |
109 | 1) Use a suitable shared library mechanism for linking with the
110 | Library. A suitable mechanism is one that (a) uses at run time
111 | a copy of the Library already present on the user's computer
112 | system, and (b) will operate properly with a modified version
113 | of the Library that is interface-compatible with the Linked
114 | Version.
115 |
116 | e) Provide Installation Information, but only if you would otherwise
117 | be required to provide such information under section 6 of the
118 | GNU GPL, and only to the extent that such information is
119 | necessary to install and execute a modified version of the
120 | Combined Work produced by recombining or relinking the
121 | Application with a modified version of the Linked Version. (If
122 | you use option 4d0, the Installation Information must accompany
123 | the Minimal Corresponding Source and Corresponding Application
124 | Code. If you use option 4d1, you must provide the Installation
125 | Information in the manner specified by section 6 of the GNU GPL
126 | for conveying Corresponding Source.)
127 |
128 | 5. Combined Libraries.
129 |
130 | You may place library facilities that are a work based on the
131 | Library side by side in a single library together with other library
132 | facilities that are not Applications and are not covered by this
133 | License, and convey such a combined library under terms of your
134 | choice, if you do both of the following:
135 |
136 | a) Accompany the combined library with a copy of the same work based
137 | on the Library, uncombined with any other library facilities,
138 | conveyed under the terms of this License.
139 |
140 | b) Give prominent notice with the combined library that part of it
141 | is a work based on the Library, and explaining where to find the
142 | accompanying uncombined form of the same work.
143 |
144 | 6. Revised Versions of the GNU Lesser General Public License.
145 |
146 | The Free Software Foundation may publish revised and/or new versions
147 | of the GNU Lesser General Public License from time to time. Such new
148 | versions will be similar in spirit to the present version, but may
149 | differ in detail to address new problems or concerns.
150 |
151 | Each version is given a distinguishing version number. If the
152 | Library as you received it specifies that a certain numbered version
153 | of the GNU Lesser General Public License "or any later version"
154 | applies to it, you have the option of following the terms and
155 | conditions either of that published version or of any later version
156 | published by the Free Software Foundation. If the Library as you
157 | received it does not specify a version number of the GNU Lesser
158 | General Public License, you may choose any version of the GNU Lesser
159 | General Public License ever published by the Free Software Foundation.
160 |
161 | If the Library as you received it specifies that a proxy can decide
162 | whether future versions of the GNU Lesser General Public License shall
163 | apply, that proxy's public statement of acceptance of any version is
164 | permanent authorization for you to choose that version for the
165 | Library.
166 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 | # FFmpegKit for Flutter [](https://pub.dev/packages/ffmpeg_kit_flutter_new)
3 |
4 | ## Upgraded version of the original [Flutter FFmpegKit](https://github.com/arthenica/ffmpeg-kit/tree/main/flutter/flutter).
5 |
6 | ### 1. Features
7 |
8 | - Updated Android and MacOS bindings to work with Flutter 3.29
9 | - Includes both `FFmpeg` and `FFprobe`
10 | - Supports
11 | - `Android`, `iOS` and `macOS`
12 | - FFmpeg `v6.0.2-LTS`
13 | - `arm-v7a`, `arm-v7a-neon`, `arm64-v8a`, `x86` and `x86_64` architectures on Android
14 | - `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
17 | - `iOS SDK 14.0` or later
18 | - `arm64` and `x86_64` architectures on macOS
19 | - `macOS SDK 10.15` or later
20 | - Can process Storage Access Framework (SAF) Uris on Android
21 | - 25 external libraries
22 |
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`
26 |
27 | - 4 external libraries with GPL license
28 |
29 | `vid.stab`, `x264`, `x265`, `xvidcore`
30 |
31 | - Licensed under `LGPL 3.0` by default, some packages licensed by `GPL v3.0` effectively
32 |
33 | ### 2. Known issues
34 |
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.
45 |
46 | ### 3. Installation
47 |
48 | Add `ffmpeg_kit_flutter_new` as a dependency in your `pubspec.yaml file`.
49 |
50 | ```yaml
51 | dependencies:
52 | ffmpeg_kit_flutter_new: ^1.6.1
53 | ```
54 |
55 | NOTE: Android know issue:
56 |
57 | #### 4. Platform Support
58 |
59 | The following table shows Android API level, iOS deployment target and macOS deployment target requirements in
60 | `ffmpeg_kit_flutter_new` releases.
61 |
62 |
63 |
64 |
65 | LTS Release |
66 |
67 |
68 | Android API Level |
69 | iOS Minimum Deployment Target |
70 | macOS Minimum Deployment Target |
71 |
72 |
73 |
74 |
75 | 24 |
76 | 14 |
77 | 10.15 |
78 |
79 |
80 |
81 |
82 | ### 4. Using
83 |
84 | 1. Execute FFmpeg commands.
85 |
86 | ```dart
87 | import 'package:ffmpeg_kit_flutter/ffmpeg_kit.dart';
88 |
89 | FFmpegKit.execute('-i file1.mp4 -c:v mpeg4 file2.mp4').then((session) async {
90 | final returnCode = await session.getReturnCode();
91 | if (ReturnCode.isSuccess(returnCode)) {
92 | // SUCCESS
93 | } else if (ReturnCode.isCancel(returnCode)) {
94 | // CANCEL
95 | } else {
96 | // ERROR
97 | }
98 | });
99 | ```
100 | 2. Each `execute` call creates a new session. Access every detail about your execution from the session created.
101 |
102 | ```dart
103 | FFmpegKit.execute('-i file1.mp4 -c:v mpeg4 file2.mp4').then((session) async {
104 | // Unique session id created for this execution
105 | final sessionId = session.getSessionId();
106 | // Command arguments as a single string
107 | final command = session.getCommand();
108 | // Command arguments
109 | final commandArguments = session.getArguments();
110 | // State of the execution. Shows whether it is still running or completed
111 | final state = await session.getState();
112 | // Return code for completed sessions. Will be undefined if session is still running or FFmpegKit fails to run it
113 | final returnCode = await session.getReturnCode();
114 | final startTime = session.getStartTime();
115 | final endTime = await session.getEndTime();
116 | final duration = await session.getDuration();
117 | // Console output generated for this execution
118 | final output = await session.getOutput();
119 | // The stack trace if FFmpegKit fails to run a command
120 | final failStackTrace = await session.getFailStackTrace();
121 | // The list of logs generated for this execution
122 | final logs = await session.getLogs();
123 | // The list of statistics generated for this execution (only available on FFmpegSession)
124 | final statistics = await (session as FFmpegSession).getStatistics();
125 | });
126 | ```
127 | 3. Execute `FFmpeg` commands by providing session specific `execute`/`log`/`session` callbacks.
128 |
129 | ```dart
130 | FFmpegKit.executeAsync('-i file1.mp4 -c:v mpeg4 file2.mp4', (Session session) async {
131 | // CALLED WHEN SESSION IS EXECUTED
132 | }, (Log log) {
133 | // CALLED WHEN SESSION PRINTS LOGS
134 | }, (Statistics statistics) {
135 | // CALLED WHEN SESSION GENERATES STATISTICS
136 | });
137 | ```
138 | 4. Execute `FFprobe` commands.
139 |
140 | ```dart
141 | FFprobeKit.execute(ffprobeCommand).then((session) async {
142 | // CALLED WHEN SESSION IS EXECUTED
143 | });
144 | ```
145 | 5. Get media information for a file/url.
146 |
147 | ```dart
148 | FFprobeKit.getMediaInformation('').then((session) async {
149 | final information = await session.getMediaInformation();
150 | if (information == null) {
151 | // CHECK THE FOLLOWING ATTRIBUTES ON ERROR
152 | final state = FFmpegKitConfig.sessionStateToString(await session.getState());
153 | final returnCode = await session.getReturnCode();
154 | final failStackTrace = await session.getFailStackTrace();
155 | final duration = await session.getDuration();
156 | final output = await session.getOutput();
157 | }
158 | });
159 | ```
160 | 6. Stop ongoing FFmpeg operations.
161 |
162 | - Stop all sessions
163 | ```dart
164 | FFmpegKit.cancel();
165 | ```
166 | - Stop a specific session
167 | ```dart
168 | FFmpegKit.cancel(sessionId);
169 | ```
170 | 7. (Android) Convert Storage Access Framework (SAF) Uris into paths that can be read or written by
171 | `FFmpegKit` and `FFprobeKit`.
172 |
173 | - Reading a file:
174 | ```dart
175 | FFmpegKitConfig.selectDocumentForRead('*/*').then((uri) {
176 | FFmpegKitConfig.getSafParameterForRead(uri!).then((safUrl) {
177 | FFmpegKit.executeAsync("-i ${safUrl!} -c:v mpeg4 file2.mp4");
178 | });
179 | });
180 | ```
181 | - Writing to a file:
182 | ```dart
183 | FFmpegKitConfig.selectDocumentForWrite('video.mp4', 'video/*').then((uri) {
184 | FFmpegKitConfig.getSafParameterForWrite(uri!).then((safUrl) {
185 | FFmpegKit.executeAsync("-i file1.mp4 -c:v mpeg4 ${safUrl}");
186 | });
187 | });
188 | ```
189 | 8. Get previous `FFmpeg`, `FFprobe` and `MediaInformation` sessions from the session history.
190 |
191 | ```dart
192 | FFmpegKit.listSessions().then((sessionList) {
193 | sessionList.forEach((session) {
194 | final sessionId = session.getSessionId();
195 | });
196 | });
197 | FFprobeKit.listFFprobeSessions().then((sessionList) {
198 | sessionList.forEach((session) {
199 | final sessionId = session.getSessionId();
200 | });
201 | });
202 | FFprobeKit.listMediaInformationSessions().then((sessionList) {
203 | sessionList.forEach((session) {
204 | final sessionId = session.getSessionId();
205 | });
206 | });
207 | ```
208 | 9. Enable global callbacks.
209 |
210 | - Session type specific Complete Callbacks, called when an async session has been completed
211 |
212 | ```dart
213 | FFmpegKitConfig.enableFFmpegSessionCompleteCallback((session) {
214 | final sessionId = session.getSessionId();
215 | });
216 | FFmpegKitConfig.enableFFprobeSessionCompleteCallback((session) {
217 | final sessionId = session.getSessionId();
218 | });
219 | FFmpegKitConfig.enableMediaInformationSessionCompleteCallback((session) {
220 | final sessionId = session.getSessionId();
221 | });
222 | ```
223 | - Log Callback, called when a session generates logs
224 |
225 | ```dart
226 | FFmpegKitConfig.enableLogCallback((log) {
227 | final message = log.getMessage();
228 | });
229 | ```
230 | - Statistics Callback, called when a session generates statistics
231 |
232 | ```dart
233 | FFmpegKitConfig.enableStatisticsCallback((statistics) {
234 | final size = statistics.getSize();
235 | });
236 | ```
237 | 10. Register system fonts and custom font directories.
238 |
239 | ```dart
240 | FFmpegKitConfig.setFontDirectoryList(["/system/fonts", "/System/Library/Fonts", ""]);
241 | ```
242 |
--------------------------------------------------------------------------------
/analysis_options.yaml:
--------------------------------------------------------------------------------
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
--------------------------------------------------------------------------------
/android/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 | .cxx
--------------------------------------------------------------------------------
/android/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | ext.kotlin_version = "2.1.10"
3 |
4 | repositories {
5 | google()
6 | mavenLocal()
7 | mavenCentral()
8 | }
9 |
10 | dependencies {
11 | classpath("com.android.tools.build:gradle:8.7.0")
12 | classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version")
13 | }
14 | }
15 |
16 | allprojects {
17 | repositories {
18 | google()
19 | mavenCentral()
20 | }
21 | }
22 |
23 | apply plugin: "com.android.library"
24 | apply plugin: "kotlin-android"
25 |
26 | android {
27 | namespace = "com.antonkarpenko.ffmpegkit"
28 |
29 | compileSdk = 35
30 |
31 | compileOptions {
32 | sourceCompatibility = JavaVersion.VERSION_17
33 | targetCompatibility = JavaVersion.VERSION_17
34 | }
35 |
36 | kotlinOptions {
37 | jvmTarget = JavaVersion.VERSION_17
38 | }
39 |
40 | buildTypes {
41 | release {
42 | minifyEnabled false
43 | }
44 | }
45 |
46 | defaultConfig {
47 | minSdk = 24
48 | versionCode 1
49 | versionName "1.0.0"
50 | }
51 |
52 | dependencies {
53 | implementation("androidx.annotation:annotation:1.9.1")
54 | }
55 | }
--------------------------------------------------------------------------------
/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx1536M
2 | android.useAndroidX=true
3 | android.enableJetifier=true
--------------------------------------------------------------------------------
/android/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sk3llo/ffmpeg_kit_flutter/ddfe9280563e6e5ce5e12d6fbfaeb948d24e124c/android/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
4 | networkTimeout=10000
5 | validateDistributionUrl=true
6 | zipStoreBase=GRADLE_USER_HOME
7 | zipStorePath=wrapper/dists
8 |
--------------------------------------------------------------------------------
/android/gradlew:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | #
4 | # Copyright © 2015-2021 the original authors.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # https://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 |
19 | ##############################################################################
20 | #
21 | # Gradle start up script for POSIX generated by Gradle.
22 | #
23 | # Important for running:
24 | #
25 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
26 | # noncompliant, but you have some other compliant shell such as ksh or
27 | # bash, then to run this script, type that shell name before the whole
28 | # command line, like:
29 | #
30 | # ksh Gradle
31 | #
32 | # Busybox and similar reduced shells will NOT work, because this script
33 | # requires all of these POSIX shell features:
34 | # * functions;
35 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
36 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»;
37 | # * compound commands having a testable exit status, especially «case»;
38 | # * various built-in commands including «command», «set», and «ulimit».
39 | #
40 | # Important for patching:
41 | #
42 | # (2) This script targets any POSIX shell, so it avoids extensions provided
43 | # by Bash, Ksh, etc; in particular arrays are avoided.
44 | #
45 | # The "traditional" practice of packing multiple parameters into a
46 | # space-separated string is a well documented source of bugs and security
47 | # problems, so this is (mostly) avoided, by progressively accumulating
48 | # options in "$@", and eventually passing that to Java.
49 | #
50 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
51 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
52 | # see the in-line comments for details.
53 | #
54 | # There are tweaks for specific operating systems such as AIX, CygWin,
55 | # Darwin, MinGW, and NonStop.
56 | #
57 | # (3) This script is generated from the Groovy template
58 | # https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
59 | # within the Gradle project.
60 | #
61 | # You can find Gradle at https://github.com/gradle/gradle/.
62 | #
63 | ##############################################################################
64 |
65 | # Attempt to set APP_HOME
66 |
67 | # Resolve links: $0 may be a link
68 | app_path=$0
69 |
70 | # Need this for daisy-chained symlinks.
71 | while
72 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
73 | [ -h "$app_path" ]
74 | do
75 | ls=$( ls -ld "$app_path" )
76 | link=${ls#*' -> '}
77 | case $link in #(
78 | /*) app_path=$link ;; #(
79 | *) app_path=$APP_HOME$link ;;
80 | esac
81 | done
82 |
83 | # This is normally unused
84 | # shellcheck disable=SC2034
85 | APP_BASE_NAME=${0##*/}
86 | # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
87 | APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
88 |
89 | # Use the maximum available, or set MAX_FD != -1 to use that value.
90 | MAX_FD=maximum
91 |
92 | warn () {
93 | echo "$*"
94 | } >&2
95 |
96 | die () {
97 | echo
98 | echo "$*"
99 | echo
100 | exit 1
101 | } >&2
102 |
103 | # OS specific support (must be 'true' or 'false').
104 | cygwin=false
105 | msys=false
106 | darwin=false
107 | nonstop=false
108 | case "$( uname )" in #(
109 | CYGWIN* ) cygwin=true ;; #(
110 | Darwin* ) darwin=true ;; #(
111 | MSYS* | MINGW* ) msys=true ;; #(
112 | NONSTOP* ) nonstop=true ;;
113 | esac
114 |
115 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
116 |
117 |
118 | # Determine the Java command to use to start the JVM.
119 | if [ -n "$JAVA_HOME" ] ; then
120 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
121 | # IBM's JDK on AIX uses strange locations for the executables
122 | JAVACMD=$JAVA_HOME/jre/sh/java
123 | else
124 | JAVACMD=$JAVA_HOME/bin/java
125 | fi
126 | if [ ! -x "$JAVACMD" ] ; then
127 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
128 |
129 | Please set the JAVA_HOME variable in your environment to match the
130 | location of your Java installation."
131 | fi
132 | else
133 | JAVACMD=java
134 | if ! command -v java >/dev/null 2>&1
135 | then
136 | die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
137 |
138 | Please set the JAVA_HOME variable in your environment to match the
139 | location of your Java installation."
140 | fi
141 | fi
142 |
143 | # Increase the maximum file descriptors if we can.
144 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
145 | case $MAX_FD in #(
146 | max*)
147 | # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
148 | # shellcheck disable=SC2039,SC3045
149 | MAX_FD=$( ulimit -H -n ) ||
150 | warn "Could not query maximum file descriptor limit"
151 | esac
152 | case $MAX_FD in #(
153 | '' | soft) :;; #(
154 | *)
155 | # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
156 | # shellcheck disable=SC2039,SC3045
157 | ulimit -n "$MAX_FD" ||
158 | warn "Could not set maximum file descriptor limit to $MAX_FD"
159 | esac
160 | fi
161 |
162 | # Collect all arguments for the java command, stacking in reverse order:
163 | # * args from the command line
164 | # * the main class name
165 | # * -classpath
166 | # * -D...appname settings
167 | # * --module-path (only if needed)
168 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
169 |
170 | # For Cygwin or MSYS, switch paths to Windows format before running java
171 | if "$cygwin" || "$msys" ; then
172 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
173 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
174 |
175 | JAVACMD=$( cygpath --unix "$JAVACMD" )
176 |
177 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
178 | for arg do
179 | if
180 | case $arg in #(
181 | -*) false ;; # don't mess with options #(
182 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
183 | [ -e "$t" ] ;; #(
184 | *) false ;;
185 | esac
186 | then
187 | arg=$( cygpath --path --ignore --mixed "$arg" )
188 | fi
189 | # Roll the args list around exactly as many times as the number of
190 | # args, so each arg winds up back in the position where it started, but
191 | # possibly modified.
192 | #
193 | # NB: a `for` loop captures its iteration list before it begins, so
194 | # changing the positional parameters here affects neither the number of
195 | # iterations, nor the values presented in `arg`.
196 | shift # remove old arg
197 | set -- "$@" "$arg" # push replacement arg
198 | done
199 | fi
200 |
201 |
202 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
203 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
204 |
205 | # Collect all arguments for the java command:
206 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
207 | # and any embedded shellness will be escaped.
208 | # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
209 | # treated as '${Hostname}' itself on the command line.
210 |
211 | set -- \
212 | "-Dorg.gradle.appname=$APP_BASE_NAME" \
213 | -classpath "$CLASSPATH" \
214 | org.gradle.wrapper.GradleWrapperMain \
215 | "$@"
216 |
217 | # Stop when "xargs" is not available.
218 | if ! command -v xargs >/dev/null 2>&1
219 | then
220 | die "xargs is not available"
221 | fi
222 |
223 | # Use "xargs" to parse quoted args.
224 | #
225 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed.
226 | #
227 | # In Bash we could simply go:
228 | #
229 | # readarray ARGS < <( xargs -n1 <<<"$var" ) &&
230 | # set -- "${ARGS[@]}" "$@"
231 | #
232 | # but POSIX shell has neither arrays nor command substitution, so instead we
233 | # post-process each arg (as a line of input to sed) to backslash-escape any
234 | # character that might be a shell metacharacter, then use eval to reverse
235 | # that process (while maintaining the separation between arguments), and wrap
236 | # the whole thing up as a single "set" statement.
237 | #
238 | # This will of course break if any of these variables contains a newline or
239 | # an unmatched quote.
240 | #
241 |
242 | eval "set -- $(
243 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
244 | xargs -n1 |
245 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
246 | tr '\n' ' '
247 | )" '"$@"'
248 |
249 | exec "$JAVACMD" "$@"
250 |
--------------------------------------------------------------------------------
/android/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%"=="" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%"=="" set DIRNAME=.
29 | @rem This is normally unused
30 | set APP_BASE_NAME=%~n0
31 | set APP_HOME=%DIRNAME%
32 |
33 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
34 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
35 |
36 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
37 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
38 |
39 | @rem Find java.exe
40 | if defined JAVA_HOME goto findJavaFromJavaHome
41 |
42 | set JAVA_EXE=java.exe
43 | %JAVA_EXE% -version >NUL 2>&1
44 | if %ERRORLEVEL% equ 0 goto execute
45 |
46 | echo.
47 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
48 | echo.
49 | echo Please set the JAVA_HOME variable in your environment to match the
50 | echo location of your Java installation.
51 |
52 | goto fail
53 |
54 | :findJavaFromJavaHome
55 | set JAVA_HOME=%JAVA_HOME:"=%
56 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
57 |
58 | if exist "%JAVA_EXE%" goto execute
59 |
60 | echo.
61 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
62 | echo.
63 | echo Please set the JAVA_HOME variable in your environment to match the
64 | echo location of your Java installation.
65 |
66 | goto fail
67 |
68 | :execute
69 | @rem Setup the command line
70 |
71 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
72 |
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if %ERRORLEVEL% equ 0 goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | set EXIT_CODE=%ERRORLEVEL%
85 | if %EXIT_CODE% equ 0 set EXIT_CODE=1
86 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
87 | exit /b %EXIT_CODE%
88 |
89 | :mainEnd
90 | if "%OS%"=="Windows_NT" endlocal
91 |
92 | :omega
93 |
--------------------------------------------------------------------------------
/android/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'ffmpeg-kit-flutter-android'
2 |
3 |
--------------------------------------------------------------------------------
/android/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
--------------------------------------------------------------------------------
/android/src/main/java/com/antonkarpenko/ffmpegkit/MainActivity.java:
--------------------------------------------------------------------------------
1 | package android.src.main.java.com.arthenica.android;
2 |
3 | import io.flutter.embedding.android.FlutterActivity;
4 |
5 | public class MainActivity extends FlutterActivity {}
--------------------------------------------------------------------------------
/example/.gitignore:
--------------------------------------------------------------------------------
1 | # Miscellaneous
2 | *.class
3 | *.log
4 | *.pyc
5 | *.swp
6 | .DS_Store
7 | .atom/
8 | .build/
9 | .buildlog/
10 | .history
11 | .svn/
12 | .swiftpm/
13 | migrate_working_dir/
14 |
15 | # IntelliJ related
16 | *.iml
17 | *.ipr
18 | *.iws
19 | .idea/
20 |
21 | # The .vscode folder contains launch configuration and tasks you configure in
22 | # VS Code which you may wish to be included in version control, so this line
23 | # is commented out by default.
24 | #.vscode/
25 |
26 | # Flutter/Dart/Pub related
27 | **/doc/api/
28 | **/ios/Flutter/.last_build_id
29 | .dart_tool/
30 | .flutter-plugins
31 | .flutter-plugins-dependencies
32 | .pub-cache/
33 | .pub/
34 | /build/
35 |
36 | # Symbolication related
37 | app.*.symbols
38 |
39 | # Obfuscation related
40 | app.*.map.json
41 |
42 | # Android Studio will place build artifacts here
43 | /android/app/debug
44 | /android/app/profile
45 | /android/app/release
46 |
--------------------------------------------------------------------------------
/example/.metadata:
--------------------------------------------------------------------------------
1 | # This file tracks properties of this Flutter project.
2 | # Used by Flutter tool to assess capabilities and perform upgrades etc.
3 | #
4 | # This file should be version controlled and should not be manually edited.
5 |
6 | version:
7 | revision: "ea121f8859e4b13e47a8f845e4586164519588bc"
8 | channel: "stable"
9 |
10 | project_type: app
11 |
12 | # Tracks metadata for the flutter migrate command
13 | migration:
14 | platforms:
15 | - platform: root
16 | create_revision: ea121f8859e4b13e47a8f845e4586164519588bc
17 | base_revision: ea121f8859e4b13e47a8f845e4586164519588bc
18 | - platform: android
19 | create_revision: ea121f8859e4b13e47a8f845e4586164519588bc
20 | base_revision: ea121f8859e4b13e47a8f845e4586164519588bc
21 | - platform: ios
22 | create_revision: ea121f8859e4b13e47a8f845e4586164519588bc
23 | base_revision: ea121f8859e4b13e47a8f845e4586164519588bc
24 | - platform: macos
25 | create_revision: ea121f8859e4b13e47a8f845e4586164519588bc
26 | base_revision: ea121f8859e4b13e47a8f845e4586164519588bc
27 |
28 | # User provided section
29 |
30 | # List of Local paths (relative to this file) that should be
31 | # ignored by the migrate tool.
32 | #
33 | # Files that are not part of the templates will be ignored by default.
34 | unmanaged_files:
35 | - 'lib/main.dart'
36 | - 'ios/Runner.xcodeproj/project.pbxproj'
37 |
--------------------------------------------------------------------------------
/example/README.md:
--------------------------------------------------------------------------------
1 | # example
2 |
3 | FFMPEG example
4 |
5 | ## Getting Started
6 |
7 | This project is a starting point for a Flutter application.
8 |
9 | A few resources to get you started if this is your first Flutter project:
10 |
11 | - [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab)
12 | - [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook)
13 |
14 | For help getting started with Flutter development, view the
15 | [online documentation](https://docs.flutter.dev/), which offers tutorials,
16 | samples, guidance on mobile development, and a full API reference.
17 |
--------------------------------------------------------------------------------
/example/analysis_options.yaml:
--------------------------------------------------------------------------------
1 | # This file configures the analyzer, which statically analyzes Dart code to
2 | # check for errors, warnings, and lints.
3 | #
4 | # The issues identified by the analyzer are surfaced in the UI of Dart-enabled
5 | # IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
6 | # invoked from the command line by running `flutter analyze`.
7 |
8 | # The following line activates a set of recommended lints for Flutter apps,
9 | # packages, and plugins designed to encourage good coding practices.
10 | include: package:flutter_lints/flutter.yaml
11 |
12 | linter:
13 | # The lint rules applied to this project can be customized in the
14 | # section below to disable rules from the `package:flutter_lints/flutter.yaml`
15 | # included above or to enable additional rules. A list of all available lints
16 | # and their documentation is published at https://dart.dev/lints.
17 | #
18 | # Instead of disabling a lint rule for the entire project in the
19 | # section below, it can also be suppressed for a single line of code
20 | # or a specific dart file by using the `// ignore: name_of_lint` and
21 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file
22 | # producing the lint.
23 | rules:
24 | # avoid_print: false # Uncomment to disable the `avoid_print` rule
25 | # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
26 |
27 | # Additional information about this file can be found at
28 | # https://dart.dev/guides/language/analysis-options
29 |
--------------------------------------------------------------------------------
/example/android/.gitignore:
--------------------------------------------------------------------------------
1 | gradle-wrapper.jar
2 | /.gradle
3 | /captures/
4 | /gradlew
5 | /gradlew.bat
6 | /local.properties
7 | GeneratedPluginRegistrant.java
8 | .cxx/
9 |
10 | # Remember to never publicly share your keystore.
11 | # See https://flutter.dev/to/reference-keystore
12 | key.properties
13 | **/*.keystore
14 | **/*.jks
15 |
--------------------------------------------------------------------------------
/example/android/app/build.gradle.kts:
--------------------------------------------------------------------------------
1 | plugins {
2 | id("com.android.application")
3 | id("kotlin-android")
4 | // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
5 | id("dev.flutter.flutter-gradle-plugin")
6 | }
7 |
8 | android {
9 | namespace = "com.example.example"
10 | compileSdk = flutter.compileSdkVersion
11 |
12 |
13 | compileOptions {
14 | sourceCompatibility = JavaVersion.VERSION_17
15 | targetCompatibility = JavaVersion.VERSION_17
16 | }
17 |
18 | kotlinOptions {
19 | jvmTarget = JavaVersion.VERSION_17.toString()
20 | }
21 |
22 | defaultConfig {
23 | // Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
24 | applicationId = "com.example.example"
25 | // You can update the following values to match your application needs.
26 | // For more information, see: https://flutter.dev/to/review-gradle-config.
27 | minSdk = 24
28 | targetSdk = flutter.targetSdkVersion
29 | versionCode = flutter.versionCode
30 | versionName = flutter.versionName
31 | }
32 |
33 | buildTypes {
34 | release {
35 | isMinifyEnabled = true
36 | // Add your own signing config for the release build.
37 | // Signing with the debug keys for now, so `flutter run --release` works.
38 | proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
39 | signingConfig = signingConfigs.getByName("debug")
40 | }
41 | debug {
42 | isMinifyEnabled = false
43 | proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
44 | signingConfig = signingConfigs.getByName("debug")
45 | }
46 | }
47 | }
48 |
49 | flutter {
50 | source = "../.."
51 | }
52 |
--------------------------------------------------------------------------------
/example/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/example/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
15 |
19 |
23 |
24 |
25 |
26 |
27 |
28 |
30 |
33 |
34 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.example.example
2 |
3 | import io.flutter.embedding.android.FlutterActivity
4 | import io.flutter.embedding.engine.FlutterEngine
5 | import io.flutter.plugin.common.MethodChannel
6 |
7 | class MainActivity : FlutterActivity() {}
8 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/drawable-v21/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/drawable/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sk3llo/ffmpeg_kit_flutter/ddfe9280563e6e5ce5e12d6fbfaeb948d24e124c/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sk3llo/ffmpeg_kit_flutter/ddfe9280563e6e5ce5e12d6fbfaeb948d24e124c/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sk3llo/ffmpeg_kit_flutter/ddfe9280563e6e5ce5e12d6fbfaeb948d24e124c/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sk3llo/ffmpeg_kit_flutter/ddfe9280563e6e5ce5e12d6fbfaeb948d24e124c/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sk3llo/ffmpeg_kit_flutter/ddfe9280563e6e5ce5e12d6fbfaeb948d24e124c/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/values-night/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/example/android/app/src/profile/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/example/android/build.gradle.kts:
--------------------------------------------------------------------------------
1 | allprojects {
2 | repositories {
3 | google()
4 | mavenCentral()
5 | }
6 | }
7 |
8 | val newBuildDir: Directory = rootProject.layout.buildDirectory.dir("../../build").get()
9 | rootProject.layout.buildDirectory.value(newBuildDir)
10 |
11 | subprojects {
12 | val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name)
13 | project.layout.buildDirectory.value(newSubprojectBuildDir)
14 | }
15 | subprojects {
16 | project.evaluationDependsOn(":app")
17 | }
18 |
19 | tasks.register("clean") {
20 | delete(rootProject.layout.buildDirectory)
21 | }
22 |
--------------------------------------------------------------------------------
/example/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError
2 | android.useAndroidX=true
3 | android.enableJetifier=true
4 |
--------------------------------------------------------------------------------
/example/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | zipStoreBase=GRADLE_USER_HOME
4 | zipStorePath=wrapper/dists
5 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip
6 |
--------------------------------------------------------------------------------
/example/android/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | -keep class com.arthenica.ffmpegkit.** { *; }
--------------------------------------------------------------------------------
/example/android/proguard.txt:
--------------------------------------------------------------------------------
1 | -keep class com.antonkarpenko.ffmpegkit.FFmpegKitConfig {
2 | native ;
3 | void log(long, int, byte[]);
4 | void statistics(long, int, float, float, long , double, double, double);
5 | int safOpen(int);
6 | int safClose(int);
7 | }
8 |
9 | -keep class com.antonkarpenko.ffmpegkit.AbiDetect {
10 | native ;
11 | }
12 |
--------------------------------------------------------------------------------
/example/android/settings.gradle.kts:
--------------------------------------------------------------------------------
1 | pluginManagement {
2 | val flutterSdkPath = run {
3 | val properties = java.util.Properties()
4 | file("local.properties").inputStream().use { properties.load(it) }
5 | val flutterSdkPath = properties.getProperty("flutter.sdk")
6 | require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" }
7 | flutterSdkPath
8 | }
9 |
10 | includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
11 |
12 | repositories {
13 | google()
14 | mavenCentral()
15 | gradlePluginPortal()
16 | }
17 | }
18 |
19 | plugins {
20 | id("dev.flutter.flutter-plugin-loader") version "1.0.0"
21 | id("com.android.application") version "8.7.0" apply false
22 | id("org.jetbrains.kotlin.android") version "1.8.22" apply false
23 | }
24 |
25 | include(":app")
26 |
--------------------------------------------------------------------------------
/example/assets/sample_video.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sk3llo/ffmpeg_kit_flutter/ddfe9280563e6e5ce5e12d6fbfaeb948d24e124c/example/assets/sample_video.mp4
--------------------------------------------------------------------------------
/example/ios/.gitignore:
--------------------------------------------------------------------------------
1 | **/dgph
2 | *.mode1v3
3 | *.mode2v3
4 | *.moved-aside
5 | *.pbxuser
6 | *.perspectivev3
7 | **/*sync/
8 | .sconsign.dblite
9 | .tags*
10 | **/.vagrant/
11 | **/DerivedData/
12 | Icon?
13 | **/Pods/
14 | **/.symlinks/
15 | profile
16 | xcuserdata
17 | **/.generated/
18 | Flutter/App.framework
19 | Flutter/Flutter.framework
20 | Flutter/Flutter.podspec
21 | Flutter/Generated.xcconfig
22 | Flutter/ephemeral/
23 | Flutter/app.flx
24 | Flutter/app.zip
25 | Flutter/flutter_assets/
26 | Flutter/flutter_export_environment.sh
27 | ServiceDefinitions.json
28 | Runner/GeneratedPluginRegistrant.*
29 |
30 | # Exceptions to above rules.
31 | !default.mode1v3
32 | !default.mode2v3
33 | !default.pbxuser
34 | !default.perspectivev3
35 |
--------------------------------------------------------------------------------
/example/ios/Flutter/AppFrameworkInfo.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | App
9 | CFBundleIdentifier
10 | io.flutter.flutter.app
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | App
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1.0
23 | MinimumOSVersion
24 | 12.0
25 |
26 |
27 |
--------------------------------------------------------------------------------
/example/ios/Flutter/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
2 | #include "Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/example/ios/Flutter/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
2 | #include "Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/example/ios/Podfile:
--------------------------------------------------------------------------------
1 | # Uncomment this line to define a global platform for your project
2 | platform :ios, '14.0'
3 |
4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency.
5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true'
6 |
7 | project 'Runner', {
8 | 'Debug' => :debug,
9 | 'Profile' => :release,
10 | 'Release' => :release,
11 | }
12 |
13 | def flutter_root
14 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
15 | unless File.exist?(generated_xcode_build_settings_path)
16 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
17 | end
18 |
19 | File.foreach(generated_xcode_build_settings_path) do |line|
20 | matches = line.match(/FLUTTER_ROOT\=(.*)/)
21 | return matches[1].strip if matches
22 | end
23 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
24 | end
25 |
26 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
27 |
28 | flutter_ios_podfile_setup
29 |
30 | target 'Runner' do
31 | use_frameworks!
32 |
33 | flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
34 | target 'RunnerTests' do
35 | inherit! :search_paths
36 | end
37 | end
38 |
39 | post_install do |installer|
40 | installer.pods_project.targets.each do |target|
41 | flutter_additional_ios_build_settings(target)
42 |
43 | installer.pods_project.build_configurations.each do |config|
44 | config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
45 | end
46 | end
47 | end
48 |
--------------------------------------------------------------------------------
/example/ios/Podfile.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - ffmpeg_kit_flutter_new (1.0.0):
3 | - ffmpeg_kit_flutter_new/full-gpl-lts (= 1.0.0)
4 | - Flutter
5 | - ffmpeg_kit_flutter_new/full-gpl-lts (1.0.0):
6 | - Flutter
7 | - Flutter (1.0.0)
8 | - path_provider_foundation (0.0.1):
9 | - Flutter
10 | - FlutterMacOS
11 |
12 | DEPENDENCIES:
13 | - ffmpeg_kit_flutter_new (from `.symlinks/plugins/ffmpeg_kit_flutter_new/ios`)
14 | - Flutter (from `Flutter`)
15 | - path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
16 |
17 | EXTERNAL SOURCES:
18 | ffmpeg_kit_flutter_new:
19 | :path: ".symlinks/plugins/ffmpeg_kit_flutter_new/ios"
20 | Flutter:
21 | :path: Flutter
22 | path_provider_foundation:
23 | :path: ".symlinks/plugins/path_provider_foundation/darwin"
24 |
25 | SPEC CHECKSUMS:
26 | ffmpeg_kit_flutter_new: 5dc6b1aa0a6f6a97c878783cd4b70fc4e4d77dfe
27 | Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
28 | path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46
29 |
30 | PODFILE CHECKSUM: e9941a5854938bf016e83b9b55e2f0a9a65921ff
31 |
32 | COCOAPODS: 1.16.2
33 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
37 |
38 |
39 |
40 |
43 |
49 |
50 |
51 |
52 |
53 |
64 |
66 |
72 |
73 |
74 |
75 |
81 |
83 |
89 |
90 |
91 |
92 |
94 |
95 |
98 |
99 |
100 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/ios/Runner/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | import Flutter
2 | import UIKit
3 |
4 | @main
5 | @objc class AppDelegate: FlutterAppDelegate {
6 | override func application(
7 | _ application: UIApplication,
8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
9 | ) -> Bool {
10 | GeneratedPluginRegistrant.register(with: self)
11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions)
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "size" : "20x20",
5 | "idiom" : "iphone",
6 | "filename" : "Icon-App-20x20@2x.png",
7 | "scale" : "2x"
8 | },
9 | {
10 | "size" : "20x20",
11 | "idiom" : "iphone",
12 | "filename" : "Icon-App-20x20@3x.png",
13 | "scale" : "3x"
14 | },
15 | {
16 | "size" : "29x29",
17 | "idiom" : "iphone",
18 | "filename" : "Icon-App-29x29@1x.png",
19 | "scale" : "1x"
20 | },
21 | {
22 | "size" : "29x29",
23 | "idiom" : "iphone",
24 | "filename" : "Icon-App-29x29@2x.png",
25 | "scale" : "2x"
26 | },
27 | {
28 | "size" : "29x29",
29 | "idiom" : "iphone",
30 | "filename" : "Icon-App-29x29@3x.png",
31 | "scale" : "3x"
32 | },
33 | {
34 | "size" : "40x40",
35 | "idiom" : "iphone",
36 | "filename" : "Icon-App-40x40@2x.png",
37 | "scale" : "2x"
38 | },
39 | {
40 | "size" : "40x40",
41 | "idiom" : "iphone",
42 | "filename" : "Icon-App-40x40@3x.png",
43 | "scale" : "3x"
44 | },
45 | {
46 | "size" : "60x60",
47 | "idiom" : "iphone",
48 | "filename" : "Icon-App-60x60@2x.png",
49 | "scale" : "2x"
50 | },
51 | {
52 | "size" : "60x60",
53 | "idiom" : "iphone",
54 | "filename" : "Icon-App-60x60@3x.png",
55 | "scale" : "3x"
56 | },
57 | {
58 | "size" : "20x20",
59 | "idiom" : "ipad",
60 | "filename" : "Icon-App-20x20@1x.png",
61 | "scale" : "1x"
62 | },
63 | {
64 | "size" : "20x20",
65 | "idiom" : "ipad",
66 | "filename" : "Icon-App-20x20@2x.png",
67 | "scale" : "2x"
68 | },
69 | {
70 | "size" : "29x29",
71 | "idiom" : "ipad",
72 | "filename" : "Icon-App-29x29@1x.png",
73 | "scale" : "1x"
74 | },
75 | {
76 | "size" : "29x29",
77 | "idiom" : "ipad",
78 | "filename" : "Icon-App-29x29@2x.png",
79 | "scale" : "2x"
80 | },
81 | {
82 | "size" : "40x40",
83 | "idiom" : "ipad",
84 | "filename" : "Icon-App-40x40@1x.png",
85 | "scale" : "1x"
86 | },
87 | {
88 | "size" : "40x40",
89 | "idiom" : "ipad",
90 | "filename" : "Icon-App-40x40@2x.png",
91 | "scale" : "2x"
92 | },
93 | {
94 | "size" : "76x76",
95 | "idiom" : "ipad",
96 | "filename" : "Icon-App-76x76@1x.png",
97 | "scale" : "1x"
98 | },
99 | {
100 | "size" : "76x76",
101 | "idiom" : "ipad",
102 | "filename" : "Icon-App-76x76@2x.png",
103 | "scale" : "2x"
104 | },
105 | {
106 | "size" : "83.5x83.5",
107 | "idiom" : "ipad",
108 | "filename" : "Icon-App-83.5x83.5@2x.png",
109 | "scale" : "2x"
110 | },
111 | {
112 | "size" : "1024x1024",
113 | "idiom" : "ios-marketing",
114 | "filename" : "Icon-App-1024x1024@1x.png",
115 | "scale" : "1x"
116 | }
117 | ],
118 | "info" : {
119 | "version" : 1,
120 | "author" : "xcode"
121 | }
122 | }
123 |
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sk3llo/ffmpeg_kit_flutter/ddfe9280563e6e5ce5e12d6fbfaeb948d24e124c/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sk3llo/ffmpeg_kit_flutter/ddfe9280563e6e5ce5e12d6fbfaeb948d24e124c/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sk3llo/ffmpeg_kit_flutter/ddfe9280563e6e5ce5e12d6fbfaeb948d24e124c/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sk3llo/ffmpeg_kit_flutter/ddfe9280563e6e5ce5e12d6fbfaeb948d24e124c/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sk3llo/ffmpeg_kit_flutter/ddfe9280563e6e5ce5e12d6fbfaeb948d24e124c/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sk3llo/ffmpeg_kit_flutter/ddfe9280563e6e5ce5e12d6fbfaeb948d24e124c/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sk3llo/ffmpeg_kit_flutter/ddfe9280563e6e5ce5e12d6fbfaeb948d24e124c/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sk3llo/ffmpeg_kit_flutter/ddfe9280563e6e5ce5e12d6fbfaeb948d24e124c/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sk3llo/ffmpeg_kit_flutter/ddfe9280563e6e5ce5e12d6fbfaeb948d24e124c/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sk3llo/ffmpeg_kit_flutter/ddfe9280563e6e5ce5e12d6fbfaeb948d24e124c/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sk3llo/ffmpeg_kit_flutter/ddfe9280563e6e5ce5e12d6fbfaeb948d24e124c/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sk3llo/ffmpeg_kit_flutter/ddfe9280563e6e5ce5e12d6fbfaeb948d24e124c/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sk3llo/ffmpeg_kit_flutter/ddfe9280563e6e5ce5e12d6fbfaeb948d24e124c/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sk3llo/ffmpeg_kit_flutter/ddfe9280563e6e5ce5e12d6fbfaeb948d24e124c/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sk3llo/ffmpeg_kit_flutter/ddfe9280563e6e5ce5e12d6fbfaeb948d24e124c/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "LaunchImage.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "filename" : "LaunchImage@2x.png",
11 | "scale" : "2x"
12 | },
13 | {
14 | "idiom" : "universal",
15 | "filename" : "LaunchImage@3x.png",
16 | "scale" : "3x"
17 | }
18 | ],
19 | "info" : {
20 | "version" : 1,
21 | "author" : "xcode"
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sk3llo/ffmpeg_kit_flutter/ddfe9280563e6e5ce5e12d6fbfaeb948d24e124c/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sk3llo/ffmpeg_kit_flutter/ddfe9280563e6e5ce5e12d6fbfaeb948d24e124c/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sk3llo/ffmpeg_kit_flutter/ddfe9280563e6e5ce5e12d6fbfaeb948d24e124c/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md:
--------------------------------------------------------------------------------
1 | # Launch Screen Assets
2 |
3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory.
4 |
5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images.
--------------------------------------------------------------------------------
/example/ios/Runner/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/example/ios/Runner/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/example/ios/Runner/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleDisplayName
8 | Example
9 | CFBundleExecutable
10 | $(EXECUTABLE_NAME)
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | example
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | $(FLUTTER_BUILD_NAME)
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | $(FLUTTER_BUILD_NUMBER)
25 | LSRequiresIPhoneOS
26 |
27 | UILaunchStoryboardName
28 | LaunchScreen
29 | UIMainStoryboardFile
30 | Main
31 | UISupportedInterfaceOrientations
32 |
33 | UIInterfaceOrientationPortrait
34 | UIInterfaceOrientationLandscapeLeft
35 | UIInterfaceOrientationLandscapeRight
36 |
37 | UISupportedInterfaceOrientations~ipad
38 |
39 | UIInterfaceOrientationPortrait
40 | UIInterfaceOrientationPortraitUpsideDown
41 | UIInterfaceOrientationLandscapeLeft
42 | UIInterfaceOrientationLandscapeRight
43 |
44 | CADisableMinimumFrameDurationOnPhone
45 |
46 | UIApplicationSupportsIndirectInputEvents
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/example/ios/Runner/Runner-Bridging-Header.h:
--------------------------------------------------------------------------------
1 | #import "GeneratedPluginRegistrant.h"
2 |
--------------------------------------------------------------------------------
/example/ios/RunnerTests/RunnerTests.swift:
--------------------------------------------------------------------------------
1 | import Flutter
2 | import UIKit
3 | import XCTest
4 |
5 | class RunnerTests: XCTestCase {
6 |
7 | func testExample() {
8 | // If you add code to the Runner application, consider adding tests here.
9 | // See https://developer.apple.com/documentation/xctest for more information about using XCTest.
10 | }
11 |
12 | }
13 |
--------------------------------------------------------------------------------
/example/lib/main.dart:
--------------------------------------------------------------------------------
1 | import 'dart:io';
2 |
3 | import 'package:ffmpeg_kit_flutter_new/ffmpeg_kit.dart';
4 | import 'package:ffmpeg_kit_flutter_new/log.dart';
5 | import 'package:ffmpeg_kit_flutter_new/session.dart';
6 | import 'package:ffmpeg_kit_flutter_new/statistics.dart';
7 | import 'package:flutter/material.dart';
8 | import 'package:flutter/services.dart';
9 | import 'package:path_provider/path_provider.dart';
10 |
11 | void main() {
12 | WidgetsFlutterBinding.ensureInitialized();
13 | runApp(const MyApp());
14 | }
15 |
16 | class MyApp extends StatelessWidget {
17 | const MyApp({super.key});
18 |
19 | @override
20 | Widget build(BuildContext context) {
21 | return MaterialApp(
22 | title: 'Flutter Demo',
23 | theme: ThemeData(
24 | colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
25 | ),
26 | home: const MyHomePage(title: 'FFmpeg example'),
27 | );
28 | }
29 | }
30 |
31 | class MyHomePage extends StatefulWidget {
32 | const MyHomePage({super.key, required this.title});
33 |
34 | final String title;
35 |
36 | @override
37 | State createState() => _MyHomePageState();
38 | }
39 |
40 | class _MyHomePageState extends State {
41 | String logString = 'Logs will be here.';
42 |
43 | @override
44 | Widget build(BuildContext context) {
45 | return Scaffold(
46 | appBar: AppBar(
47 | backgroundColor: Theme.of(context).colorScheme.inversePrimary,
48 | title: Text(widget.title),
49 | ),
50 | body: Center(
51 | child: SingleChildScrollView(
52 | child: Padding(
53 | padding: const EdgeInsets.all(8.0),
54 | child: Text(logString, style: TextStyle(fontSize: 16)),
55 | ),
56 | ),
57 | ),
58 | floatingActionButton: FloatingActionButton(
59 | onPressed: executeFFmpegCommand,
60 | child: const Icon(Icons.rocket),
61 | ),
62 | );
63 | }
64 |
65 | void executeFFmpegCommand() async {
66 | logString = '';
67 | final tempDir = await getTemporaryDirectory();
68 | final sampleVideoRoot = await rootBundle.load('assets/sample_video.mp4');
69 | final sampleVideoFile = File('${tempDir.path}/sample_video.mp4');
70 | final outputFile = File('${tempDir.path}/output.mp4');
71 | await sampleVideoFile.writeAsBytes(sampleVideoRoot.buffer.asUint8List());
72 | if (outputFile.existsSync()) await outputFile.delete();
73 |
74 | /// Execute FFmpeg command
75 | await FFmpegKit.executeAsync(
76 | '-i '
77 | '${sampleVideoFile.path} -c:v mpeg4 -preset ultrafast '
78 | '${tempDir.path}/output.mp4',
79 | (Session session) async {
80 | debugPrint('session: ${await session.getOutput()}');
81 | },
82 | (Log log) {
83 | logString += log.getMessage();
84 | debugPrint('log: ${log.getMessage()}');
85 | },
86 | (Statistics statistics) {
87 | debugPrint('statistics: ${statistics.getSize()}');
88 | },
89 | );
90 | setState(() {});
91 | }
92 | }
93 |
--------------------------------------------------------------------------------
/example/macos/.gitignore:
--------------------------------------------------------------------------------
1 | # Flutter-related
2 | **/Flutter/ephemeral/
3 | **/Pods/
4 |
5 | # Xcode-related
6 | **/dgph
7 | **/xcuserdata/
8 |
--------------------------------------------------------------------------------
/example/macos/Flutter/Flutter-Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
2 | #include "ephemeral/Flutter-Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/example/macos/Flutter/Flutter-Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
2 | #include "ephemeral/Flutter-Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/example/macos/Flutter/GeneratedPluginRegistrant.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | import FlutterMacOS
6 | import Foundation
7 |
8 | import ffmpeg_kit_flutter_new
9 | import path_provider_foundation
10 |
11 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
12 | FFmpegKitFlutterPlugin.register(with: registry.registrar(forPlugin: "FFmpegKitFlutterPlugin"))
13 | PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
14 | }
15 |
--------------------------------------------------------------------------------
/example/macos/Podfile:
--------------------------------------------------------------------------------
1 | platform :osx, '10.15'
2 |
3 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency.
4 | ENV['COCOAPODS_DISABLE_STATS'] = 'true'
5 |
6 | project 'Runner', {
7 | 'Debug' => :debug,
8 | 'Profile' => :release,
9 | 'Release' => :release,
10 | }
11 |
12 | def flutter_root
13 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__)
14 | unless File.exist?(generated_xcode_build_settings_path)
15 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first"
16 | end
17 |
18 | File.foreach(generated_xcode_build_settings_path) do |line|
19 | matches = line.match(/FLUTTER_ROOT\=(.*)/)
20 | return matches[1].strip if matches
21 | end
22 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\""
23 | end
24 |
25 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
26 |
27 | flutter_macos_podfile_setup
28 |
29 | target 'Runner' do
30 | use_frameworks!
31 |
32 | flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__))
33 | target 'RunnerTests' do
34 | inherit! :search_paths
35 | end
36 | end
37 |
38 | post_install do |installer|
39 | installer.pods_project.targets.each do |target|
40 | flutter_additional_macos_build_settings(target)
41 | end
42 | end
43 |
--------------------------------------------------------------------------------
/example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
37 |
38 |
39 |
40 |
43 |
49 |
50 |
51 |
52 |
53 |
64 |
66 |
72 |
73 |
74 |
75 |
81 |
83 |
89 |
90 |
91 |
92 |
94 |
95 |
98 |
99 |
100 |
--------------------------------------------------------------------------------
/example/macos/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/example/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/macos/Runner/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | import Cocoa
2 | import FlutterMacOS
3 |
4 | @main
5 | class AppDelegate: FlutterAppDelegate {
6 | override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
7 | return true
8 | }
9 |
10 | override func applicationSupportsSecureRestorableState(_ app: NSApplication) -> Bool {
11 | return true
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "size" : "16x16",
5 | "idiom" : "mac",
6 | "filename" : "app_icon_16.png",
7 | "scale" : "1x"
8 | },
9 | {
10 | "size" : "16x16",
11 | "idiom" : "mac",
12 | "filename" : "app_icon_32.png",
13 | "scale" : "2x"
14 | },
15 | {
16 | "size" : "32x32",
17 | "idiom" : "mac",
18 | "filename" : "app_icon_32.png",
19 | "scale" : "1x"
20 | },
21 | {
22 | "size" : "32x32",
23 | "idiom" : "mac",
24 | "filename" : "app_icon_64.png",
25 | "scale" : "2x"
26 | },
27 | {
28 | "size" : "128x128",
29 | "idiom" : "mac",
30 | "filename" : "app_icon_128.png",
31 | "scale" : "1x"
32 | },
33 | {
34 | "size" : "128x128",
35 | "idiom" : "mac",
36 | "filename" : "app_icon_256.png",
37 | "scale" : "2x"
38 | },
39 | {
40 | "size" : "256x256",
41 | "idiom" : "mac",
42 | "filename" : "app_icon_256.png",
43 | "scale" : "1x"
44 | },
45 | {
46 | "size" : "256x256",
47 | "idiom" : "mac",
48 | "filename" : "app_icon_512.png",
49 | "scale" : "2x"
50 | },
51 | {
52 | "size" : "512x512",
53 | "idiom" : "mac",
54 | "filename" : "app_icon_512.png",
55 | "scale" : "1x"
56 | },
57 | {
58 | "size" : "512x512",
59 | "idiom" : "mac",
60 | "filename" : "app_icon_1024.png",
61 | "scale" : "2x"
62 | }
63 | ],
64 | "info" : {
65 | "version" : 1,
66 | "author" : "xcode"
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sk3llo/ffmpeg_kit_flutter/ddfe9280563e6e5ce5e12d6fbfaeb948d24e124c/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sk3llo/ffmpeg_kit_flutter/ddfe9280563e6e5ce5e12d6fbfaeb948d24e124c/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sk3llo/ffmpeg_kit_flutter/ddfe9280563e6e5ce5e12d6fbfaeb948d24e124c/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sk3llo/ffmpeg_kit_flutter/ddfe9280563e6e5ce5e12d6fbfaeb948d24e124c/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sk3llo/ffmpeg_kit_flutter/ddfe9280563e6e5ce5e12d6fbfaeb948d24e124c/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sk3llo/ffmpeg_kit_flutter/ddfe9280563e6e5ce5e12d6fbfaeb948d24e124c/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sk3llo/ffmpeg_kit_flutter/ddfe9280563e6e5ce5e12d6fbfaeb948d24e124c/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png
--------------------------------------------------------------------------------
/example/macos/Runner/Configs/AppInfo.xcconfig:
--------------------------------------------------------------------------------
1 | // Application-level settings for the Runner target.
2 | //
3 | // This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the
4 | // future. If not, the values below would default to using the project name when this becomes a
5 | // 'flutter create' template.
6 |
7 | // The application's name. By default this is also the title of the Flutter window.
8 | PRODUCT_NAME = example
9 |
10 | // The application's bundle identifier
11 | PRODUCT_BUNDLE_IDENTIFIER = com.example.example
12 |
13 | // The copyright displayed in application information
14 | PRODUCT_COPYRIGHT = Copyright © 2025 com.example. All rights reserved.
15 |
--------------------------------------------------------------------------------
/example/macos/Runner/Configs/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include "../../Flutter/Flutter-Debug.xcconfig"
2 | #include "Warnings.xcconfig"
3 |
--------------------------------------------------------------------------------
/example/macos/Runner/Configs/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include "../../Flutter/Flutter-Release.xcconfig"
2 | #include "Warnings.xcconfig"
3 |
--------------------------------------------------------------------------------
/example/macos/Runner/Configs/Warnings.xcconfig:
--------------------------------------------------------------------------------
1 | WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings
2 | GCC_WARN_UNDECLARED_SELECTOR = YES
3 | CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES
4 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE
5 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES
6 | CLANG_WARN_PRAGMA_PACK = YES
7 | CLANG_WARN_STRICT_PROTOTYPES = YES
8 | CLANG_WARN_COMMA = YES
9 | GCC_WARN_STRICT_SELECTOR_MATCH = YES
10 | CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES
11 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES
12 | GCC_WARN_SHADOW = YES
13 | CLANG_WARN_UNREACHABLE_CODE = YES
14 |
--------------------------------------------------------------------------------
/example/macos/Runner/DebugProfile.entitlements:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | com.apple.security.app-sandbox
6 |
7 | com.apple.security.cs.allow-jit
8 |
9 | com.apple.security.network.server
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/example/macos/Runner/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIconFile
10 |
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | $(PRODUCT_NAME)
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | $(FLUTTER_BUILD_NAME)
21 | CFBundleVersion
22 | $(FLUTTER_BUILD_NUMBER)
23 | LSMinimumSystemVersion
24 | $(MACOSX_DEPLOYMENT_TARGET)
25 | NSHumanReadableCopyright
26 | $(PRODUCT_COPYRIGHT)
27 | NSMainNibFile
28 | MainMenu
29 | NSPrincipalClass
30 | NSApplication
31 |
32 |
33 |
--------------------------------------------------------------------------------
/example/macos/Runner/MainFlutterWindow.swift:
--------------------------------------------------------------------------------
1 | import Cocoa
2 | import FlutterMacOS
3 |
4 | class MainFlutterWindow: NSWindow {
5 | override func awakeFromNib() {
6 | let flutterViewController = FlutterViewController()
7 | let windowFrame = self.frame
8 | self.contentViewController = flutterViewController
9 | self.setFrame(windowFrame, display: true)
10 |
11 | RegisterGeneratedPlugins(registry: flutterViewController)
12 |
13 | super.awakeFromNib()
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/example/macos/Runner/Release.entitlements:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | com.apple.security.app-sandbox
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/macos/RunnerTests/RunnerTests.swift:
--------------------------------------------------------------------------------
1 | import Cocoa
2 | import FlutterMacOS
3 | import XCTest
4 |
5 | class RunnerTests: XCTestCase {
6 |
7 | func testExample() {
8 | // If you add code to the Runner application, consider adding tests here.
9 | // See https://developer.apple.com/documentation/xctest for more information about using XCTest.
10 | }
11 |
12 | }
13 |
--------------------------------------------------------------------------------
/example/pubspec.lock:
--------------------------------------------------------------------------------
1 | # Generated by pub
2 | # See https://dart.dev/tools/pub/glossary#lockfile
3 | packages:
4 | async:
5 | dependency: transitive
6 | description:
7 | name: async
8 | sha256: d2872f9c19731c2e5f10444b14686eb7cc85c76274bd6c16e1816bff9a3bab63
9 | url: "https://pub.dev"
10 | source: hosted
11 | version: "2.12.0"
12 | boolean_selector:
13 | dependency: transitive
14 | description:
15 | name: boolean_selector
16 | sha256: "8aab1771e1243a5063b8b0ff68042d67334e3feab9e95b9490f9a6ebf73b42ea"
17 | url: "https://pub.dev"
18 | source: hosted
19 | version: "2.1.2"
20 | characters:
21 | dependency: transitive
22 | description:
23 | name: characters
24 | sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803
25 | url: "https://pub.dev"
26 | source: hosted
27 | version: "1.4.0"
28 | clock:
29 | dependency: transitive
30 | description:
31 | name: clock
32 | sha256: fddb70d9b5277016c77a80201021d40a2247104d9f4aa7bab7157b7e3f05b84b
33 | url: "https://pub.dev"
34 | source: hosted
35 | version: "1.1.2"
36 | collection:
37 | dependency: transitive
38 | description:
39 | name: collection
40 | sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76"
41 | url: "https://pub.dev"
42 | source: hosted
43 | version: "1.19.1"
44 | fake_async:
45 | dependency: transitive
46 | description:
47 | name: fake_async
48 | sha256: "6a95e56b2449df2273fd8c45a662d6947ce1ebb7aafe80e550a3f68297f3cacc"
49 | url: "https://pub.dev"
50 | source: hosted
51 | version: "1.3.2"
52 | ffi:
53 | dependency: transitive
54 | description:
55 | name: ffi
56 | sha256: "289279317b4b16eb2bb7e271abccd4bf84ec9bdcbe999e278a94b804f5630418"
57 | url: "https://pub.dev"
58 | source: hosted
59 | version: "2.1.4"
60 | ffmpeg_kit_flutter_android:
61 | dependency: transitive
62 | description:
63 | name: ffmpeg_kit_flutter_android
64 | sha256: "58698b77ed5be675393994760dc7466b90b1e484ef4ed8f84bfc4aaa3d50b572"
65 | url: "https://pub.dev"
66 | source: hosted
67 | version: "1.1.3"
68 | ffmpeg_kit_flutter_new:
69 | dependency: "direct main"
70 | description:
71 | path: ".."
72 | relative: true
73 | source: path
74 | version: "1.3.0"
75 | ffmpeg_kit_flutter_platform_interface:
76 | dependency: transitive
77 | description:
78 | name: ffmpeg_kit_flutter_platform_interface
79 | sha256: addf046ae44e190ad0101b2fde2ad909a3cd08a2a109f6106d2f7048b7abedee
80 | url: "https://pub.dev"
81 | source: hosted
82 | version: "0.2.1"
83 | flutter:
84 | dependency: "direct main"
85 | description: flutter
86 | source: sdk
87 | version: "0.0.0"
88 | flutter_lints:
89 | dependency: "direct dev"
90 | description:
91 | name: flutter_lints
92 | sha256: "5398f14efa795ffb7a33e9b6a08798b26a180edac4ad7db3f231e40f82ce11e1"
93 | url: "https://pub.dev"
94 | source: hosted
95 | version: "5.0.0"
96 | flutter_test:
97 | dependency: "direct dev"
98 | description: flutter
99 | source: sdk
100 | version: "0.0.0"
101 | leak_tracker:
102 | dependency: transitive
103 | description:
104 | name: leak_tracker
105 | sha256: c35baad643ba394b40aac41080300150a4f08fd0fd6a10378f8f7c6bc161acec
106 | url: "https://pub.dev"
107 | source: hosted
108 | version: "10.0.8"
109 | leak_tracker_flutter_testing:
110 | dependency: transitive
111 | description:
112 | name: leak_tracker_flutter_testing
113 | sha256: f8b613e7e6a13ec79cfdc0e97638fddb3ab848452eff057653abd3edba760573
114 | url: "https://pub.dev"
115 | source: hosted
116 | version: "3.0.9"
117 | leak_tracker_testing:
118 | dependency: transitive
119 | description:
120 | name: leak_tracker_testing
121 | sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3"
122 | url: "https://pub.dev"
123 | source: hosted
124 | version: "3.0.1"
125 | lints:
126 | dependency: transitive
127 | description:
128 | name: lints
129 | sha256: c35bb79562d980e9a453fc715854e1ed39e24e7d0297a880ef54e17f9874a9d7
130 | url: "https://pub.dev"
131 | source: hosted
132 | version: "5.1.1"
133 | matcher:
134 | dependency: transitive
135 | description:
136 | name: matcher
137 | sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2
138 | url: "https://pub.dev"
139 | source: hosted
140 | version: "0.12.17"
141 | material_color_utilities:
142 | dependency: transitive
143 | description:
144 | name: material_color_utilities
145 | sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec
146 | url: "https://pub.dev"
147 | source: hosted
148 | version: "0.11.1"
149 | meta:
150 | dependency: transitive
151 | description:
152 | name: meta
153 | sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c
154 | url: "https://pub.dev"
155 | source: hosted
156 | version: "1.16.0"
157 | path:
158 | dependency: transitive
159 | description:
160 | name: path
161 | sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5"
162 | url: "https://pub.dev"
163 | source: hosted
164 | version: "1.9.1"
165 | path_provider:
166 | dependency: "direct main"
167 | description:
168 | name: path_provider
169 | sha256: "50c5dd5b6e1aaf6fb3a78b33f6aa3afca52bf903a8a5298f53101fdaee55bbcd"
170 | url: "https://pub.dev"
171 | source: hosted
172 | version: "2.1.5"
173 | path_provider_android:
174 | dependency: transitive
175 | description:
176 | name: path_provider_android
177 | sha256: d0d310befe2c8ab9e7f393288ccbb11b60c019c6b5afc21973eeee4dda2b35e9
178 | url: "https://pub.dev"
179 | source: hosted
180 | version: "2.2.17"
181 | path_provider_foundation:
182 | dependency: transitive
183 | description:
184 | name: path_provider_foundation
185 | sha256: "4843174df4d288f5e29185bd6e72a6fbdf5a4a4602717eed565497429f179942"
186 | url: "https://pub.dev"
187 | source: hosted
188 | version: "2.4.1"
189 | path_provider_linux:
190 | dependency: transitive
191 | description:
192 | name: path_provider_linux
193 | sha256: f7a1fe3a634fe7734c8d3f2766ad746ae2a2884abe22e241a8b301bf5cac3279
194 | url: "https://pub.dev"
195 | source: hosted
196 | version: "2.2.1"
197 | path_provider_platform_interface:
198 | dependency: transitive
199 | description:
200 | name: path_provider_platform_interface
201 | sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334"
202 | url: "https://pub.dev"
203 | source: hosted
204 | version: "2.1.2"
205 | path_provider_windows:
206 | dependency: transitive
207 | description:
208 | name: path_provider_windows
209 | sha256: bd6f00dbd873bfb70d0761682da2b3a2c2fccc2b9e84c495821639601d81afe7
210 | url: "https://pub.dev"
211 | source: hosted
212 | version: "2.3.0"
213 | platform:
214 | dependency: transitive
215 | description:
216 | name: platform
217 | sha256: "5d6b1b0036a5f331ebc77c850ebc8506cbc1e9416c27e59b439f917a902a4984"
218 | url: "https://pub.dev"
219 | source: hosted
220 | version: "3.1.6"
221 | plugin_platform_interface:
222 | dependency: transitive
223 | description:
224 | name: plugin_platform_interface
225 | sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02"
226 | url: "https://pub.dev"
227 | source: hosted
228 | version: "2.1.8"
229 | sky_engine:
230 | dependency: transitive
231 | description: flutter
232 | source: sdk
233 | version: "0.0.0"
234 | source_span:
235 | dependency: transitive
236 | description:
237 | name: source_span
238 | sha256: "254ee5351d6cb365c859e20ee823c3bb479bf4a293c22d17a9f1bf144ce86f7c"
239 | url: "https://pub.dev"
240 | source: hosted
241 | version: "1.10.1"
242 | stack_trace:
243 | dependency: transitive
244 | description:
245 | name: stack_trace
246 | sha256: "8b27215b45d22309b5cddda1aa2b19bdfec9df0e765f2de506401c071d38d1b1"
247 | url: "https://pub.dev"
248 | source: hosted
249 | version: "1.12.1"
250 | stream_channel:
251 | dependency: transitive
252 | description:
253 | name: stream_channel
254 | sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d"
255 | url: "https://pub.dev"
256 | source: hosted
257 | version: "2.1.4"
258 | string_scanner:
259 | dependency: transitive
260 | description:
261 | name: string_scanner
262 | sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43"
263 | url: "https://pub.dev"
264 | source: hosted
265 | version: "1.4.1"
266 | term_glyph:
267 | dependency: transitive
268 | description:
269 | name: term_glyph
270 | sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e"
271 | url: "https://pub.dev"
272 | source: hosted
273 | version: "1.2.2"
274 | test_api:
275 | dependency: transitive
276 | description:
277 | name: test_api
278 | sha256: fb31f383e2ee25fbbfe06b40fe21e1e458d14080e3c67e7ba0acfde4df4e0bbd
279 | url: "https://pub.dev"
280 | source: hosted
281 | version: "0.7.4"
282 | vector_math:
283 | dependency: transitive
284 | description:
285 | name: vector_math
286 | sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803"
287 | url: "https://pub.dev"
288 | source: hosted
289 | version: "2.1.4"
290 | vm_service:
291 | dependency: transitive
292 | description:
293 | name: vm_service
294 | sha256: "0968250880a6c5fe7edc067ed0a13d4bae1577fe2771dcf3010d52c4a9d3ca14"
295 | url: "https://pub.dev"
296 | source: hosted
297 | version: "14.3.1"
298 | xdg_directories:
299 | dependency: transitive
300 | description:
301 | name: xdg_directories
302 | sha256: "7a3f37b05d989967cdddcbb571f1ea834867ae2faa29725fd085180e0883aa15"
303 | url: "https://pub.dev"
304 | source: hosted
305 | version: "1.1.0"
306 | sdks:
307 | dart: ">=3.7.2 <4.0.0"
308 | flutter: ">=3.27.0"
309 |
--------------------------------------------------------------------------------
/example/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: example
2 | description: "FFMPEG example"
3 | publish_to: 'none'
4 |
5 | version: 1.0.0+1
6 |
7 | environment:
8 | sdk: ^3.7.2
9 |
10 | dependencies:
11 | flutter:
12 | sdk: flutter
13 |
14 | path_provider: ^2.1.5
15 | ffmpeg_kit_flutter_new:
16 | path: ../
17 |
18 | dev_dependencies:
19 | flutter_test:
20 | sdk: flutter
21 |
22 | flutter_lints: ^5.0.0
23 |
24 | flutter:
25 | uses-material-design: true
26 |
27 | assets:
28 | - assets/
--------------------------------------------------------------------------------
/example/test/widget_test.dart:
--------------------------------------------------------------------------------
1 | // This is a basic Flutter widget test.
2 | //
3 | // To perform an interaction with a widget in your test, use the WidgetTester
4 | // utility in the flutter_test package. For example, you can send tap and scroll
5 | // gestures. You can also use WidgetTester to find child widgets in the widget
6 | // tree, read text, and verify that the values of widget properties are correct.
7 |
8 | import 'package:flutter/material.dart';
9 | import 'package:flutter_test/flutter_test.dart';
10 |
11 | import 'package:example/main.dart';
12 |
13 | void main() {
14 | testWidgets('Counter increments smoke test', (WidgetTester tester) async {
15 | // Build our app and trigger a frame.
16 | await tester.pumpWidget(const MyApp());
17 |
18 | // Verify that our counter starts at 0.
19 | expect(find.text('0'), findsOneWidget);
20 | expect(find.text('1'), findsNothing);
21 |
22 | // Tap the '+' icon and trigger a frame.
23 | await tester.tap(find.byIcon(Icons.add));
24 | await tester.pump();
25 |
26 | // Verify that our counter has incremented.
27 | expect(find.text('0'), findsNothing);
28 | expect(find.text('1'), findsOneWidget);
29 | });
30 | }
31 |
--------------------------------------------------------------------------------
/ios/Classes/FFmpegKitFlutterPlugin.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018-2021 Taner Sener
3 | *
4 | * This file is part of FFmpegKit.
5 | *
6 | * FFmpegKit is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Lesser General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * FFmpegKit is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * along with FFmpegKit. If not, see .
18 | */
19 |
20 | #import
21 |
22 | @interface FFmpegKitFlutterPlugin : NSObject
23 | @end
24 |
--------------------------------------------------------------------------------
/ios/ffmpeg_kit_flutter_new.podspec:
--------------------------------------------------------------------------------
1 | Pod::Spec.new do |s|
2 | s.name = 'ffmpeg_kit_flutter_new'
3 | s.version = '1.0.0'
4 | s.summary = 'FFmpeg Kit for Flutter'
5 | s.description = 'A Flutter plugin for running FFmpeg and FFprobe commands.'
6 | s.homepage = 'https://github.com/sk3llo/ffmpeg_kit_flutter'
7 | s.license = { :file => '../LICENSE' }
8 | s.author = { 'AK' => 'kapraton@gmail.com' }
9 |
10 | s.platform = :ios
11 | s.requires_arc = true
12 | s.static_framework = true
13 |
14 | s.source = { :path => '.' }
15 | s.source_files = 'Classes/**/*'
16 | s.public_header_files = 'Classes/**/*.h'
17 |
18 | s.default_subspec = 'full-gpl-lts'
19 |
20 | s.dependency 'Flutter'
21 | s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' }
22 |
23 | s.subspec 'min' do |ss|
24 | ss.source_files = 'Classes/**/*'
25 | ss.public_header_files = 'Classes/**/*.h'
26 | ss.dependency 'ffmpeg-kit-ios-min', "5.1"
27 | ss.ios.deployment_target = '14.0'
28 | end
29 |
30 | s.subspec 'min-lts' do |ss|
31 | ss.source_files = 'Classes/**/*'
32 | ss.public_header_files = 'Classes/**/*.h'
33 | ss.dependency 'ffmpeg-kit-ios-min', "5.1.LTS"
34 | ss.ios.deployment_target = '14.0'
35 | end
36 |
37 | s.subspec 'min-gpl' do |ss|
38 | ss.source_files = 'Classes/**/*'
39 | ss.public_header_files = 'Classes/**/*.h'
40 | ss.dependency 'ffmpeg-kit-ios-min-gpl', "5.1"
41 | ss.ios.deployment_target = '14.0'
42 | end
43 |
44 | s.subspec 'min-gpl-lts' do |ss|
45 | ss.source_files = 'Classes/**/*'
46 | ss.public_header_files = 'Classes/**/*.h'
47 | ss.dependency 'ffmpeg-kit-ios-min-gpl', "5.1.LTS"
48 | ss.ios.deployment_target = '14.0'
49 | end
50 |
51 | s.subspec 'https' do |ss|
52 | ss.source_files = 'Classes/**/*'
53 | ss.public_header_files = 'Classes/**/*.h'
54 | ss.dependency 'ffmpeg-kit-ios-https', "5.1"
55 | ss.ios.deployment_target = '14.0'
56 | end
57 |
58 | s.subspec 'https-lts' do |ss|
59 | ss.source_files = 'Classes/**/*'
60 | ss.public_header_files = 'Classes/**/*.h'
61 | ss.dependency 'ffmpeg-kit-ios-https', "5.1.LTS"
62 | ss.ios.deployment_target = '14.0'
63 | end
64 |
65 | s.subspec 'https-gpl' do |ss|
66 | ss.source_files = 'Classes/**/*'
67 | ss.public_header_files = 'Classes/**/*.h'
68 | ss.dependency 'ffmpeg-kit-ios-https-gpl', "5.1"
69 | ss.ios.deployment_target = '14.0'
70 | end
71 |
72 | s.subspec 'https-gpl-lts' do |ss|
73 | ss.source_files = 'Classes/**/*'
74 | ss.public_header_files = 'Classes/**/*.h'
75 | ss.dependency 'ffmpeg-kit-ios-https-gpl', "5.1.LTS"
76 | ss.ios.deployment_target = '14.0'
77 | end
78 |
79 | s.subspec 'audio' do |ss|
80 | ss.source_files = 'Classes/**/*'
81 | ss.public_header_files = 'Classes/**/*.h'
82 | ss.dependency 'ffmpeg-kit-ios-audio', "5.1"
83 | ss.ios.deployment_target = '14.0'
84 | end
85 |
86 | s.subspec 'audio-lts' do |ss|
87 | ss.source_files = 'Classes/**/*'
88 | ss.public_header_files = 'Classes/**/*.h'
89 | ss.dependency 'ffmpeg-kit-ios-audio', "5.1.LTS"
90 | ss.ios.deployment_target = '14.0'
91 | end
92 |
93 | s.subspec 'video' do |ss|
94 | ss.source_files = 'Classes/**/*'
95 | ss.public_header_files = 'Classes/**/*.h'
96 | ss.dependency 'ffmpeg-kit-ios-video', "5.1"
97 | ss.ios.deployment_target = '14.0'
98 | end
99 |
100 | s.subspec 'video-lts' do |ss|
101 | ss.source_files = 'Classes/**/*'
102 | ss.public_header_files = 'Classes/**/*.h'
103 | ss.dependency 'ffmpeg-kit-ios-video', "5.1.LTS"
104 | ss.ios.deployment_target = '14.0'
105 | end
106 |
107 | s.subspec 'full' do |ss|
108 | ss.source_files = 'Classes/**/*'
109 | ss.public_header_files = 'Classes/**/*.h'
110 | ss.dependency 'ffmpeg-kit-ios-full', "5.1"
111 | ss.ios.deployment_target = '14.0'
112 | end
113 |
114 | s.subspec 'full-lts' do |ss|
115 | ss.source_files = 'Classes/**/*'
116 | ss.public_header_files = 'Classes/**/*.h'
117 | ss.dependency 'ffmpeg-kit-ios-full', "5.1.LTS"
118 | ss.ios.deployment_target = '14.0'
119 | end
120 |
121 | s.subspec 'full-gpl' do |ss|
122 | ss.source_files = 'Classes/**/*'
123 | ss.public_header_files = 'Classes/**/*.h'
124 | ss.dependency 'ffmpeg-kit-ios-full-gpl', "5.1"
125 | ss.ios.deployment_target = '14.0'
126 | end
127 |
128 | s.subspec 'full-gpl-lts' do |ss|
129 | ss.source_files = 'Classes/**/*'
130 | ss.public_header_files = 'Classes/**/*.h'
131 | ss.ios.vendored_frameworks = 'Frameworks/ffmpegkit.framework',
132 | 'Frameworks/libavcodec.framework',
133 | 'Frameworks/libavdevice.framework',
134 | 'Frameworks/libavfilter.framework',
135 | 'Frameworks/libavformat.framework',
136 | 'Frameworks/libavutil.framework',
137 | 'Frameworks/libswresample.framework',
138 | 'Frameworks/libswscale.framework'
139 |
140 | ss.ios.frameworks = 'AudioToolbox', 'CoreMedia'
141 | ss.libraries = 'z', 'bz2', 'c++', 'iconv'
142 | ss.ios.deployment_target = '14.0'
143 |
144 | # Adding pre-install hook
145 | s.prepare_command = <<-CMD
146 | if [ ! -d "./Frameworks" ]; then
147 | chmod +x ../scripts/setup_ios.sh
148 | ../scripts/setup_ios.sh
149 | fi
150 | CMD
151 | end
152 |
153 | end
154 |
--------------------------------------------------------------------------------
/lib/arch_detect.dart:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2021 Taner Sener
3 | *
4 | * This file is part of FFmpegKit.
5 | *
6 | * FFmpegKit is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Lesser General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * FFmpegKit is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * along with FFmpegKit. If not, see .
18 | */
19 |
20 | import 'package:ffmpeg_kit_flutter_platform_interface/ffmpeg_kit_flutter_platform_interface.dart';
21 | import 'package:flutter/services.dart';
22 |
23 | import 'ffmpeg_kit_config.dart';
24 |
25 | /// Detects the running architecture.
26 | class ArchDetect {
27 | static FFmpegKitPlatform _platform = FFmpegKitPlatform.instance;
28 |
29 | /// Returns architecture name loaded.
30 | static Future getArch() async {
31 | try {
32 | await FFmpegKitConfig.init();
33 | return _platform.archDetectGetArch();
34 | } on PlatformException catch (e, stack) {
35 | print("Plugin getArch error: ${e.message}");
36 | return Future.error("getArch failed.", stack);
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/lib/chapter.dart:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021-2022 Taner Sener
3 | *
4 | * This file is part of FFmpegKit.
5 | *
6 | * FFmpegKit is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Lesser General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * FFmpegKit is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * along with FFmpegKit. If not, see .
18 | */
19 |
20 | /// Chapter class.
21 | class Chapter {
22 | static const keyId = "id";
23 | static const keyTimeBase = "time_base";
24 | static const keyStart = "start";
25 | static const keyStartTime = "start_time";
26 | static const keyEnd = "end";
27 | static const keyEndTime = "end_time";
28 | static const keyTags = "tags";
29 |
30 | Map? _allProperties;
31 |
32 | /// Creates a new [Chapter] instance
33 | Chapter(this._allProperties);
34 |
35 | /// Returns id.
36 | int? getId() => this.getNumberProperty(Chapter.keyId)?.toInt();
37 |
38 | /// Returns time base.
39 | String? getTimeBase() => this.getStringProperty(Chapter.keyTimeBase);
40 |
41 | /// Returns start.
42 | int? getStart() => this.getNumberProperty(Chapter.keyStart)?.toInt();
43 |
44 | /// Returns start time.
45 | String? getStartTime() => this.getStringProperty(Chapter.keyStartTime);
46 |
47 | /// Returns end.
48 | int? getEnd() => this.getNumberProperty(Chapter.keyEnd)?.toInt();
49 |
50 | /// Returns end time.
51 | String? getEndTime() => this.getStringProperty(Chapter.keyEndTime);
52 |
53 | /// Returns all tags.
54 | Map? getTags() => this.getProperty(Chapter.keyTags);
55 |
56 | /// Returns the chapter property associated with the key.
57 | String? getStringProperty(String key) => this._allProperties?[key];
58 |
59 | /// Returns the chapter property associated with the key.
60 | num? getNumberProperty(String key) => this._allProperties?[key];
61 |
62 | /// Returns the chapter property associated with the key.
63 | dynamic getProperty(String key) => this._allProperties?[key];
64 |
65 | /// Returns all properties found.
66 | Map? getAllProperties() => this._allProperties;
67 | }
68 |
--------------------------------------------------------------------------------
/lib/ffmpeg_kit.dart:
--------------------------------------------------------------------------------
1 | import 'package:ffmpeg_kit_flutter_platform_interface/ffmpeg_kit_flutter_platform_interface.dart';
2 | import 'package:flutter/services.dart';
3 |
4 | import 'ffmpeg_kit_config.dart';
5 | import 'ffmpeg_session.dart';
6 | import 'ffmpeg_session_complete_callback.dart';
7 | import 'log_callback.dart';
8 | import 'src/ffmpeg_kit_factory.dart';
9 | import 'statistics_callback.dart';
10 |
11 | /// Main class to run "FFmpeg" commands.
12 | class FFmpegKit {
13 | static FFmpegKitPlatform _platform = FFmpegKitPlatform.instance;
14 |
15 | /// Synchronously executes FFmpeg command provided. Space character is used
16 | /// to split command into arguments. You can use single or double quote
17 | /// characters to specify arguments inside your command.
18 | static Future execute(String command) async =>
19 | FFmpegKit.executeWithArguments(FFmpegKitConfig.parseArguments(command));
20 |
21 | /// Synchronously executes FFmpeg with arguments provided.
22 | static Future executeWithArguments(
23 | List commandArguments) async {
24 | final session =
25 | await FFmpegSession.create(commandArguments, null, null, null, null);
26 |
27 | await FFmpegKitConfig.ffmpegExecute(session);
28 |
29 | return session;
30 | }
31 |
32 | /// Starts an asynchronous FFmpeg execution for the given command.
33 | /// Space character is used to split the command
34 | /// into arguments. You can use single or double quote characters
35 | /// to specify arguments inside your command.
36 | ///
37 | /// Note that this method returns immediately and does not wait
38 | /// the execution to complete. You must use an
39 | /// [FFmpegSessionCompleteCallback] if you want to be notified
40 | /// about the result.
41 | static Future executeAsync(String command,
42 | [FFmpegSessionCompleteCallback? completeCallback = null,
43 | LogCallback? logCallback = null,
44 | StatisticsCallback? statisticsCallback = null]) async =>
45 | FFmpegKit.executeWithArgumentsAsync(
46 | FFmpegKitConfig.parseArguments(command),
47 | completeCallback,
48 | logCallback,
49 | statisticsCallback);
50 |
51 | /// Starts an asynchronous FFmpeg execution with arguments provided.
52 | ///
53 | /// Note that this method returns immediately and does not
54 | /// wait the execution to complete. You must use an
55 | /// [FFmpegSessionCompleteCallback] if you want to be notified
56 | /// about the result.
57 | static Future executeWithArgumentsAsync(
58 | List commandArguments,
59 | [FFmpegSessionCompleteCallback? completeCallback = null,
60 | LogCallback? logCallback = null,
61 | StatisticsCallback? statisticsCallback = null]) async {
62 | final session = await FFmpegSession.create(commandArguments,
63 | completeCallback, logCallback, statisticsCallback, null);
64 |
65 | await FFmpegKitConfig.asyncFFmpegExecute(session);
66 |
67 | return session;
68 | }
69 |
70 | /// Cancels the session specified with [sessionId].
71 | static Future cancel([int? sessionId = null]) async {
72 | try {
73 | await FFmpegKitConfig.init();
74 | if (sessionId == null) {
75 | return _platform.ffmpegKitCancel();
76 | } else {
77 | return _platform.ffmpegKitCancelSession(sessionId);
78 | }
79 | } on PlatformException catch (e, stack) {
80 | print("Plugin cancel error: ${e.message}");
81 | return Future.error("cancel failed.", stack);
82 | }
83 | }
84 |
85 | /// Lists all FFmpeg sessions in the session history.
86 | static Future> listSessions() async {
87 | try {
88 | await FFmpegKitConfig.init();
89 | return _platform.ffmpegKitListSessions().then((sessions) {
90 | if (sessions == null) {
91 | return List.empty();
92 | } else {
93 | return sessions
94 | .map((dynamic sessionObject) => FFmpegKitFactory.mapToSession(
95 | sessionObject as Map))
96 | .map((session) => session as FFmpegSession)
97 | .toList();
98 | }
99 | });
100 | } on PlatformException catch (e, stack) {
101 | print("Plugin listSessions error: ${e.message}");
102 | return Future.error("listSessions failed.", stack);
103 | }
104 | }
105 | }
106 |
--------------------------------------------------------------------------------
/lib/ffmpeg_session.dart:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2022 Taner Sener
3 | *
4 | * This file is part of FFmpegKit.
5 | *
6 | * FFmpegKit is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Lesser General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * FFmpegKit is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * along with FFmpegKit. If not, see .
18 | */
19 |
20 | import 'package:ffmpeg_kit_flutter_platform_interface/ffmpeg_kit_flutter_platform_interface.dart';
21 | import 'package:flutter/services.dart';
22 |
23 | import 'abstract_session.dart';
24 | import 'ffmpeg_kit_config.dart';
25 | import 'ffmpeg_session_complete_callback.dart';
26 | import 'log_callback.dart';
27 | import 'log_redirection_strategy.dart';
28 | import 'src/ffmpeg_kit_factory.dart';
29 | import 'statistics.dart';
30 | import 'statistics_callback.dart';
31 |
32 | /// An FFmpeg session.
33 | class FFmpegSession extends AbstractSession {
34 | /// Creates a new FFmpeg session with [argumentsArray].
35 | static Future create(List argumentsArray,
36 | [FFmpegSessionCompleteCallback? completeCallback = null,
37 | LogCallback? logCallback = null,
38 | StatisticsCallback? statisticsCallback = null,
39 | LogRedirectionStrategy? logRedirectionStrategy = null]) async {
40 | final session = await AbstractSession.createFFmpegSession(
41 | argumentsArray, logRedirectionStrategy);
42 | final sessionId = session.getSessionId();
43 |
44 | FFmpegKitFactory.setFFmpegSessionCompleteCallback(
45 | sessionId, completeCallback);
46 | FFmpegKitFactory.setLogCallback(sessionId, logCallback);
47 | FFmpegKitFactory.setStatisticsCallback(sessionId, statisticsCallback);
48 |
49 | return session;
50 | }
51 |
52 | /// Returns the session specific statistics callback.
53 | StatisticsCallback? getStatisticsCallback() =>
54 | FFmpegKitFactory.getStatisticsCallback(this.getSessionId());
55 |
56 | /// Returns the session specific complete callback.
57 | FFmpegSessionCompleteCallback? getCompleteCallback() =>
58 | FFmpegKitFactory.getFFmpegSessionCompleteCallback(this.getSessionId());
59 |
60 | /// Returns all statistics entries generated for this session. If there are
61 | /// asynchronous statistics that are not delivered yet, this method waits for
62 | /// them until [waitTimeout].
63 | Future> getAllStatistics([int? waitTimeout]) async {
64 | try {
65 | await FFmpegKitConfig.init();
66 | return FFmpegKitPlatform.instance
67 | .ffmpegSessionGetAllStatistics(this.getSessionId(), waitTimeout)
68 | .then((allStatistics) {
69 | if (allStatistics == null) {
70 | return List.empty();
71 | } else {
72 | return allStatistics
73 | .map((dynamic statisticsObject) =>
74 | FFmpegKitFactory.mapToStatistics(
75 | statisticsObject as Map))
76 | .toList();
77 | }
78 | });
79 | } on PlatformException catch (e, stack) {
80 | print("Plugin getAllStatistics error: ${e.message}");
81 | return Future.error("getAllStatistics failed.", stack);
82 | }
83 | }
84 |
85 | /// Returns all statistics entries delivered for this session. Note that if
86 | /// there are asynchronous statistics that are not delivered yet, this method
87 | /// will not wait for them and will return immediately.
88 | Future> getStatistics() async {
89 | try {
90 | await FFmpegKitConfig.init();
91 | return FFmpegKitPlatform.instance
92 | .ffmpegSessionGetStatistics(this.getSessionId())
93 | .then((statistics) {
94 | if (statistics == null) {
95 | return List.empty();
96 | } else {
97 | return statistics
98 | .map((dynamic statisticsObject) =>
99 | FFmpegKitFactory.mapToStatistics(
100 | statisticsObject as Map))
101 | .toList();
102 | }
103 | });
104 | } on PlatformException catch (e, stack) {
105 | print("Plugin getStatistics error: ${e.message}");
106 | return Future.error("getStatistics failed.", stack);
107 | }
108 | }
109 |
110 | /// Returns the last received statistics entry.
111 | Future getLastReceivedStatistics() async =>
112 | this.getStatistics().then((statistics) {
113 | if (statistics.isNotEmpty) {
114 | return statistics[statistics.length - 1];
115 | } else {
116 | return null;
117 | }
118 | });
119 |
120 | bool isFFmpeg() => true;
121 |
122 | bool isFFprobe() => false;
123 |
124 | bool isMediaInformation() => false;
125 | }
126 |
--------------------------------------------------------------------------------
/lib/ffmpeg_session_complete_callback.dart:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 Taner Sener
3 | *
4 | * This file is part of FFmpegKit.
5 | *
6 | * FFmpegKit is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Lesser General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * FFmpegKit is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * along with FFmpegKit. If not, see .
18 | */
19 |
20 | import 'ffmpeg_session.dart';
21 |
22 | /// Callback function that is invoked when an asynchronous FFmpeg session has
23 | /// ended. Session has either SessionState.completed or SessionState.failed
24 | /// state when the callback is invoked.
25 | /// If it has SessionState.completed state, "ReturnCode" should be checked to
26 | /// see the execution result.
27 | /// If "getState" returns SessionState.failed then "getFailStackTrace" should
28 | /// be used to get the failure reason.
29 | typedef FFmpegSessionCompleteCallback = void Function(FFmpegSession session);
30 |
--------------------------------------------------------------------------------
/lib/ffprobe_kit.dart:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2022 Taner Sener
3 | *
4 | * This file is part of FFmpegKit.
5 | *
6 | * FFmpegKit is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Lesser General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * FFmpegKit is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * along with FFmpegKit. If not, see .
18 | */
19 |
20 | import 'package:ffmpeg_kit_flutter_platform_interface/ffmpeg_kit_flutter_platform_interface.dart';
21 | import 'package:flutter/services.dart';
22 |
23 | import 'ffmpeg_kit_config.dart';
24 | import 'ffprobe_session.dart';
25 | import 'ffprobe_session_complete_callback.dart';
26 | import 'log_callback.dart';
27 | import 'media_information_session.dart';
28 | import 'media_information_session_complete_callback.dart';
29 | import 'src/ffmpeg_kit_factory.dart';
30 |
31 | /// Main class to run "FFprobe" commands.
32 | class FFprobeKit {
33 | static FFmpegKitPlatform _platform = FFmpegKitPlatform.instance;
34 |
35 | /// Synchronously executes FFprobe command provided. Space character is used
36 | /// to split command into arguments. You can use single or double quote
37 | /// characters to specify arguments inside your command.
38 | static Future execute(String command) async =>
39 | FFprobeKit.executeWithArguments(FFmpegKitConfig.parseArguments(command));
40 |
41 | /// Synchronously executes FFprobe with arguments provided.
42 | static Future executeWithArguments(
43 | List commandArguments) async {
44 | final session =
45 | await FFprobeSession.create(commandArguments, null, null, null);
46 |
47 | await FFmpegKitConfig.ffprobeExecute(session);
48 |
49 | return session;
50 | }
51 |
52 | /// Starts an asynchronous FFprobe execution for the given command.
53 | /// Space character is used to split the command
54 | /// into arguments. You can use single or double quote characters
55 | /// to specify arguments inside your command.
56 | ///
57 | /// Note that this method returns immediately and does not wait the
58 | /// execution to complete. You must use an
59 | /// [FFprobeSessionCompleteCallback] if you want to be notified
60 | /// about the result.
61 | static Future executeAsync(String command,
62 | [FFprobeSessionCompleteCallback? completeCallback = null,
63 | LogCallback? logCallback = null]) async =>
64 | FFprobeKit.executeWithArgumentsAsync(
65 | FFmpegKitConfig.parseArguments(command),
66 | completeCallback,
67 | logCallback);
68 |
69 | /// Starts an asynchronous FFprobe execution with arguments provided.
70 | ///
71 | /// Note that this method returns immediately and does not wait the
72 | /// execution to complete. You must use an
73 | /// [FFprobeSessionCompleteCallback] if you want to be notified
74 | /// about the result.
75 | static Future executeWithArgumentsAsync(
76 | List commandArguments,
77 | [FFprobeSessionCompleteCallback? completeCallback = null,
78 | LogCallback? logCallback = null]) async {
79 | final session = await FFprobeSession.create(
80 | commandArguments, completeCallback, logCallback, null);
81 |
82 | await FFmpegKitConfig.asyncFFprobeExecute(session);
83 |
84 | return session;
85 | }
86 |
87 | /// Extracts media information for the file specified with path.
88 | static Future getMediaInformation(String path,
89 | [int? waitTimeout = null]) async {
90 | final commandArguments = [
91 | "-v",
92 | "error",
93 | "-hide_banner",
94 | "-print_format",
95 | "json",
96 | "-show_format",
97 | "-show_streams",
98 | "-show_chapters",
99 | "-i",
100 | path
101 | ];
102 | return FFprobeKit.getMediaInformationFromCommandArguments(
103 | commandArguments, waitTimeout);
104 | }
105 |
106 | /// Extracts media information using the command provided. The command
107 | /// passed to this method must generate the output in JSON format in order
108 | /// to successfully extract media information from it.
109 | static Future getMediaInformationFromCommand(
110 | String command,
111 | [int? waitTimeout = null]) async =>
112 | FFprobeKit.getMediaInformationFromCommandArguments(
113 | FFmpegKitConfig.parseArguments(command), waitTimeout);
114 |
115 | /// Extracts media information using the command arguments provided. The
116 | /// command passed to this method must generate the output in JSON format in
117 | /// order to successfully extract media information from it.
118 | static Future
119 | getMediaInformationFromCommandArguments(List commandArguments,
120 | [int? waitTimeout = null]) async {
121 | final session =
122 | await MediaInformationSession.create(commandArguments, null, null);
123 |
124 | await FFmpegKitConfig.getMediaInformationExecute(session, waitTimeout);
125 |
126 | final mediaInformation = await _platform
127 | .mediaInformationSessionGetMediaInformation(session.getSessionId())
128 | .then(FFmpegKitFactory.mapToNullableMediaInformation);
129 | if (mediaInformation != null) {
130 | session.setMediaInformation(mediaInformation);
131 | }
132 |
133 | return session;
134 | }
135 |
136 | /// Starts an asynchronous FFprobe execution to extract the media information
137 | /// for the specified file.
138 | ///
139 | /// Note that this method returns immediately and does not wait the execution
140 | /// to complete. You must use an
141 | /// [MediaInformationSessionCompleteCallback] if you want to be notified about
142 | /// the result.
143 | static Future getMediaInformationAsync(String path,
144 | [MediaInformationSessionCompleteCallback? completeCallback = null,
145 | LogCallback? logCallback = null,
146 | int? waitTimeout = null]) async {
147 | final commandArguments = [
148 | "-v",
149 | "error",
150 | "-hide_banner",
151 | "-print_format",
152 | "json",
153 | "-show_format",
154 | "-show_streams",
155 | "-show_chapters",
156 | "-i",
157 | path
158 | ];
159 | return FFprobeKit.getMediaInformationFromCommandArgumentsAsync(
160 | commandArguments, completeCallback, logCallback, waitTimeout);
161 | }
162 |
163 | /// Starts an asynchronous FFprobe execution to extract media information
164 | /// using a command. The command passed to
165 | /// this method must generate the output in JSON format in order
166 | /// to successfully extract media information from it.
167 | ///
168 | /// Note that this method returns immediately and does not wait the
169 | /// execution to complete. You must use an
170 | /// [MediaInformationSessionCompleteCallback] if you want to be notified
171 | /// about the result.
172 | static Future getMediaInformationFromCommandAsync(
173 | String command,
174 | [MediaInformationSessionCompleteCallback? completeCallback = null,
175 | LogCallback? logCallback = null,
176 | int? waitTimeout = null]) async =>
177 | FFprobeKit.getMediaInformationFromCommandArgumentsAsync(
178 | FFmpegKitConfig.parseArguments(command),
179 | completeCallback,
180 | logCallback,
181 | waitTimeout);
182 |
183 | /// Starts an asynchronous FFprobe execution to extract media information
184 | /// using command arguments. The command passed to this method must generate
185 | /// the output in JSON format in order to successfully extract media
186 | /// information from it.
187 | ///
188 | /// Note that this method returns immediately and does not wait the execution
189 | /// to complete. You must use an [MediaInformationSessionCompleteCallback]
190 | /// if you want to be
191 | /// notified about the result.
192 | static Future
193 | getMediaInformationFromCommandArgumentsAsync(
194 | List commandArguments,
195 | [MediaInformationSessionCompleteCallback? completeCallback = null,
196 | LogCallback? logCallback = null,
197 | int? waitTimeout = null]) async {
198 | final session = await MediaInformationSession.create(
199 | commandArguments, completeCallback, logCallback);
200 |
201 | await FFmpegKitConfig.asyncGetMediaInformationExecute(session, waitTimeout);
202 |
203 | final mediaInformation = await _platform
204 | .mediaInformationSessionGetMediaInformation(session.getSessionId())
205 | .then(FFmpegKitFactory.mapToNullableMediaInformation);
206 | if (mediaInformation != null) {
207 | session.setMediaInformation(mediaInformation);
208 | }
209 |
210 | return session;
211 | }
212 |
213 | /// Lists all FFprobe sessions in the session history.
214 | static Future> listFFprobeSessions() async {
215 | try {
216 | await FFmpegKitConfig.init();
217 | return _platform.ffprobeKitListFFprobeSessions().then((sessions) {
218 | if (sessions == null) {
219 | return List.empty();
220 | } else {
221 | return sessions
222 | .map((dynamic sessionObject) => FFmpegKitFactory.mapToSession(
223 | sessionObject as Map))
224 | .map((session) => session as FFprobeSession)
225 | .toList();
226 | }
227 | });
228 | } on PlatformException catch (e, stack) {
229 | print("Plugin listFFprobeSessions error: ${e.message}");
230 | return Future.error("listFFprobeSessions failed.", stack);
231 | }
232 | }
233 |
234 | /// Lists all MediaInformation sessions in the session history.
235 | static Future>
236 | listMediaInformationSessions() async {
237 | try {
238 | await FFmpegKitConfig.init();
239 | return _platform
240 | .ffprobeKitListMediaInformationSessions()
241 | .then((sessions) {
242 | if (sessions == null) {
243 | return List.empty();
244 | } else {
245 | return sessions
246 | .map((dynamic sessionObject) => FFmpegKitFactory.mapToSession(
247 | sessionObject as Map))
248 | .map((session) => session as MediaInformationSession)
249 | .toList();
250 | }
251 | });
252 | } on PlatformException catch (e, stack) {
253 | print("Plugin listMediaInformationSessions error: ${e.message}");
254 | return Future.error("listMediaInformationSessions failed.", stack);
255 | }
256 | }
257 | }
258 |
--------------------------------------------------------------------------------
/lib/ffprobe_session.dart:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2022 Taner Sener
3 | *
4 | * This file is part of FFmpegKit.
5 | *
6 | * FFmpegKit is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Lesser General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * FFmpegKit is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * along with FFmpegKit. If not, see .
18 | */
19 |
20 | import 'abstract_session.dart';
21 | import 'ffprobe_session_complete_callback.dart';
22 | import 'log_callback.dart';
23 | import 'log_redirection_strategy.dart';
24 | import 'src/ffmpeg_kit_factory.dart';
25 |
26 | /// An FFprobe session.
27 | class FFprobeSession extends AbstractSession {
28 | /// Creates a new FFprobe session with [argumentsArray].
29 | static Future create(List argumentsArray,
30 | [FFprobeSessionCompleteCallback? completeCallback = null,
31 | LogCallback? logCallback = null,
32 | LogRedirectionStrategy? logRedirectionStrategy = null]) async {
33 | final session = await AbstractSession.createFFprobeSession(
34 | argumentsArray, logRedirectionStrategy);
35 | final sessionId = session.getSessionId();
36 |
37 | FFmpegKitFactory.setFFprobeSessionCompleteCallback(
38 | sessionId, completeCallback);
39 | FFmpegKitFactory.setLogCallback(sessionId, logCallback);
40 |
41 | return session;
42 | }
43 |
44 | /// Returns the session specific complete callback.
45 | FFprobeSessionCompleteCallback? getCompleteCallback() =>
46 | FFmpegKitFactory.getFFprobeSessionCompleteCallback(this.getSessionId());
47 |
48 | bool isFFmpeg() => false;
49 |
50 | bool isFFprobe() => true;
51 |
52 | bool isMediaInformation() => false;
53 | }
54 |
--------------------------------------------------------------------------------
/lib/ffprobe_session_complete_callback.dart:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 Taner Sener
3 | *
4 | * This file is part of FFmpegKit.
5 | *
6 | * FFmpegKit is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Lesser General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * FFmpegKit is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * along with FFmpegKit. If not, see .
18 | */
19 |
20 | import 'ffprobe_session.dart';
21 |
22 | /// Callback function that is invoked when an asynchronous FFprobe session has
23 | /// ended. Session has either SessionState.completed or SessionState.failed
24 | /// state when the callback is invoked.
25 | /// If it has SessionState.completed state, "ReturnCode" should be checked to
26 | /// see the execution result.
27 | /// If "getState" returns SessionState.failed then "getFailStackTrace" should
28 | /// be used to get the failure reason.
29 | typedef FFprobeSessionCompleteCallback = void Function(FFprobeSession session);
30 |
--------------------------------------------------------------------------------
/lib/level.dart:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2021 Taner Sener
3 | *
4 | * This file is part of FFmpegKit.
5 | *
6 | * FFmpegKit is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Lesser General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * FFmpegKit is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * along with FFmpegKit. If not, see .
18 | */
19 |
20 | /// Defines log levels.
21 | class Level {
22 | /// This log level is defined by FFmpegKit. It is used to specify logs
23 | /// printed to stderr by FFmpeg. Logs that has this level are not filtered
24 | /// and always redirected.
25 | static const int avLogStderr = -16;
26 |
27 | /// Print no output.
28 | static const int avLogQuiet = -8;
29 |
30 | /// Something went really wrong and we will crash now.
31 | static const int avLogPanic = 0;
32 |
33 | /// Something went wrong and recovery is not possible.
34 | /// For example, no header was found for a format which depends
35 | /// on headers or an illegal combination of parameters is used.
36 | static const int avLogFatal = 8;
37 |
38 | /// Something went wrong and cannot losslessly be recovered.
39 | /// However, not all future data is affected.
40 | static const int avLogError = 16;
41 |
42 | /// Something somehow does not look correct. This may or may not
43 | /// lead to problems. An example would be the use of '-vstrict -2'.
44 | static const int avLogWarning = 24;
45 |
46 | /// int Standard information.
47 | static const int avLogInfo = 32;
48 |
49 | /// Detailed information.
50 | static const int avLogVerbose = 40;
51 |
52 | /// Stuff which is only useful for libav* developers.
53 | static const int avLogDebug = 48;
54 |
55 | /// Extremely verbose debugging, useful for libav* development.
56 | static const int avLogTrace = 56;
57 |
58 | /// Returns log level string from int
59 | static String levelToString(int level) {
60 | switch (level) {
61 | case Level.avLogTrace:
62 | return "TRACE";
63 | case Level.avLogDebug:
64 | return "DEBUG";
65 | case Level.avLogVerbose:
66 | return "VERBOSE";
67 | case Level.avLogInfo:
68 | return "INFO";
69 | case Level.avLogWarning:
70 | return "WARNING";
71 | case Level.avLogError:
72 | return "ERROR";
73 | case Level.avLogFatal:
74 | return "FATAL";
75 | case Level.avLogPanic:
76 | return "PANIC";
77 | case Level.avLogStderr:
78 | return "STDERR";
79 | case Level.avLogQuiet:
80 | default:
81 | return "";
82 | }
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/lib/log.dart:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2021 Taner Sener
3 | *
4 | * This file is part of FFmpegKit.
5 | *
6 | * FFmpegKit is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Lesser General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * FFmpegKit is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * along with FFmpegKit. If not, see .
18 | */
19 |
20 | /// Log entry for an FFmpegKit session.
21 | class Log {
22 | int _sessionId;
23 | int _level;
24 | String _message;
25 |
26 | Log(this._sessionId, this._level, this._message);
27 |
28 | int getSessionId() => _sessionId;
29 |
30 | int getLevel() => _level;
31 |
32 | String getMessage() => _message;
33 | }
34 |
--------------------------------------------------------------------------------
/lib/log_callback.dart:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2021 Taner Sener
3 | *
4 | * This file is part of FFmpegKit.
5 | *
6 | * FFmpegKit is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Lesser General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * FFmpegKit is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * along with FFmpegKit. If not, see .
18 | */
19 |
20 | import 'log.dart';
21 |
22 | /// Callback function that receives logs generated for "FFmpegKit" sessions.
23 | typedef LogCallback = void Function(Log log);
24 |
--------------------------------------------------------------------------------
/lib/log_redirection_strategy.dart:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2021 Taner Sener
3 | *
4 | * This file is part of FFmpegKit.
5 | *
6 | * FFmpegKit is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Lesser General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * FFmpegKit is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * along with FFmpegKit. If not, see .
18 | */
19 |
20 | enum LogRedirectionStrategy {
21 | alwaysPrintLogs,
22 | printLogsWhenNoCallbacksDefined,
23 | printLogsWhenGlobalCallbackNotDefined,
24 | printLogsWhenSessionCallbackNotDefined,
25 | neverPrintLogs
26 | }
27 |
--------------------------------------------------------------------------------
/lib/media_information.dart:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2022 Taner Sener
3 | *
4 | * This file is part of FFmpegKit.
5 | *
6 | * FFmpegKit is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Lesser General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * FFmpegKit is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * along with FFmpegKit. If not, see .
18 | */
19 |
20 | import 'chapter.dart';
21 | import 'stream_information.dart';
22 |
23 | /// Media information class.
24 | class MediaInformation {
25 | static const keyFormatProperties = "format";
26 | static const keyFilename = "filename";
27 | static const keyFormat = "format_name";
28 | static const keyFormatLong = "format_long_name";
29 | static const keyStartTime = "start_time";
30 | static const keyDuration = "duration";
31 | static const keySize = "size";
32 | static const keyBitRate = "bit_rate";
33 | static const keyTags = "tags";
34 |
35 | Map? _allProperties;
36 |
37 | /// Creates a new [MediaInformation] instance
38 | MediaInformation(this._allProperties);
39 |
40 | /// Returns file name.
41 | String? getFilename() =>
42 | this.getStringFormatProperty(MediaInformation.keyFilename);
43 |
44 | /// Returns format.
45 | String? getFormat() =>
46 | this.getStringFormatProperty(MediaInformation.keyFormat);
47 |
48 | /// Returns long format.
49 | String? getLongFormat() =>
50 | this.getStringFormatProperty(MediaInformation.keyFormatLong);
51 |
52 | /// Returns duration.
53 | String? getDuration() =>
54 | this.getStringFormatProperty(MediaInformation.keyDuration);
55 |
56 | /// Returns start time.
57 | String? getStartTime() =>
58 | this.getStringFormatProperty(MediaInformation.keyStartTime);
59 |
60 | /// Returns size.
61 | String? getSize() => this.getStringFormatProperty(MediaInformation.keySize);
62 |
63 | /// Returns bitrate.
64 | String? getBitrate() =>
65 | this.getStringFormatProperty(MediaInformation.keyBitRate);
66 |
67 | /// Returns all tags.
68 | Map? getTags() =>
69 | this.getFormatProperty(StreamInformation.keyTags);
70 |
71 | /// Returns the property associated with the key.
72 | String? getStringProperty(String key) => this.getAllProperties()?[key];
73 |
74 | /// Returns the property associated with the key.
75 | num? getNumberProperty(String key) => this.getAllProperties()?[key];
76 |
77 | /// Returns the property associated with the key.
78 | dynamic getProperty(String key) => this.getAllProperties()?[key];
79 |
80 | /// Returns the format property associated with the key.
81 | String? getStringFormatProperty(String key) =>
82 | this.getFormatProperties()?[key];
83 |
84 | /// Returns the format property associated with the key.
85 | num? getNumberFormatProperty(String key) => this.getFormatProperties()?[key];
86 |
87 | /// Returns the format property associated with the key.
88 | dynamic getFormatProperty(String key) => this.getFormatProperties()?[key];
89 |
90 | /// Returns all streams found as a list.
91 | List getStreams() {
92 | final List list =
93 | List.empty(growable: true);
94 |
95 | dynamic createStreamInformation(Map streamProperties) =>
96 | list.add(new StreamInformation(streamProperties));
97 |
98 | this._allProperties?["streams"]?.forEach((Object? stream) {
99 | createStreamInformation(stream as Map);
100 | });
101 |
102 | return list;
103 | }
104 |
105 | /// Returns all chapters found as a list.
106 | List getChapters() {
107 | final List list = List.empty(growable: true);
108 |
109 | dynamic createChapter(Map chapterProperties) =>
110 | list.add(new Chapter(chapterProperties));
111 |
112 | this._allProperties?["chapters"]?.forEach((Object? chapter) {
113 | createChapter(chapter as Map);
114 | });
115 |
116 | return list;
117 | }
118 |
119 | /// Returns all format properties found.
120 | Map? getFormatProperties() =>
121 | this._allProperties?[keyFormatProperties];
122 |
123 | /// Returns all properties found, including stream properties.
124 | Map? getAllProperties() => this._allProperties;
125 | }
126 |
--------------------------------------------------------------------------------
/lib/media_information_json_parser.dart:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2021 Taner Sener
3 | *
4 | * This file is part of FFmpegKit.
5 | *
6 | * FFmpegKit is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Lesser General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * FFmpegKit is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * along with FFmpegKit. If not, see .
18 | */
19 |
20 | import 'package:ffmpeg_kit_flutter_platform_interface/ffmpeg_kit_flutter_platform_interface.dart';
21 | import 'package:flutter/services.dart';
22 |
23 | import 'ffmpeg_kit_config.dart';
24 | import 'media_information.dart';
25 |
26 | /// A parser that constructs "MediaInformation" from FFprobe's json output.
27 | class MediaInformationJsonParser {
28 | static FFmpegKitPlatform _platform = FFmpegKitPlatform.instance;
29 |
30 | /// Extracts MediaInformation from the given FFprobe json output. Note that
31 | /// this method does not fail as [fromWithError] does and returns null on
32 | /// error.
33 | static Future from(String ffprobeJsonOutput) async {
34 | try {
35 | await FFmpegKitConfig.init();
36 | return _platform
37 | .mediaInformationJsonParserFrom(ffprobeJsonOutput)
38 | .then((properties) {
39 | if (properties == null || properties.isEmpty) {
40 | return null;
41 | } else {
42 | return new MediaInformation(properties);
43 | }
44 | });
45 | } on PlatformException catch (e, stack) {
46 | print("Plugin from error: ${e.message}");
47 | return Future.error("from failed.", stack);
48 | }
49 | }
50 |
51 | /// Extracts MediaInformation from the given FFprobe json output.
52 | static Future fromWithError(
53 | String ffprobeJsonOutput) async {
54 | try {
55 | await FFmpegKitConfig.init();
56 | return _platform
57 | .mediaInformationJsonParserFromWithError(ffprobeJsonOutput)
58 | .then(MediaInformation.new);
59 | } on PlatformException catch (e, stack) {
60 | print("Plugin fromWithError error: ${e.message}");
61 | return Future.error("fromWithError failed.", stack);
62 | }
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/lib/media_information_session.dart:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2022 Taner Sener
3 | *
4 | * This file is part of FFmpegKit.
5 | *
6 | * FFmpegKit is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Lesser General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * FFmpegKit is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * along with FFmpegKit. If not, see .
18 | */
19 |
20 | import 'abstract_session.dart';
21 | import 'log_callback.dart';
22 | import 'media_information.dart';
23 | import 'media_information_session_complete_callback.dart';
24 | import 'src/ffmpeg_kit_factory.dart';
25 |
26 | /// A custom FFprobe session, which produces a "MediaInformation" object
27 | /// using the FFprobe output.
28 | class MediaInformationSession extends AbstractSession {
29 | MediaInformation? _mediaInformation;
30 |
31 | /// Creates a new MediaInformation session with [argumentsArray].
32 | static Future create(List argumentsArray,
33 | [MediaInformationSessionCompleteCallback? completeCallback = null,
34 | LogCallback? logCallback = null]) async {
35 | final session =
36 | await AbstractSession.createMediaInformationSession(argumentsArray);
37 | final sessionId = session.getSessionId();
38 |
39 | FFmpegKitFactory.setMediaInformationSessionCompleteCallback(
40 | sessionId, completeCallback);
41 | FFmpegKitFactory.setLogCallback(sessionId, logCallback);
42 |
43 | return session;
44 | }
45 |
46 | /// Returns the media information extracted in this session.
47 | MediaInformation? getMediaInformation() => this._mediaInformation;
48 |
49 | /// Sets the media information extracted in this session.
50 | void setMediaInformation(MediaInformation? mediaInformation) {
51 | this._mediaInformation = mediaInformation;
52 | }
53 |
54 | /// Returns the session specific complete callback.
55 | MediaInformationSessionCompleteCallback? getCompleteCallback() =>
56 | FFmpegKitFactory.getMediaInformationSessionCompleteCallback(
57 | this.getSessionId());
58 |
59 | bool isFFmpeg() => false;
60 |
61 | bool isFFprobe() => false;
62 |
63 | bool isMediaInformation() => true;
64 | }
65 |
--------------------------------------------------------------------------------
/lib/media_information_session_complete_callback.dart:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 Taner Sener
3 | *
4 | * This file is part of FFmpegKit.
5 | *
6 | * FFmpegKit is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Lesser General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * FFmpegKit is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * along with FFmpegKit. If not, see .
18 | */
19 |
20 | import 'media_information_session.dart';
21 |
22 | /// Callback function that is invoked when an asynchronous MediaInformation
23 | /// session has ended. Session has either SessionState.completed or
24 | /// SessionState.failed state when the callback is invoked.
25 | /// If it has SessionState.completed state, "ReturnCode" should be checked to
26 | /// see the execution result.
27 | /// If "getState" returns SessionState.failed then "getFailStackTrace" should
28 | /// be used to get the failure reason.
29 | typedef MediaInformationSessionCompleteCallback = void Function(
30 | MediaInformationSession session);
31 |
--------------------------------------------------------------------------------
/lib/packages.dart:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 Taner Sener
3 | *
4 | * This file is part of FFmpegKit.
5 | *
6 | * FFmpegKit is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Lesser General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * FFmpegKit is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * along with FFmpegKit. If not, see .
18 | */
19 |
20 | import 'package:ffmpeg_kit_flutter_platform_interface/ffmpeg_kit_flutter_platform_interface.dart';
21 | import 'package:flutter/services.dart';
22 |
23 | import 'ffmpeg_kit_config.dart';
24 |
25 | /// Helper class to extract binary package information.
26 | class Packages {
27 | static FFmpegKitPlatform _platform = FFmpegKitPlatform.instance;
28 |
29 | /// Returns the FFmpegKit Flutter binary package name.
30 | static Future getPackageName() async {
31 | try {
32 | await FFmpegKitConfig.init();
33 | return _platform.getPackageName();
34 | } on PlatformException catch (e, stack) {
35 | print("Plugin getPackageName error: ${e.message}");
36 | return Future.error("getPackageName failed.", stack);
37 | }
38 | }
39 |
40 | /// Returns enabled external libraries by FFmpeg.
41 | static Future> getExternalLibraries() async {
42 | try {
43 | await FFmpegKitConfig.init();
44 | return _platform.getExternalLibraries().then((externalLibraries) {
45 | if (externalLibraries == null) {
46 | return List.empty();
47 | } else {
48 | return externalLibraries.cast();
49 | }
50 | });
51 | } on PlatformException catch (e, stack) {
52 | print("Plugin getExternalLibraries error: ${e.message}");
53 | return Future.error("getExternalLibraries failed.", stack);
54 | }
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/lib/return_code.dart:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2021 Taner Sener
3 | *
4 | * This file is part of FFmpegKit.
5 | *
6 | * FFmpegKit is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Lesser General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * FFmpegKit is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * along with FFmpegKit. If not, see .
18 | */
19 |
20 | class ReturnCode {
21 | static const int success = 0;
22 | static const int cancel = 255;
23 |
24 | int _value;
25 |
26 | ReturnCode(this._value);
27 |
28 | static bool isSuccess(ReturnCode? returnCode) =>
29 | returnCode?.getValue() == ReturnCode.success;
30 |
31 | static bool isCancel(ReturnCode? returnCode) =>
32 | returnCode?.getValue() == ReturnCode.cancel;
33 |
34 | int getValue() => this._value;
35 |
36 | bool isValueSuccess() => this._value == ReturnCode.success;
37 |
38 | bool isValueError() =>
39 | (this._value != ReturnCode.success) && (this._value != ReturnCode.cancel);
40 |
41 | bool isValueCancel() => this._value == ReturnCode.cancel;
42 |
43 | String toString() => this._value.toString();
44 | }
45 |
--------------------------------------------------------------------------------
/lib/session.dart:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2021 Taner Sener
3 | *
4 | * This file is part of FFmpegKit.
5 | *
6 | * FFmpegKit is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Lesser General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * FFmpegKit is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * along with FFmpegKit. If not, see .
18 | */
19 |
20 | import 'log.dart';
21 | import 'log_callback.dart';
22 | import 'log_redirection_strategy.dart';
23 | import 'return_code.dart';
24 | import 'session_state.dart';
25 |
26 | /// Common interface for all "FFmpegKit" sessions.
27 | abstract class Session {
28 | /// Returns the session specific log callback.
29 | LogCallback? getLogCallback();
30 |
31 | /// Returns the session identifier.
32 | int? getSessionId();
33 |
34 | /// Returns session create time.
35 | DateTime? getCreateTime();
36 |
37 | /// Returns session start time.
38 | DateTime? getStartTime();
39 |
40 | /// Returns session end time.
41 | Future getEndTime();
42 |
43 | /// Returns time taken to execute this session in milliseconds or zero (0)
44 | /// if the session is not over yet.
45 | Future getDuration();
46 |
47 | /// Returns command arguments as an array.
48 | List? getArguments();
49 |
50 | /// Returns command arguments as a concatenated string.
51 | String? getCommand();
52 |
53 | /// Returns all log entries generated for this session. If there are
54 | /// asynchronous logs that are not delivered yet, this method waits for
55 | /// them until [waitTimeout].
56 | Future> getAllLogs([int? waitTimeout = null]);
57 |
58 | /// Returns all log entries delivered for this session. Note that if there
59 | /// are asynchronous logs that are not delivered yet, this method
60 | /// will not wait for them and will return immediately.
61 | Future> getLogs();
62 |
63 | /// Returns all log entries generated for this session as a concatenated
64 | /// string. If there are asynchronous logs that are not delivered yet,
65 | /// this method waits for them until [waitTimeout].
66 | Future getAllLogsAsString([int? waitTimeout = null]);
67 |
68 | /// Returns all log entries delivered for this session as a concatenated
69 | /// string. Note that if there are asynchronous logs that are not
70 | /// delivered yet, this method will not wait for them and will return
71 | /// immediately.
72 | Future getLogsAsString();
73 |
74 | /// Returns the log output generated while running the session.
75 | Future getOutput();
76 |
77 | /// Returns the state of the session.
78 | Future getState();
79 |
80 | /// Returns the return code for this session. Note that return code is only
81 | /// set for sessions that end with COMPLETED state. If a session is not
82 | /// started, still running or failed then this method returns null.
83 | Future getReturnCode();
84 |
85 | /// Returns the stack trace of the exception received while executing this
86 | /// session.
87 | ///
88 | /// The stack trace is only set for sessions that end with FAILED state. For
89 | /// sessions that has COMPLETED state this method returns null.
90 | Future getFailStackTrace();
91 |
92 | /// Returns session specific log redirection strategy.
93 | LogRedirectionStrategy? getLogRedirectionStrategy();
94 |
95 | /// Returns whether there are still asynchronous messages being transmitted
96 | /// for this session or not.
97 | Future thereAreAsynchronousMessagesInTransmit();
98 |
99 | /// Returns whether it is an "FFmpeg" session or not.
100 | bool isFFmpeg();
101 |
102 | /// Returns whether it is an "FFprobe" session or not.
103 | bool isFFprobe();
104 |
105 | /// Returns whether it is an "MediaInformation" session or not.
106 | bool isMediaInformation();
107 |
108 | /// Cancels running the session.
109 | Future cancel();
110 | }
111 |
--------------------------------------------------------------------------------
/lib/session_state.dart:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2021 Taner Sener
3 | *
4 | * This file is part of FFmpegKit.
5 | *
6 | * FFmpegKit is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Lesser General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * FFmpegKit is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * along with FFmpegKit. If not, see .
18 | */
19 |
20 | enum SessionState { created, running, failed, completed }
21 |
--------------------------------------------------------------------------------
/lib/signal.dart:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2021 Taner Sener
3 | *
4 | * This file is part of FFmpegKit.
5 | *
6 | * FFmpegKit is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Lesser General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * FFmpegKit is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * along with FFmpegKit. If not, see .
18 | */
19 |
20 | /// Signals handled by FFmpegKit library.
21 | enum Signal { sigInt, sigQuit, sigPipe, sigTerm, sigXCpu }
22 |
--------------------------------------------------------------------------------
/lib/src/ffmpeg_kit_factory.dart:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2022 Taner Sener
3 | *
4 | * This file is part of FFmpegKit.
5 | *
6 | * FFmpegKit is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Lesser General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * FFmpegKit is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * along with FFmpegKit. If not, see .
18 | */
19 |
20 | import '../abstract_session.dart';
21 | import '../ffmpeg_session_complete_callback.dart';
22 | import '../ffprobe_session_complete_callback.dart';
23 | import '../log.dart';
24 | import '../log_callback.dart';
25 | import '../log_redirection_strategy.dart';
26 | import '../media_information.dart';
27 | import '../media_information_session_complete_callback.dart';
28 | import '../session.dart';
29 | import '../statistics.dart';
30 | import '../statistics_callback.dart';
31 |
32 | final ffmpegSessionCompleteCallbackMap =
33 | new Map();
34 | final ffprobeSessionCompleteCallbackMap =
35 | new Map();
36 | final mediaInformationSessionCompleteCallbackMap =
37 | new Map();
38 | final logCallbackMap = new Map();
39 | final statisticsCallbackMap = new Map();
40 | final logRedirectionStrategyMap = new Map();
41 |
42 | class FFmpegKitFactory {
43 | static LogCallback? _logCallback;
44 | static StatisticsCallback? _statisticsCallback;
45 | static FFmpegSessionCompleteCallback? _ffmpegSessionCompleteCallback;
46 | static FFprobeSessionCompleteCallback? _ffprobeSessionCompleteCallback;
47 | static MediaInformationSessionCompleteCallback?
48 | _mediaInformationSessionCompleteCallback;
49 |
50 | static Statistics mapToStatistics(Map statisticsMap) =>
51 | new Statistics(
52 | statisticsMap["sessionId"].toInt(),
53 | statisticsMap["videoFrameNumber"].toInt(),
54 | statisticsMap["videoFps"],
55 | statisticsMap["videoQuality"],
56 | statisticsMap["size"].toInt(),
57 | statisticsMap["time"].toInt(),
58 | statisticsMap["bitrate"],
59 | statisticsMap["speed"]);
60 |
61 | static Log mapToLog(Map logMap) =>
62 | new Log(logMap["sessionId"], logMap["level"], logMap["message"]);
63 |
64 | static Session mapToSession(Map sessionMap) {
65 | switch (sessionMap["type"]) {
66 | case 2:
67 | return AbstractSession.createFFprobeSessionFromMap(sessionMap);
68 | case 3:
69 | return AbstractSession.createMediaInformationSessionFromMap(sessionMap);
70 | case 1:
71 | default:
72 | return AbstractSession.createFFmpegSessionFromMap(sessionMap);
73 | }
74 | }
75 |
76 | static Session? mapToNullableSession(Map? sessionMap) {
77 | if (sessionMap != null) {
78 | switch (sessionMap["type"]) {
79 | case 2:
80 | return AbstractSession.createFFprobeSessionFromMap(sessionMap);
81 | case 3:
82 | return AbstractSession.createMediaInformationSessionFromMap(
83 | sessionMap);
84 | case 1:
85 | default:
86 | return AbstractSession.createFFmpegSessionFromMap(sessionMap);
87 | }
88 | } else {
89 | return null;
90 | }
91 | }
92 |
93 | static MediaInformation? mapToNullableMediaInformation(
94 | Map? mediaInformationMap) {
95 | if (mediaInformationMap != null) {
96 | return new MediaInformation(mediaInformationMap);
97 | } else {
98 | return null;
99 | }
100 | }
101 |
102 | static String getVersion() => "6.0.2";
103 |
104 | static LogRedirectionStrategy? getLogRedirectionStrategy(int? sessionId) =>
105 | logRedirectionStrategyMap[sessionId];
106 |
107 | static void setLogRedirectionStrategy(
108 | int? sessionId, LogRedirectionStrategy? logRedirectionStrategy) {
109 | if (sessionId != null && logRedirectionStrategy != null) {
110 | logRedirectionStrategyMap[sessionId] = logRedirectionStrategy;
111 | }
112 | }
113 |
114 | static LogCallback? getLogCallback(int? sessionId) =>
115 | logCallbackMap[sessionId];
116 |
117 | static void setLogCallback(int? sessionId, LogCallback? logCallback) {
118 | if (sessionId != null && logCallback != null) {
119 | logCallbackMap[sessionId] = logCallback;
120 | }
121 | }
122 |
123 | static LogCallback? getGlobalLogCallback() => _logCallback;
124 |
125 | static void setGlobalLogCallback(LogCallback? logCallback) {
126 | _logCallback = logCallback;
127 | }
128 |
129 | static StatisticsCallback? getStatisticsCallback(int? sessionId) =>
130 | statisticsCallbackMap[sessionId];
131 |
132 | static void setStatisticsCallback(
133 | int? sessionId, StatisticsCallback? statisticsCallback) {
134 | if (sessionId != null && statisticsCallback != null) {
135 | statisticsCallbackMap[sessionId] = statisticsCallback;
136 | }
137 | }
138 |
139 | static StatisticsCallback? getGlobalStatisticsCallback() =>
140 | _statisticsCallback;
141 |
142 | static void setGlobalStatisticsCallback(
143 | StatisticsCallback? statisticsCallback) {
144 | _statisticsCallback = statisticsCallback;
145 | }
146 |
147 | static FFmpegSessionCompleteCallback? getFFmpegSessionCompleteCallback(
148 | int? sessionId) =>
149 | ffmpegSessionCompleteCallbackMap[sessionId];
150 |
151 | static void setFFmpegSessionCompleteCallback(
152 | int? sessionId, FFmpegSessionCompleteCallback? completeCallback) {
153 | if (sessionId != null && completeCallback != null) {
154 | ffmpegSessionCompleteCallbackMap[sessionId] = completeCallback;
155 | }
156 | }
157 |
158 | static FFmpegSessionCompleteCallback?
159 | getGlobalFFmpegSessionCompleteCallback() =>
160 | _ffmpegSessionCompleteCallback;
161 |
162 | static void setGlobalFFmpegSessionCompleteCallback(
163 | FFmpegSessionCompleteCallback? completeCallback) {
164 | _ffmpegSessionCompleteCallback = completeCallback;
165 | }
166 |
167 | static FFprobeSessionCompleteCallback? getFFprobeSessionCompleteCallback(
168 | int? sessionId) =>
169 | ffprobeSessionCompleteCallbackMap[sessionId];
170 |
171 | static void setFFprobeSessionCompleteCallback(
172 | int? sessionId, FFprobeSessionCompleteCallback? completeCallback) {
173 | if (sessionId != null && completeCallback != null) {
174 | ffprobeSessionCompleteCallbackMap[sessionId] = completeCallback;
175 | }
176 | }
177 |
178 | static FFprobeSessionCompleteCallback?
179 | getGlobalFFprobeSessionCompleteCallback() =>
180 | _ffprobeSessionCompleteCallback;
181 |
182 | static void setGlobalFFprobeSessionCompleteCallback(
183 | FFprobeSessionCompleteCallback? completeCallback) {
184 | _ffprobeSessionCompleteCallback = completeCallback;
185 | }
186 |
187 | static MediaInformationSessionCompleteCallback?
188 | getMediaInformationSessionCompleteCallback(int? sessionId) =>
189 | mediaInformationSessionCompleteCallbackMap[sessionId];
190 |
191 | static void setMediaInformationSessionCompleteCallback(int? sessionId,
192 | MediaInformationSessionCompleteCallback? completeCallback) {
193 | if (sessionId != null && completeCallback != null) {
194 | mediaInformationSessionCompleteCallbackMap[sessionId] = completeCallback;
195 | }
196 | }
197 |
198 | static MediaInformationSessionCompleteCallback?
199 | getGlobalMediaInformationSessionCompleteCallback() =>
200 | _mediaInformationSessionCompleteCallback;
201 |
202 | static void setGlobalMediaInformationSessionCompleteCallback(
203 | MediaInformationSessionCompleteCallback? completeCallback) {
204 | _mediaInformationSessionCompleteCallback = completeCallback;
205 | }
206 |
207 | static DateTime? validDate(int? time) {
208 | if (time == null || time <= 0) {
209 | return null;
210 | } else {
211 | return DateTime.fromMillisecondsSinceEpoch(time, isUtc: false);
212 | }
213 | }
214 | }
215 |
--------------------------------------------------------------------------------
/lib/statistics.dart:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2021 Taner Sener
3 | *
4 | * This file is part of FFmpegKit.
5 | *
6 | * FFmpegKit is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Lesser General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * FFmpegKit is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * along with FFmpegKit. If not, see .
18 | */
19 |
20 | /// Statistics entry for an FFmpeg execute session.
21 | class Statistics {
22 | int _sessionId;
23 | int _videoFrameNumber;
24 | double _videoFps;
25 | double _videoQuality;
26 | int _size;
27 | int _time;
28 | double _bitrate;
29 | double _speed;
30 |
31 | Statistics(this._sessionId, this._videoFrameNumber, this._videoFps,
32 | this._videoQuality, this._size, this._time, this._bitrate, this._speed);
33 |
34 | int getSessionId() => this._sessionId;
35 |
36 | void setSessionId(int sessionId) {
37 | this._sessionId = sessionId;
38 | }
39 |
40 | int getVideoFrameNumber() => this._videoFrameNumber;
41 |
42 | void setVideoFrameNumber(int videoFrameNumber) {
43 | this._videoFrameNumber = videoFrameNumber;
44 | }
45 |
46 | double getVideoFps() => this._videoFps;
47 |
48 | void setVideoFps(double videoFps) {
49 | this._videoFps = videoFps;
50 | }
51 |
52 | double getVideoQuality() => this._videoQuality;
53 |
54 | void setVideoQuality(double videoQuality) {
55 | this._videoQuality = videoQuality;
56 | }
57 |
58 | int getSize() => this._size;
59 |
60 | void setSize(int size) {
61 | this._size = size;
62 | }
63 |
64 | int getTime() => this._time;
65 |
66 | void setTime(int time) {
67 | this._time = time;
68 | }
69 |
70 | double getBitrate() => this._bitrate;
71 |
72 | void setBitrate(double bitrate) {
73 | this._bitrate = bitrate;
74 | }
75 |
76 | double getSpeed() => this._speed;
77 |
78 | void setSpeed(double speed) {
79 | this._speed = speed;
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/lib/statistics_callback.dart:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2021 Taner Sener
3 | *
4 | * This file is part of FFmpegKit.
5 | *
6 | * FFmpegKit is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Lesser General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * FFmpegKit is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * along with FFmpegKit. If not, see .
18 | */
19 |
20 | import 'statistics.dart';
21 |
22 | /// Callback function that receives statistics generated for "FFmpeg" sessions.
23 | typedef StatisticsCallback = void Function(Statistics statistics);
24 |
--------------------------------------------------------------------------------
/lib/stream_information.dart:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2022 Taner Sener
3 | *
4 | * This file is part of FFmpegKit.
5 | *
6 | * FFmpegKit is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Lesser General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * FFmpegKit is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * along with FFmpegKit. If not, see .
18 | */
19 |
20 | /// Stream information class.
21 | class StreamInformation {
22 | static const keyIndex = "index";
23 | static const keyType = "codec_type";
24 | static const keyCodec = "codec_name";
25 | static const keyCodecLong = "codec_long_name";
26 | static const keyFormat = "pix_fmt";
27 | static const keyWidth = "width";
28 | static const keyHeight = "height";
29 | static const keyBitRate = "bit_rate";
30 | static const keySampleRate = "sample_rate";
31 | static const keySampleFormat = "sample_fmt";
32 | static const keyChannelLayout = "channel_layout";
33 | static const keySampleAspectRatio = "sample_aspect_ratio";
34 | static const keyDisplayAspectRatio = "display_aspect_ratio";
35 | static const keyAverageFrameRate = "avg_frame_rate";
36 | static const keyRealFrameRate = "r_frame_rate";
37 | static const keyTimeBase = "time_base";
38 | static const keyCodecTimeBase = "codec_time_base";
39 | static const keyTags = "tags";
40 |
41 | Map? _allProperties;
42 |
43 | /// Creates a new [StreamInformation] instance
44 | StreamInformation(this._allProperties);
45 |
46 | /// Returns stream index.
47 | int? getIndex() => this.getNumberProperty(keyIndex)?.toInt();
48 |
49 | /// Returns stream type.
50 | String? getType() => this.getStringProperty(StreamInformation.keyType);
51 |
52 | /// Returns stream codec.
53 | String? getCodec() => this.getStringProperty(StreamInformation.keyCodec);
54 |
55 | /// Returns stream codec in long format.
56 | String? getFullCodec() =>
57 | this.getStringProperty(StreamInformation.keyCodecLong);
58 |
59 | /// Returns stream format.
60 | String? getFormat() => this.getStringProperty(StreamInformation.keyFormat);
61 |
62 | /// Returns width.
63 | int? getWidth() =>
64 | this.getNumberProperty(StreamInformation.keyWidth)?.toInt();
65 |
66 | /// Returns height.
67 | int? getHeight() =>
68 | this.getNumberProperty(StreamInformation.keyHeight)?.toInt();
69 |
70 | /// Returns bitrate.
71 | String? getBitrate() => this.getStringProperty(StreamInformation.keyBitRate);
72 |
73 | /// Returns sample rate.
74 | String? getSampleRate() =>
75 | this.getStringProperty(StreamInformation.keySampleRate);
76 |
77 | /// Returns sample format.
78 | String? getSampleFormat() =>
79 | this.getStringProperty(StreamInformation.keySampleFormat);
80 |
81 | /// Returns channel layout.
82 | String? getChannelLayout() =>
83 | this.getStringProperty(StreamInformation.keyChannelLayout);
84 |
85 | /// Returns sample aspect ratio.
86 | String? getSampleAspectRatio() =>
87 | this.getStringProperty(StreamInformation.keySampleAspectRatio);
88 |
89 | /// Returns display aspect ratio.
90 | String? getDisplayAspectRatio() =>
91 | this.getStringProperty(StreamInformation.keyDisplayAspectRatio);
92 |
93 | /// Returns average frame rate.
94 | String? getAverageFrameRate() =>
95 | this.getStringProperty(StreamInformation.keyAverageFrameRate);
96 |
97 | /// Returns real frame rate.
98 | String? getRealFrameRate() =>
99 | this.getStringProperty(StreamInformation.keyRealFrameRate);
100 |
101 | /// Returns time base.
102 | String? getTimeBase() =>
103 | this.getStringProperty(StreamInformation.keyTimeBase);
104 |
105 | /// Returns codec time base.
106 | String? getCodecTimeBase() =>
107 | this.getStringProperty(StreamInformation.keyCodecTimeBase);
108 |
109 | /// Returns all tags.
110 | Map? getTags() =>
111 | this.getProperty(StreamInformation.keyTags);
112 |
113 | /// Returns the stream property associated with the key.
114 | String? getStringProperty(String key) => this._allProperties?[key];
115 |
116 | /// Returns the stream property associated with the key.
117 | num? getNumberProperty(String key) => this._allProperties?[key];
118 |
119 | /// Returns the stream property associated with the key.
120 | dynamic getProperty(String key) => this._allProperties?[key];
121 |
122 | /// Returns all properties found.
123 | Map? getAllProperties() => this._allProperties;
124 | }
125 |
--------------------------------------------------------------------------------
/macos/Assets/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sk3llo/ffmpeg_kit_flutter/ddfe9280563e6e5ce5e12d6fbfaeb948d24e124c/macos/Assets/.gitkeep
--------------------------------------------------------------------------------
/macos/Classes/FFmpegKitFlutterPlugin.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018-2021 Taner Sener
3 | *
4 | * This file is part of FFmpegKit.
5 | *
6 | * FFmpegKit is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Lesser General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * FFmpegKit is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * along with FFmpegKit. If not, see .
18 | */
19 |
20 | #import
21 |
22 | @interface FFmpegKitFlutterPlugin : NSObject
23 | @end
24 |
--------------------------------------------------------------------------------
/macos/ffmpeg_kit_flutter_new.podspec:
--------------------------------------------------------------------------------
1 | Pod::Spec.new do |s|
2 | s.name = 'ffmpeg_kit_flutter_new'
3 | s.version = '1.0.0'
4 | s.summary = 'FFmpeg Kit for Flutter'
5 | s.description = 'A Flutter plugin for running FFmpeg and FFprobe commands.'
6 | s.homepage = 'https://github.com/sk3llo/ffmpeg_kit_flutter'
7 | s.license = { :file => '../LICENSE' }
8 | s.author = { 'ARTHENICA' => 'open-source@arthenica.com' }
9 |
10 | s.platform = :osx
11 | s.requires_arc = true
12 | s.static_framework = true
13 |
14 | s.source = { :path => '.' }
15 | s.source_files = 'Classes/**/*'
16 | s.public_header_files = 'Classes/**/*.h'
17 |
18 | s.default_subspec = 'full-gpl'
19 |
20 | s.dependency 'FlutterMacOS'
21 | s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' }
22 |
23 | s.subspec 'min' do |ss|
24 | ss.source_files = 'Classes/**/*'
25 | ss.public_header_files = 'Classes/**/*.h'
26 | ss.dependency 'ffmpeg-kit-macos-min', "6.0"
27 | ss.osx.deployment_target = '10.15'
28 | end
29 |
30 | s.subspec 'min-lts' do |ss|
31 | ss.source_files = 'Classes/**/*'
32 | ss.public_header_files = 'Classes/**/*.h'
33 | ss.dependency 'ffmpeg-kit-macos-min', "6.0.LTS"
34 | ss.osx.deployment_target = '10.12'
35 | end
36 |
37 | s.subspec 'min-gpl' do |ss|
38 | ss.source_files = 'Classes/**/*'
39 | ss.public_header_files = 'Classes/**/*.h'
40 | ss.dependency 'ffmpeg-kit-macos-min-gpl', "6.0"
41 | ss.osx.deployment_target = '10.15'
42 | end
43 |
44 | s.subspec 'min-gpl-lts' do |ss|
45 | ss.source_files = 'Classes/**/*'
46 | ss.public_header_files = 'Classes/**/*.h'
47 | ss.dependency 'ffmpeg-kit-macos-min-gpl', "6.0.LTS"
48 | ss.osx.deployment_target = '10.12'
49 | end
50 |
51 | s.subspec 'https' do |ss|
52 | ss.source_files = 'Classes/**/*'
53 | ss.public_header_files = 'Classes/**/*.h'
54 | ss.dependency 'ffmpeg-kit-macos-https', "6.0"
55 | ss.osx.deployment_target = '10.15'
56 | end
57 |
58 | s.subspec 'https-lts' do |ss|
59 | ss.source_files = 'Classes/**/*'
60 | ss.public_header_files = 'Classes/**/*.h'
61 | ss.dependency 'ffmpeg-kit-macos-https', "6.0.LTS"
62 | ss.osx.deployment_target = '10.12'
63 | end
64 |
65 | s.subspec 'https-gpl' do |ss|
66 | ss.source_files = 'Classes/**/*'
67 | ss.public_header_files = 'Classes/**/*.h'
68 | ss.dependency 'ffmpeg-kit-macos-https-gpl', "6.0"
69 | ss.osx.deployment_target = '10.15'
70 | end
71 |
72 | s.subspec 'https-gpl-lts' do |ss|
73 | ss.source_files = 'Classes/**/*'
74 | ss.public_header_files = 'Classes/**/*.h'
75 | ss.dependency 'ffmpeg-kit-macos-https-gpl', "6.0.LTS"
76 | ss.osx.deployment_target = '10.12'
77 | end
78 |
79 | s.subspec 'audio' do |ss|
80 | ss.source_files = 'Classes/**/*'
81 | ss.public_header_files = 'Classes/**/*.h'
82 | ss.dependency 'ffmpeg-kit-macos-audio', "6.0"
83 | ss.osx.deployment_target = '10.15'
84 | end
85 |
86 | s.subspec 'audio-lts' do |ss|
87 | ss.source_files = 'Classes/**/*'
88 | ss.public_header_files = 'Classes/**/*.h'
89 | ss.dependency 'ffmpeg-kit-macos-audio', "6.0.LTS"
90 | ss.osx.deployment_target = '10.12'
91 | end
92 |
93 | s.subspec 'video' do |ss|
94 | ss.source_files = 'Classes/**/*'
95 | ss.public_header_files = 'Classes/**/*.h'
96 | ss.dependency 'ffmpeg-kit-macos-video', "6.0"
97 | ss.osx.deployment_target = '10.15'
98 | end
99 |
100 | s.subspec 'video-lts' do |ss|
101 | ss.source_files = 'Classes/**/*'
102 | ss.public_header_files = 'Classes/**/*.h'
103 | ss.dependency 'ffmpeg-kit-macos-video', "6.0.LTS"
104 | ss.osx.deployment_target = '10.12'
105 | end
106 |
107 | s.subspec 'full' do |ss|
108 | ss.source_files = 'Classes/**/*'
109 | ss.public_header_files = 'Classes/**/*.h'
110 | ss.dependency 'ffmpeg-kit-macos-full', "6.0"
111 | ss.osx.deployment_target = '10.15'
112 | end
113 |
114 | s.subspec 'full-lts' do |ss|
115 | ss.source_files = 'Classes/**/*'
116 | ss.public_header_files = 'Classes/**/*.h'
117 | ss.dependency 'ffmpeg-kit-macos-full', "6.0.LTS"
118 | ss.osx.deployment_target = '10.12'
119 | end
120 |
121 | s.subspec 'full-gpl' do |ss|
122 | ss.source_files = 'Classes/**/*'
123 | ss.public_header_files = 'Classes/**/*.h'
124 | ss.osx.vendored_frameworks = 'Frameworks/ffmpeg-kit-macos-full-gpl/ffmpegkit.framework',
125 | 'Frameworks/ffmpeg-kit-macos-full-gpl/libavcodec.framework',
126 | 'Frameworks/ffmpeg-kit-macos-full-gpl/libavdevice.framework',
127 | 'Frameworks/ffmpeg-kit-macos-full-gpl/libavfilter.framework',
128 | 'Frameworks/ffmpeg-kit-macos-full-gpl/libavformat.framework',
129 | 'Frameworks/ffmpeg-kit-macos-full-gpl/libavutil.framework',
130 | 'Frameworks/ffmpeg-kit-macos-full-gpl/libswresample.framework',
131 | 'Frameworks/ffmpeg-kit-macos-full-gpl/libswscale.framework'
132 |
133 | ss.osx.frameworks = 'AudioToolbox', 'CoreMedia'
134 | ss.libraries = 'z', 'bz2', 'c++', 'iconv'
135 | ss.osx.deployment_target = '10.15' # Adjust as needed for macOS
136 |
137 | # Adding pre-install hook for macOS
138 | s.prepare_command = <<-CMD
139 | if [ ! -d "./Frameworks" ]; then
140 | chmod +x ../scripts/setup_macos.sh
141 | ../scripts/setup_macos.sh
142 | fi
143 | CMD
144 | end
145 |
146 | s.subspec 'full-gpl-lts' do |ss|
147 | ss.source_files = 'Classes/**/*'
148 | ss.public_header_files = 'Classes/**/*.h'
149 | ss.dependency 'ffmpeg-kit-macos-full-gpl', "6.0.LTS"
150 | ss.osx.deployment_target = '10.12'
151 | end
152 |
153 | end
154 |
--------------------------------------------------------------------------------
/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: ffmpeg_kit_flutter_new
2 | description: FFmpeg Kit for Flutter with Full GPL and updated bindings. Supports Android, iOS and macOS platforms.
3 | repository: https://github.com/sk3llo/ffmpeg_kit_flutter
4 | homepage: https://github.com/sk3llo/ffmpeg_kit_flutter
5 | version: 1.6.1
6 |
7 | environment:
8 | sdk: ">=3.1.0 <4.0.0"
9 | flutter: ">=3.0.0"
10 |
11 | flutter:
12 | plugin:
13 | platforms:
14 | android:
15 | package: com.antonkarpenko.ffmpegkit
16 | pluginClass: MainActivity
17 | ios:
18 | pluginClass: FFmpegKitFlutterPlugin
19 | macos:
20 | pluginClass: FFmpegKitFlutterPlugin
21 |
22 | dependencies:
23 | ffmpeg_kit_flutter_android: ^1.4.0
24 | # path: ffmpeg_kit_flutter_android
25 | ffmpeg_kit_flutter_platform_interface: ^0.2.1
26 |
27 | flutter:
28 | sdk: flutter
29 |
30 | dev_dependencies:
31 | flutter_test:
32 | sdk: flutter
33 | plugin_platform_interface: ^2.1.8
34 |
--------------------------------------------------------------------------------
/scripts/setup_android.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Download Android AAR
4 | ANDROID_URL="https://github.com/sk3llo/ffmpeg_kit_flutter/releases/download/6.0.2/ffmpeg-kit-full-gpl-6.0.LTS.aar"
5 | mkdir -p libs
6 | curl -L $ANDROID_URL -o libs/com.arthenica.ffmpegkit-flutter-6.0.aar
--------------------------------------------------------------------------------
/scripts/setup_ios.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Download and unzip iOS framework
4 | IOS_URL="https://github.com/hellohejinyu/ffmpeg_kit_flutter_full_gpl/releases/download/v5.1.LTS/ffmpeg-kit-full-gpl-5.1.LTS-ios-framework.zip"
5 | mkdir -p Frameworks
6 | curl -L $IOS_URL -o frameworks.zip
7 | unzip -o frameworks.zip -d Frameworks
8 | rm frameworks.zip
9 |
10 | # Delete bitcode from all frameworks
11 | xcrun bitcode_strip -r Frameworks/ffmpegkit.framework/ffmpegkit -o Frameworks/ffmpegkit.framework/ffmpegkit
12 | xcrun bitcode_strip -r Frameworks/libavcodec.framework/libavcodec -o Frameworks/libavcodec.framework/libavcodec
13 | xcrun bitcode_strip -r Frameworks/libavdevice.framework/libavdevice -o Frameworks/libavdevice.framework/libavdevice
14 | xcrun bitcode_strip -r Frameworks/libavfilter.framework/libavfilter -o Frameworks/libavfilter.framework/libavfilter
15 | xcrun bitcode_strip -r Frameworks/libavformat.framework/libavformat -o Frameworks/libavformat.framework/libavformat
16 | xcrun bitcode_strip -r Frameworks/libavutil.framework/libavutil -o Frameworks/libavutil.framework/libavutil
17 | xcrun bitcode_strip -r Frameworks/libswresample.framework/libswresample -o Frameworks/libswresample.framework/libswresample
18 | xcrun bitcode_strip -r Frameworks/libswscale.framework/libswscale -o Frameworks/libswscale.framework/libswscale
--------------------------------------------------------------------------------
/scripts/setup_macos.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Download and unzip MacOS framework
4 | MACOS_URL="https://github.com/sk3llo/ffmpeg_kit_flutter/releases/download/6.0.2/ffmpeg-kit-macos-full-gpl-6.0.zip"
5 | mkdir -p Frameworks
6 | curl -L $MACOS_URL -o frameworks.zip
7 | unzip -o frameworks.zip -d Frameworks
8 | rm frameworks.zip
9 |
10 | # Delete bitcode from all frameworks
11 | xcrun bitcode_strip -r Frameworks/ffmpeg-kit-macos-full-gpl/ffmpegkit.framework/ffmpegkit -o Frameworks/ffmpeg-kit-macos-full-gpl/ffmpegkit.framework/ffmpegkit
12 | xcrun bitcode_strip -r Frameworks/ffmpeg-kit-macos-full-gpl/libavcodec.framework/libavcodec -o Frameworks/ffmpeg-kit-macos-full-gpl/libavcodec.framework/libavcodec
13 | xcrun bitcode_strip -r Frameworks/ffmpeg-kit-macos-full-gpl/libavdevice.framework/libavdevice -o Frameworks/ffmpeg-kit-macos-full-gpl/libavdevice.framework/libavdevice
14 | xcrun bitcode_strip -r Frameworks/ffmpeg-kit-macos-full-gpl/libavfilter.framework/libavfilter -o Frameworks/ffmpeg-kit-macos-full-gpl/libavfilter.framework/libavfilter
15 | xcrun bitcode_strip -r Frameworks/ffmpeg-kit-macos-full-gpl/libavformat.framework/libavformat -o Frameworks/ffmpeg-kit-macos-full-gpl/libavformat.framework/libavformat
16 | xcrun bitcode_strip -r Frameworks/ffmpeg-kit-macos-full-gpl/libavutil.framework/libavutil -o Frameworks/ffmpeg-kit-macos-full-gpl/libavutil.framework/libavutil
17 | xcrun bitcode_strip -r Frameworks/ffmpeg-kit-macos-full-gpl/libswresample.framework/libswresample -o Frameworks/ffmpeg-kit-macos-full-gpl/libswresample.framework/libswresample
18 | xcrun bitcode_strip -r Frameworks/ffmpeg-kit-macos-full-gpl/libswscale.framework/libswscale -o Frameworks/ffmpeg-kit-macos-full-gpl/libswscale.framework/libswscale
--------------------------------------------------------------------------------