VideoStream
A non-owning view of a video stream within a Media. It wraps an
AVStream + its codec parameters, owns no native memory, and holds a refcount on its
parent Media so the file stays open while the view is alive.
Obtain one from Media::videoStream() or Media::streams(). Pass it to
MediaEncoder::addVideo() to map it into an output.
Properties
Section titled “Properties”All readonly.
| Property | Type | Description |
|---|---|---|
$index | int | Stream index within the container. |
$codec | string | Codec short name, e.g. "h264". |
$duration | float | Stream duration in seconds (0.0 if unknown). |
$bitrate | int | Stream bit rate in bits/sec. |
$width | int | Frame width in pixels. |
$height | int | Frame height in pixels. |
$pixelFormat | string | Pixel format name, e.g. "yuv420p". |
$frameRate | float | Average frame rate in frames/sec. |
Example
Section titled “Example”$v = FFmpeg\Media::open('clip.mp4')->videoStream();printf("%dx%d %s @ %.3g fps (%s)\n", $v->width, $v->height, $v->codec, $v->frameRate, $v->pixelFormat);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.
Proudly sponsored by Tighten.