Hardware-accelerated 4K story video export without thermal throttling.
Exporting rich, layered Flutter story canvases to MP4 video often forces teams into shipping massive software FFmpeg binaries that overheat mobile devices, drop frames, and inflate app bundle sizes.
flutter_story_encoder bridges directly to native hardware encoders—AVFoundation on iOS and macOS, and MediaCodec with OpenGLRenderer on Android—delivering 4K 60fps H.264 High Profile 4.1 output through a compact, dependency-free Flutter plugin.
Designed around thermal stability and deterministic frame pacing, the plugin enforces backpressure across a Pigeon type-safe IPC boundary and streams live FPS, frame counts, and progress telemetry back to Dart.
Drop-in installation and Dart API.
Published as flutter_story_encoder on pub.dev (v1.2.2, published Mar 4, 2026) with 160 / 160 pub points.
dependencies:
flutter_story_encoder: ^1.2.2await FlutterStoryEncoder.start(
config: EncoderConfig(
width: 1080,
height: 1920,
fps: 30,
bitrate: 10000000,
outputPath: '/path/to/story.mp4',
addSilentAudio: true,
),
onProgress: (stats) => print('${stats.currentFps} fps'),
);
await FlutterStoryEncoder.appendFrame(rgbaBytes);
final outputPath = await FlutterStoryEncoder.finish();Native speed, zero FFmpeg bloat.
Type-safe Pigeon IPC, upfront dimension validation, and GPU-backed native pipelines across Apple and Android hardware.
AVFoundation & MediaCodec Backends
Uses Swift AVAssetWriter / AVFoundation on iOS 13+ and macOS 11+ (with optimized pixel swizzling) and Android MediaCodec + OpenGLRenderer (with GL_UNPACK_ALIGNMENT support) on API 21+ / 24+ for 4K.
Thermal Backpressure & Pacing
appendFrame coordinates native buffer readiness and signals backpressure to Dart when the hardware queue is saturated, avoiding runaway memory growth and thermal throttling on long story exports.
Pigeon Type-Safe IPC & Guardrails
Generated StoryEncoderHostApi and StoryEncoderFlutterApi contracts eliminate stringly-typed channel bugs. FlutterStoryEncoder.start validates even dimensions, positive FPS/bitrate, and output paths before invoking native code.
Swift Package Manager & Live Telemetry
Ships native SPM Package.swift manifests for both iOS and macOS, streams real-time EncodingStats (framesProcessed, currentFps, progress), and optionally muxes a silent AAC track for universal social platform playback.
Video Pipeline & Platform Requirements
- Codec: H.264 / AVC (High Profile 4.1)
- Audio: Optional silent AAC track
- Color Space: BT.709 standard
- Rate Control: Variable Bitrate (VBR)
- Keyframe Interval: 1 second
- iOS 13.0+ (AVFoundation + SPM)
- macOS 11.0+ (AVFoundation + SPM)
- Android Min SDK 21 (24+ recommended for 4K)
- Dart >=3.10.7 · Flutter >=3.3.0
- Zero external runtime dependencies
- FlutterStoryEncoder.start(config, callbacks)
- FlutterStoryEncoder.appendFrame(Uint8List)
- FlutterStoryEncoder.finish() & cancel()
- EncoderConfig(width, height, fps, bitrate, ...)
- EncodingStats(framesProcessed, currentFps, progress)