snapframes 0.0.1 copy "snapframes: ^0.0.1" to clipboard
snapframes: ^0.0.1 copied to clipboard

Flutter plugin for extracting video thumbnails on Android and iOS.

snapframes #

📸 A Flutter plugin for extracting video thumbnails (frames) on Android and iOS.
Supports single frame or multiple frames (batch), configurable size/format/quality, and video duration detection.


Features #

  • Get a single frame from a video at a specific timestamp
  • Get multiple frames at once (batch) with configurable timestamps
  • Supported formats: JPG, PNG, WEBP
  • Adjustable width, height, and quality
  • Retrieve video duration as Duration
  • Safe frame grabbing (avoids decoding errors near the end of video)

Installation #

Add to your pubspec.yaml:

dependencies:
  snapframes: ^0.0.1

Usage #

Import #

import 'package:snapframes/snapframes.dart';

Get single frame #

final req = SnapRequest(
  source: '/path/to/video.mp4',
  timestampMs: 1500, // 1.5 sec
  width: 320,
  height: 180,
  format: SnapImageFormat.jpg,
  quality: 85,
);

final Uint8List? bytes = await getFrameBytes(req);

Get multiple frames #

final req = BatchRequest(
  source: '/path/to/video.mp4',
  timestampsMs: [1000, 2000, 3000], // ms
  format: SnapImageFormat.jpg,
  quality: 85,
);

final List<Uint8List> frames = await getFramesBytes(req);

Get video duration #

final Duration duration = await getDuration('/path/to/video.mp4');
print('Video length: ${duration.inSeconds} seconds');

Example #

See example/lib/main.dart for a complete demo:

  • pick a video file via file_picker
  • extract 10 evenly spaced frames
  • preview them in a grid

Platform support #

  • ✅ Android — uses MediaMetadataRetriever
  • ✅ iOS — uses AVAssetImageGenerator

Roadmap #

  • ❌ Extract frames in background isolate / worker thread
  • ❌ Support remote URIs (http/https)
  • ❌ Optional caching

0
likes
130
points
10
downloads

Publisher

verified publisherkotelnikoff.dev

Weekly Downloads

Flutter plugin for extracting video thumbnails on Android and iOS.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on snapframes

Packages that implement snapframes