flutter_ffmpeg_wasm 0.1.1 copy "flutter_ffmpeg_wasm: ^0.1.1" to clipboard
flutter_ffmpeg_wasm: ^0.1.1 copied to clipboard

Bundled single-thread FFmpeg WebAssembly runtime for Flutter web.

flutter_ffmpeg_wasm #

FFmpeg WebAssembly for Flutter web, shipped with pinned precompiled binaries. The application does not compile FFmpeg, contact a CDN, or require Emscripten at build or runtime.

Bundled runtime #

  • @ffmpeg/ffmpeg 0.11.6
  • @ffmpeg/core 0.11.0 with WebAssembly threads
  • @ffmpeg/core-st 0.11.1 as an automatic compatibility fallback
  • Runtime, JavaScript core loader, and WASM binary served as Flutter assets
  • Dedicated Web Worker keeps synchronous encoding off Flutter's UI thread

The runtime files, including the single-thread worker placeholder expected by the upstream loader, live in assets/ffmpeg. The upstream source snapshot under src is excluded from package publication and is not part of the Flutter build.

Usage #

import 'package:flutter_ffmpeg_wasm/flutter_ffmpeg_wasm.dart';

final ffmpeg = createFFmpeg(const CreateFFmpegParam(log: false));
await ffmpeg.load();
ffmpeg.writeFile('input.mp4', inputBytes);
await ffmpeg.run(['-i', 'input.mp4', 'output.webm']);
final outputBytes = ffmpeg.readFile('output.webm');
ffmpeg.exit();

Use setProgress and setLogger before run to observe an encoding job. Commands containing paths with spaces should use run(List<String>) instead of runCommand(String).

Files written before run are transferred to the worker's MEMFS. When the command finishes, its last argument is treated as the output path and is made available through readFile.

Hosting #

Serve .wasm files using application/wasm. The package selects the multi-thread core when crossOriginIsolated is true. Configure the page with:

Cross-Origin-Opener-Policy: same-origin
Cross-Origin-Embedder-Policy: require-corp
Cross-Origin-Resource-Policy: same-origin

Without those headers, or in an incompatible browser, the package selects the single-thread build automatically.

0
likes
60
points
105
downloads

Publisher

unverified uploader

Weekly Downloads

Bundled single-thread FFmpeg WebAssembly runtime for Flutter web.

Repository (GitHub)
View/report issues

Topics

#flutter #web #ffmpeg #wasm #video

License

MIT (license)

Dependencies

flutter, flutter_web_plugins, plugin_platform_interface, web

More

Packages that depend on flutter_ffmpeg_wasm

Packages that implement flutter_ffmpeg_wasm