AudioStream
A non-owning view of an audio 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::audioStream() or Media::streams(). Pass it to
MediaEncoder::addAudio() 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. "aac". |
$duration | float | Stream duration in seconds (0.0 if unknown). |
$bitrate | int | Stream bit rate in bits/sec. |
$sampleRate | int | Samples per second, e.g. 44100. |
$channels | int | Number of audio channels. |
Example
Section titled “Example”$a = FFmpeg\Media::open('clip.mp4')->audioStream();if ($a !== null) { printf("%s %d Hz %d ch\n", $a->codec, $a->sampleRate, $a->channels);}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.