This guide describes how to install and configure FFmpeg Kit Extended Flutter in your project.
-
Install the package:
flutter pub add ffmpeg_kit_extended_flutter
-
Add the dependency to your
pubspec.yamlthen addffmpeg_kit_extended_configsection to yourpubspec.yaml:dependencies: ffmpeg_kit_extended_flutter: ^0.1.0 ffmpeg_kit_extended_config: version: "0.8.2" # version of the pre-bundled libffmpegkit libraries released at https://github.com/akashskypatel/ffmpeg-kit-builders/releases type: "base" # pre-bundled builds: debug, base, full, audio, video, video_hw gpl: true # enable to include GPL libraries small: true # enable to use smaller builds # == OR == # ------------------------------------------------------------- # You can specify remote or local path to libffmpegkit libraries for each platform # This allows you to deploy custom builds of libffmpegkit. # See: https://github.com/akashskypatel/ffmpeg-kit-builders # Note: This will override all above options. # ------------------------------------------------------------- # windows: "path/to/ffmpeg-kit/libraries" # linux: "https://path/to/ffmpeg-kit/libraries"
-
Run
dart run ffmpeg_kit_extended_flutter:configureto generate the native libraries.dart run ffmpeg_kit_extended_flutter:configure
Configure Options
--help: Show this help message.--platform=<platform1,platform2>: Specify platforms to configure (e.g.,windows,linux).--verbose: Enable verbose output.--app-root=<path>: Specify the path to the app root.
-
Import the package in your Dart code:
import 'package:ffmpeg_kit_extended_flutter/ffmpeg_kit_extended_flutter.dart';
-
Ensure your
minSdkVersionis at least 21 inandroid/app/build.gradle. -
Add necessary permissions to
android/app/src/main/AndroidManifest.xmlif you plan to read/write external storage:
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />-
Ensure your deployment target is at least iOS 12.1 or macOS 10.13.
-
For iOS, you might need to add keys to
Info.plistfor file access:
<key>NSPhotoLibraryUsageDescription</key>
<string>This app requires access to the photo library to process videos.</string>
<key>NSFileProviderUsageDescription</key>
<string>This app requires access to files to process videos.</string>The Windows implementation uses libffmpegkit compiled with MinGW. Ensure your environment supports running compiled C binaries. No specific configuration is usually required as the binaries are bundled with the plugin.
Ensure you have ffmpeg dependencies installed if you are building from source or using specific features that rely on system libraries (though the plugin aims to be self-contained).
FFmpeg Kit Extended Flutter uses a configure.dart script to manage native binaries. In some environments, you may need to run this manually if the automatic download fails:
dart run ffmpeg_kit_extended_flutter:configureThis script handles:
- Downloading the correct native binaries for your platform.
- Generating Dart bindings using
ffigen. - Setting up the native build environment.
If you encounter errors related to "Library not found" or "Missing symbol", try running the configuration script manually:
flutter pub run ffmpeg_kit_extended_flutter:configureThe plugin generates bindings at build time. If you see errors related to Pointer<Void> or missing FFI functions, ensure you have llvm installed on your system as it's required by ffigen.
If FFmpeg fails with "Permission denied", double-check that your app has the necessary storage permissions and that you are using absolute paths for files.