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:
frameAt(float $seconds)— render a single frame through the current graph, for previews.mapFrames(Closure(Frame): Frame)— receive every decoded frame as the clip runs.
Properties
Section titled “Properties”All readonly.
| Property | Type | Description |
|---|---|---|
$width | int | Frame width in pixels. |
$height | int | Frame height in pixels. |
$time | float | Presentation time in seconds (clip-local). |
$number | int | Frame index. |
$pixelFormat | string | Pixel format name, e.g. "yuv420p". |
Methods
Section titled “Methods”| Method | Returns | Description |
|---|---|---|
save(string $path) | void | Write the frame as an image; format inferred from the extension (.png, .jpg, .webp). |
toPng() | string | The 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');See also
Section titled “See also”An Artisan Build project.
Built on FFmpeg — an independent binding, not affiliated with or endorsed by the FFmpeg project. Support FFmpeg.