GitHub 저장소Flutter-Bounty-Hunters/ffmpeg_cli

ffmpeg_cli

Dart로 작성된 FFMPEG CLI 래퍼

ffmpeg_cli 프로젝트 이미지
스타
44
포크
13
최근 푸시(UTC)
2024. 7. 16.
프로젝트 상태
활성

원본 README

아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.

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.

Flutter Bounty Hunters GitHub avatar
GitHub 작성자

Flutter Bounty Hunters ↗

We build open source Flutter and Dart tools.

언어Dart

이 저장소가 배포한 패키지

사용 중인 의존성

의존성 목록 7 개

프로젝트에 맞는 저장소를 선택하려면?

사용 목적에 따라 검색하고 개발 활동을 비교한 뒤 원본 저장소에서 요구 사항을 확인하세요.

  1. 이름, 작성자 또는 설명으로 검색하고 기술 주제로 범위를 좁힙니다.
  2. 스타, 포크, 최근 푸시를 함께 비교하세요. 스타는 관심의 지표이며 품질을 보장하지 않습니다.
  3. 사용하기 전에 GitHub에서 README, 라이선스, Issues를 확인하세요.

출처 및 관리

“A repository is the most basic element of GitHub.”

GitHub Docs — About repositories ↗