搜索插件、代码仓与 APP 分类

插件详情v4.6.7

ffmpeg_kit_flutter_new

适用于 Flutter 的 FFmpeg Kit,包含完整的 GPL 许可和更新的绑定。支持 Android、iOS 和 macOS 平台。

AndroidiOSmacOS
近 30 天下载
4.9万
喜欢数
204
Pub 分数
160

安装插件

flutter pub add ffmpeg_kit_flutter_new

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

FFmpeg Kit for Flutter 提供了完整的 GPL 兼容 FFmpeg 绑定,具备更新的功能,可在 Android、iOS 和 macOS 上实现强大的视频和音频处理。它允许开发者在 Flutter 应用中直接执行 FFmpeg 命令,支持格式转换、剪辑、合并和流媒体等任务。该包持续维护,并与 Flutter 生态系统无缝集成。其强大的跨平台支持使其非常适合需要高级媒体操作的多媒体应用。

适合场景

  • 视频格式转换
  • 音频提取和编辑
  • 视频剪辑和合并
  • 实时流处理
  • 媒体文件分析

主要特点

  • 完整的 FFmpeg 命令支持
  • 跨平台兼容性(Android、iOS、macOS)
  • GPL合规性与更新的绑定
  • 高效的媒体处理
  • 内置的进度和错误回调

适合对象

  • 多媒体应用
  • 视频编辑工具
  • 流媒体应用程序
  • 媒体转换器
  • 内容管理系统

使用建议

  • 由于 FFmpeg 二进制文件导致应用体积过大
  • 需要了解FFmpeg命令行界面
  • 与GPL相关的潜在许可问题
  • 性能取决于设备硬件
  • 复杂操作可能需要优化

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

🎬 FFmpegKit for Flutter — Full-GPL

Run FFmpeg & FFprobe on Android, iOS, macOS, Windows and Linux from a single Dart API.

A maintained fork of the original FFmpegKit, updated for the Android V2 embedding and Flutter 3+.

pub version FFmpeg 8.1.2 Discord Buy Me A Coffee


✨ Features

  • 🧰 Full toolkit — both FFmpeg and FFprobe, with per-session logs, statistics and callbacks.
  • 📱 Five platforms — Android, iOS, macOS, Windows (x86_64), and Linux (x86_64) behind one API.
  • 🎞️ FFmpeg v8.1.2 with VideoToolbox hardware acceleration on iOS & macOS.
  • 🗂️ Android SAF — process Storage Access Framework URIs directly.
  • 📚 External libraries — see the enabled-libraries table below.
  • 🔄 Modernised bindings for the latest Flutter and Android/macOS toolchains.
  • 📦 Swift Package Manager — iOS & macOS integrate via SPM (Flutter 3.24+) or CocoaPods, with prebuilt checksum-pinned XCFrameworks.

📦 Install

dependencies:
  ffmpeg_kit_flutter_new: ^4.6.0
import 'package:ffmpeg_kit_flutter_new/ffmpeg_kit.dart';

🎯 Choose your package

There are eight ffmpeg-kit packages — pick the smallest one that covers the codecs and features you need. GPL-licensed codecs (x264, x265, xvidcore, vid.stab) are only in the -gpl packages.

Package Best for
_min Smallest build — core FFmpeg only
_min_gpl Minimal + GPL codecs (x264/x265/xvid/vid.stab)
_https Adds TLS (gnutls) for https:// inputs
_https_gpl HTTPS + GPL codecs
_audio Audio-focused (mp3, opus, vorbis, speex, …)
_video Video-focused (dav1d, vpx, theora, webp, …)
_full Everything except GPL codecs
ffmpeg_kit_flutter_new (this one) Full + GPL — every library

🚀 Quick start

import 'package:ffmpeg_kit_flutter_new/ffmpeg_kit.dart';

final session = await FFmpegKit.execute('-i input.mp4 -c:v mpeg4 output.mp4');
final returnCode = await session.getReturnCode();

if (ReturnCode.isSuccess(returnCode)) {
  // ✅ done
} else if (ReturnCode.isCancel(returnCode)) {
  // ⏹️ cancelled
} else {
  // ❌ error — inspect await session.getLogs()
}

🧩 Enabled libraries

Below is which system and external libraries each package enables. Some parts of FFmpeg are GPL-licensed and are only present in the GPL packages.

min min-gpl https https-gpl audio video full full-gpl
external libraries - vid.stab
x264
x265
xvidcore
gmp
gnutls
gmp
gnutls
vid.stab
x264
x265
xvidcore
lame
libilbc
libvorbis
opencore-amr
opus
shine
soxr
speex
twolame
vo-amrwbenc
dav1d
fontconfig
freetype
fribidi
kvazaar
libass
libiconv
libtheora
libvpx
libwebp
snappy
zimg
dav1d
fontconfig
freetype
fribidi
gmp
gnutls
kvazaar
lame
libass
libiconv
libilbc
libtheora
libvorbis
libvpx
libwebp
libxml2
opencore-amr
opus
shine
snappy
soxr
speex
twolame
vo-amrwbenc
zimg
dav1d
fontconfig
freetype
fribidi
gmp
gnutls
kvazaar
lame
libass
libiconv
libilbc
libtheora
libvorbis
libvpx
libwebp
libxml2
opencore-amr
opus
shine
snappy
soxr
speex
twolame
vid.stab
vo-amrwbenc
x264
x265
xvidcore
zimg
android system libraries zlib
MediaCodec
ios system libraries bzip2
AudioToolbox
AVFoundation
iconv
zlib
ios VideoToolbox - - - - - - VideoToolbox VideoToolbox
macos system libraries bzip2
AudioToolbox
AVFoundation
Core Image
iconv
OpenCL
OpenGL
VideoToolbox
zlib

📱 Platform support

Android
API Level
Kotlin
Min Version
iOS
Min Target
macOS
Min Target
Windows Linux
24 1.8.22 14.0 10.15 10+ (x86_64) x86_64

Architectures — Android: arm-v7a, arm-v7a-neon, arm64-v8a, x86, x86_64 · iOS: arm64 (device) + arm64/x86_64 (simulator, incl. Apple Silicon / Xcode 26), shipped as .xcframework · macOS: arm64, x86_64.

Windows: prebuilt FFmpeg 8.1.2 libraries (x86_64) are downloaded automatically at build time. For local development against a self-built bundle, set FFMPEGKIT_LOCAL_DIR (env or CMake cache variable) to the bundle directory before flutter run/build windows.

Linux: prebuilt FFmpeg 8.1.2 libraries (x86_64) are downloaded automatically at build time, exactly as on Windows; FFMPEGKIT_LOCAL_DIR works the same way. In addition to Flutter's standard Linux prerequisites (clang, cmake, ninja-build, pkg-config, libgtk-3-dev), the plugin needs libjson-glib-dev:

sudo apt-get install libjson-glib-dev   # Debian/Ubuntu
sudo dnf install json-glib-devel        # Fedora

📖 Usage

Execute a command & read the result
import 'package:ffmpeg_kit_flutter_new/ffmpeg_kit.dart';

FFmpegKit.execute('-i file1.mp4 -c:v mpeg4 file2.mp4').then((session) async {
  final returnCode = await session.getReturnCode();
  if (ReturnCode.isSuccess(returnCode)) {
    // SUCCESS
  } else if (ReturnCode.isCancel(returnCode)) {
    // CANCEL
  } else {
    // ERROR
  }
});
Inspect a session
FFmpegKit.execute('-i file1.mp4 -c:v mpeg4 file2.mp4').then((session) async {
  final sessionId = session.getSessionId();
  final command = session.getCommand();
  final state = await session.getState();
  final returnCode = await session.getReturnCode();
  final duration = await session.getDuration();
  final output = await session.getOutput();
  final logs = await session.getLogs();
  final statistics = await (session as FFmpegSession).getStatistics();
});
Async execution with callbacks
FFmpegKit.executeAsync('-i file1.mp4 -c:v mpeg4 file2.mp4', (Session session) async {
  // CALLED WHEN SESSION IS EXECUTED
}, (Log log) {
  // CALLED WHEN SESSION PRINTS LOGS
}, (Statistics statistics) {
  // CALLED WHEN SESSION GENERATES STATISTICS
});
FFprobe & media information
FFprobeKit.getMediaInformation('<file path or url>').then((session) async {
  final information = await session.getMediaInformation();
});
Cancel sessions
FFmpegKit.cancel();          // stop all sessions
FFmpegKit.cancel(sessionId); // stop a specific session
Android — Storage Access Framework (SAF)
// Reading a file
FFmpegKitConfig.selectDocumentForRead('*/*').then((uri) {
  FFmpegKitConfig.getSafParameterForRead(uri!).then((safUrl) {
    FFmpegKit.executeAsync("-i ${safUrl!} -c:v mpeg4 file2.mp4");
  });
});

// Writing to a file
FFmpegKitConfig.selectDocumentForWrite('video.mp4', 'video/*').then((uri) {
  FFmpegKitConfig.getSafParameterForWrite(uri!).then((safUrl) {
    FFmpegKit.executeAsync("-i file1.mp4 -c:v mpeg4 ${safUrl}");
  });
});
Global callbacks & fonts
FFmpegKitConfig.enableLogCallback((log) { final message = log.getMessage(); });
FFmpegKitConfig.enableStatisticsCallback((statistics) { final size = statistics.getSize(); });
FFmpegKitConfig.setFontDirectoryList(["/system/fonts", "/System/Library/Fonts", "<folder with fonts>"]);

📄 License

Licensed under LGPL 3.0 by default. This package additionally includes GPL v3.0-licensed components (x264, x265, xvidcore, vid.stab) and is therefore effectively GPL v3.0.

💬 Community & support

所属分类

依赖

依赖清单 1 项

  • ffmpeg_kit_flutter_platform_interface^0.2.1

源码仓库

使用此插件的项目