Skip to content

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.

All readonly.

PropertyTypeDescription
$indexintStream index within the container.
$codecstringCodec short name, e.g. "h264".
$durationfloatStream duration in seconds (0.0 if unknown).
$bitrateintStream bit rate in bits/sec.
$widthintFrame width in pixels.
$heightintFrame height in pixels.
$pixelFormatstringPixel format name, e.g. "yuv420p".
$frameRatefloatAverage frame rate in frames/sec.
$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);

Media · AudioStream · MediaEncoder

An Artisan Build project.

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

Proudly sponsored by Tighten.