パッケージ、リポジトリ、アプリカテゴリを検索

パッケージ詳細v1.0.1

ffmpeg_helper

Windows プラットフォームでの設定をサポートする Flutter 向けの FFmpeg コマンドヘルパー。

AndroidiOSmacOSWindowsLinux
30日間ダウンロード
104
いいね数
27
Pub ポイント
140

パッケージをインストール

flutter pub add ffmpeg_helper

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

ffmpeg_helper は、Flutter アプリケーションで FFmpeg コマンドを使用することを簡素化する Flutter パッケージであり、FFmpeg 操作を実行するための使いやすいインターフェースを提供します。Windows での FFmpeg のセットアップを組み込みサポートしており、Android、iOS、macOS、Windows、Linux など複数のプラットフォームで利用可能です。複雑なコマンドライン操作をシンプルな Dart メソッドに抽象化し、開発者がビデオ変換、トリミング、マージなどのマルチメディア処理タスクを最小限の努力で実行できるようにします。外部サーバーに依存せずにデバイス上でメディアを操作する必要があるアプリに最適です。

用途

  • 動画形式の変換
  • 動画からのオーディオ抽出
  • 動画のトリミングとマージ
  • デバイス内メディア処理
  • クロスプラットフォームマルチメディアアプリ

主な機能

  • 組み込みの Windows セットアップサポート
  • プラットフォームに依存しない FFmpeg インテグレーション
  • FFmpeg コマンド用のシンプルなDart API
  • Android、iOS、macOS、Windows、Linux をサポートしています
  • 簡単な設定と実行

適している対象

  • マルチメディアアプリを開発する開発者
  • デバイス内での動画編集が必要なアプリ
  • クロスプラットフォームメディア処理ツール
  • FFmpeg を使用した教育的またはプロトタイピングプロジェクト
  • 迅速なFFmpegの統合を望むチーム

注意事項

  • ターゲットデバイスに適切な FFmpeg インストールが必要です
  • FFmpegバイナリのため、アプリサイズが増加する可能性があります
  • Windowsのセットアップには追加の構成手順が必要です
  • 基本的な使用法を超えるドキュメントは限られている
  • 低価格端末へのパフォーマンスへの潜在的な影響

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

Buy Me A Coffee

ffmpeg_helper

FFmpeg commands helper for flutter with support for setup on windows platform. Create thumbnail and run ffprobe on all platforms except WEB. This uses ffmpeg_kit_flutter_min_gpl package for android/ios/macos Info was taken from ffmpeg_cli and recreated it as that project was stale.

// Initialize in main
  await FFMpegHelper.instance.initialize(); // This is a singleton instance
  // FFMpegHelper ffmpeg = FFMpegHelpe.instance; // use like this
  runApp(const MyApp());
// Command builder
// Use prebuilt args and filters or create custom ones
final FFMpegCommand cliCommand = FFMpegCommand(
  inputs: [
    FFMpegInput.asset(selectedFile!.path),
  ],
  args: [
    const LogLevelArgument(LogLevel.info),
    const OverwriteArgument(),
    const TrimArgument(
      start: Duration(seconds: 0),
      end: Duration(seconds: 10),
    ),
  ],
  filterGraph: FilterGraph(
    chains: [
      FilterChain(
        inputs: [],
        filters: [
          ScaleFilter(
            height: 300,
            width: -2,
          ),
        ],
        outputs: [],
      ),
    ],
  ),
  outputFilepath: path.join(appDocDir.path, "ffmpegtest.mp4"),
);
FFMpegHelperSession session = await ffmpeg.runAsync(
  cliCommand,
  statisticsCallback: (Statistics statistics) {
    print('bitrate: ${statistics.getBitrate()}');
  },
);

Thumbnail creator

// use ffmpeg.getThumbnailFileAsync() to get session
Future<FFMpegHelperSession> getThumbnailFileAsync({
  required String videoPath,
  required Duration fromDuration,
  required String outputPath,
  String? ffmpegPath,
  FilterGraph? filterGraph,
  int qualityPercentage = 100,
  Function(Statistics statistics)? statisticsCallback,
  Function(File? outputFile)? onComplete,
  FFMpegConfigurator? ffMpegConfigurator,
})
// use ffmpeg.getThumbnailFileSync() to get thumbnail file
Future<File?> getThumbnailFileSync({
  required String videoPath,
  required Duration fromDuration,
  required String outputPath,
  String? ffmpegPath,
  FilterGraph? filterGraph,
  int qualityPercentage = 100,
  Function(Statistics statistics)? statisticsCallback,
  Function(File? outputFile)? onComplete,
  FFMpegConfigurator? ffMpegConfigurator,
})

Run FFMpeg and get session so that user can cancel it later.

Future<FFMpegHelperSession> runAsync(
  FFMpegCommand command, {
  Function(Statistics statistics)? statisticsCallback,
  Function(File? outputFile)? onComplete,
  Function(Log)? logCallback,
})

Run FFMpeg as future.

Future<File?> runSync(
  FFMpegCommand command, {
  Function(Statistics statistics)? statisticsCallback,
})

Run ffprobe

Future<MediaInformation?> runProbe(String filePath)

Setup FFMPEG for Linux

sudo apt-get install ffmpeg
OR
sudo snap install ffmpeg
depends on linux distro

Setup FFMPEG for windows

Future<void> downloadFFMpeg() async {
    if (Platform.isWindows) {
      bool success = await ffmpeg.setupFFMpegOnWindows(
        onProgress: (FFMpegProgress progress) {
          downloadProgress.value = progress;
        },
      );
      setState(() {
        ffmpegPresent = success;
      });
    } else if (Platform.isLinux) {
      // show dialog box
      await Dialogs.materialDialog(
          color: Colors.white,
          msg:
              'FFmpeg installation required by user.\nsudo apt-get install ffmpeg\nsudo snap install ffmpeg',
          title: 'Install FFMpeg',
          context: context,
          actions: [
            IconsButton(
              onPressed: () {
                Navigator.of(context).pop();
              },
              text: 'Ok',
              iconData: Icons.done,
              color: Colors.blue,
              textStyle: const TextStyle(color: Colors.white),
              iconColor: Colors.white,
            ),
          ]);
    }
  }
// check setup progress on windows
// On windows if ffmpeg is not present it will download official zip file and extract on doc directory of app.
SizedBox(
  width: 300,
  child: ValueListenableBuilder(
    valueListenable: downloadProgress,
    builder: (BuildContext context, FFMpegProgress value, _) {
      //print(value.downloaded / value.fileSize);
      double? prog;
      if ((value.downloaded != 0) && (value.fileSize != 0)) {
        prog = value.downloaded / value.fileSize;
      } else {
        prog = 0;
      }
      if (value.phase == FFMpegProgressPhase.decompressing) {
        prog = null;
      }
      if (value.phase == FFMpegProgressPhase.inactive) {
        return const SizedBox.shrink();
      }
      return Column(
        mainAxisSize: MainAxisSize.min,
        children: [
          Text(value.phase.name),
          const SizedBox(height: 5),
          LinearProgressIndicator(value: prog),
        ],
      );
    },
  ),
),

カテゴリー

依存関係

依存関係一覧 7 件

ソースリポジトリ

このパッケージを使用しているプロジェクト

データはまだありません。