Skip to content

Frame

A single decoded video frame, held in PHP’s own memory. Unlike stream nodes — which are immutable recipes — a Frame is a concrete, mutable buffer of pixels you can rewrite and pass on.

You get one from a VideoStream:

All readonly.

PropertyTypeDescription
$widthintFrame width in pixels.
$heightintFrame height in pixels.
$timefloatPresentation time in seconds (clip-local).
$numberintFrame index.
$pixelFormatstringPixel format name, e.g. "yuv420p".
MethodReturnsDescription
save(string $path)voidWrite the frame as an image; format inferred from the extension (.png, .jpg, .webp).
toPng()stringThe frame encoded as PNG bytes — for embedding, an HTTP response, or a TUI.
$frame = Media::open('in.mp4')->videoStream()->frameAt(12.0);
$frame->width; // 1920
$frame->time; // 12.0
$frame->save('preview.png');

VideoStream · Media

An Artisan Build project.

Built on FFmpeg — an independent binding, not affiliated with or endorsed by the FFmpeg project. Support FFmpeg.