搜尋套件、儲存庫與 APP 分類

套件詳情v0.3.0

ffmpeg_cli

從 Dart 執行 FFMPEG 命令列工具。

AndroidiOSmacOSWindowsLinux
近 30 天下載
657
喜歡數
49
Pub 分數
135

安裝套件

flutter pub add ffmpeg_cli

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

一個 Flutter/Dart 套件,可直接從 Dart 程式碼執行 FFMPEG 命令列介面(CLI)命令。它提供了一種簡單且高效的方式,在多個平台執行多媒體處理任務,例如影片編碼、音訊擷取、格式轉換等。此套件抽象了與原生 FFMPEG 二進位檔互動的複雜性,讓 Flutter 應用程式中也能輕鬆使用。非常適合需要強大媒體操作功能卻又不需撰寫平台特定程式碼的開發者。

適用情境

  • 影片格式轉換
  • 從影片中提取音訊
  • 媒體檔案壓縮
  • 多媒體檔案的批量處理
  • 即時影片編碼

主要特色

  • 跨平台支援
  • 簡單的 CLI 命令執行
  • 與 Flutter 應用整合
  • 支援所有主要作業系統平台
  • 輕便且容易使用

適合對象

  • 開發媒體密集型應用的開發者
  • 需要視頻/音頻處理的應用程式
  • 內容創作者工具
  • 涉及多媒體的教育專案
  • 使用Flutter的後端服務

使用建議

  • 目標設備上需要 FFMPEG 二進制檔案
  • 可能需要進行平台特定的設定
  • 由於 FFMPEG 依賴導致的大型二進位檔案大小
  • 基本用法中的錯誤處理有限
  • 性能取決於設備硬體

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

FFMPEG CLI - Run FFMPEG CLI commands from Dart

Built by the Flutter Bounty Hunters



Check out our Usage Guide


What is FFMPEG?

FFMPEG is a very popular, longstanding tool for reading, writing, and streaming audio and video content. Most developers use FFMPEG through its command-line interface (CLI), because that's much easier than interfacing with the C code upon which FFMPEG is built.

What is ffmpeg_cli

This package allows you to configure FFMPEG CLI commands with Dart code.

ffmpeg_cli purposefully retains the complexity of FFMPEG commands so that anything the FFMPEG CLI can do, the ffmpeg_cli package can do.

Quickstart

First, make sure that ffmpeg is installed on your device, and is available on your system path.

Compose an FFMPEG command with Dart:

// Define an output stream, which will map the filter
// graph to the video file. The ID names can be whatever
// you'd like.
const outputStream = FfmpegStream(
  videoId: "[final_v]", 
  audioId: "[final_a]",
);

// Compose your desired FFMPEG command, with inputs, filters, arguments,
// and an output location.
final command = FfmpegCommand(
  inputs: [
    FfmpegInput.asset("assets/intro.mp4"),
    FfmpegInput.asset("assets/content.mp4"),
    FfmpegInput.asset("assets/outro.mov"),
  ],
  args: [
    // Map the filter graph to the video file output.
    CliArg(name: 'map', value: outputStream.videoId!),
    CliArg(name: 'map', value: outputStream.audioId!),
    const CliArg(name: 'vsync', value: '2'),
  ],
  filterGraph: FilterGraph(
    chains: [
      FilterChain(
        inputs: [
          // Send all 3 video assets into the concat filter.
          const FfmpegStream(videoId: "[0:v]", audioId: "[0:a]"),
          const FfmpegStream(videoId: "[1:v]", audioId: "[1:a]"),
          const FfmpegStream(videoId: "[2:v]", audioId: "[2:a]"),
        ],
        filters: [
          // Concatenate 3 segments.
          ConcatFilter(
            segmentCount: 3, 
            outputVideoStreamCount: 1, 
            outputAudioStreamCount: 1,
          ),
        ],
        outputs: [
          // Give the output stream the given audio/video IDs
          outputStream,
        ],
      ),
    ],
  ),
  outputFilepath: "/my/output/file.mp4",
);

// Execute command
final process = await Ffmpeg().run(command: command);

How ffprobe support is managed

There are a lot of properties in ffprobe. Many of these properties can present in varying formats, which are not effectively documented.

The approach to ffprobe is to add missing result parameters as they are discovered and to add parsing functionality per property as the various possible formats are discovered. In other words, only do what is necessary in the given moment because the overall scope is too large and difficult to discover.

所屬分類

依賴

依賴清單 3 項

原始碼儲存庫

使用此套件的專案

暫無相關資料。