video_frames library

Decode video frames to RGBA and encode RGBA frames to H.264 or HEVC MP4 (with the source's audio copied through), on Android, iOS and macOS.

Every call runs on a background queue on the platform side, and the API also works from background isolates (initialize BackgroundIsolateBinaryMessenger first).

Classes

VideoFrame
One decoded frame: row-major RGBA, width * height * 4 bytes.
VideoFrames
Entry point: holds the host API (swappable in tests).
VideoInfo
Metadata of an opened video.
VideoReader
Reads frames from a video file. Always close it (e.g. in a finally): it holds a hardware decoder until then.
VideoWriter
Encodes RGBA frames into an H.264 or HEVC MP4. Always finish or cancel it: it holds a hardware encoder until then.

Enums

ScaleFilter
How frames are filtered when maxDimension scales them down.
VideoCodec
The video codec a writer encodes with.
VideoFramesErrorCode
Why a VideoFramesException happened.

Functions

cropRgba(Uint8List rgba, int srcWidth, int width, int height) → Uint8List
The top-left width x height of an RGBA image srcWidth pixels wide.

Exceptions / Errors

VideoFramesException
A failure from the platform side of a VideoReader or VideoWriter.