Search packages, repositories and app categories

Package detailsv0.3.0

ffmpeg_cli

Run FFMPEG CLI commands from Dart.

AndroidiOSmacOSWindowsLinux
30-day downloads
657
Likes
49
Pub points
135

Install package

flutter pub add ffmpeg_cli

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

A Flutter/Dart package that enables execution of FFMPEG command-line interface (CLI) commands directly from Dart code. It provides a simple and efficient way to perform multimedia processing tasks such as video encoding, audio extraction, format conversion, and more across multiple platforms. The package abstracts the complexity of interacting with native FFMPEG binaries, making it accessible within Flutter applications. Ideal for developers needing robust media manipulation capabilities without writing platform-specific code.

Use cases

  • Video format conversion
  • Audio extraction from videos
  • Media file compression
  • Batch processing of multimedia files
  • Real-time video encoding

Key features

  • Cross-platform support
  • Simple CLI command execution
  • Integration with Flutter apps
  • Support for all major OS platforms
  • Lightweight and easy to use

Suitable for

  • Developers building media-heavy apps
  • Apps requiring video/audio processing
  • Tools for content creators
  • Educational projects involving multimedia
  • Backend services with Flutter

Considerations

  • Requires FFMPEG binary on target devices
  • Platform-specific setup may be needed
  • Large binary size due to FFMPEG dependency
  • Limited error handling in basic usage
  • Performance depends on device hardware

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

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.

Categories

Dependencies

Dependency list 3 items

Source repository

Projects using this package

No data available yet.