Scale2ref
Video Multiple outputs Transform
Scale the input video size and/or convert the image format to the given reference.
FFmpeg filter:
scale2ref— the official reference.
Add it to a graph. The explicit form works for every filter — bind it to its inputs and read the result from outputs():
$outputs = $video->addFilter(new Scale2ref(…), [$other])->outputs(); // one stream per output padShorthand. Not available — apply() returns a single stream, and Scale2ref has multiple outputs. Use addFilter() + outputs() above.
When to use it
Section titled “When to use it”TODO — when this filter shines: what it’s the right tool for, what to reach for instead when it isn’t, and how it composes with neighbouring filters.
How to use it
Section titled “How to use it”TODO — prose: how the filter actually works and what its key parameters mean (the explanation FFmpeg’s terse option help omits).
Examples
Section titled “Examples”TODO — runnable PHP, with the equivalent ffmpeg CLI alongside.
Gotchas
Section titled “Gotchas”TODO
See also
Section titled “See also”TODO
Parameters
Section titled “Parameters”| Parameter | Type | Default | Range / values | Description |
|---|---|---|---|---|
width | int|float|string | — | expression | Output video width |
height | int|float|string | — | expression | Output video height |
flags | string | — | — | Flags to pass to libswscale |
interl | bool | false | — | set interlacing |
size | string | — | — | set video size |
in_color_matrix | Scale2refColor | auto | auto, smpte170m, bt709, fcc, smpte240m, bt2020 | set input YCbCr type |
out_color_matrix | Scale2refColor | 2 | auto, smpte170m, bt709, fcc, smpte240m, bt2020 | set output YCbCr type |
in_range | Scale2refRange | unknown | unknown, full, limited | set input color range |
out_range | Scale2refRange | unknown | unknown, full, limited | set output color range |
in_chroma_loc | Scale2refChromaLoc | unknown | unknown, left, center, topleft, top, bottomleft, bottom | set input chroma sample location |
out_chroma_loc | Scale2refChromaLoc | unknown | unknown, left, center, topleft, top, bottomleft, bottom | set output chroma sample location |
in_v_chr_pos | int | -513 | -513–512 | input vertical chroma position in luma grid/256 |
in_h_chr_pos | int | -513 | -513–512 | input horizontal chroma position in luma grid/256 |
out_v_chr_pos | int | -513 | -513–512 | output vertical chroma position in luma grid/256 |
out_h_chr_pos | int | -513 | -513–512 | output horizontal chroma position in luma grid/256 |
force_original_aspect_ratio | Scale2refForceOar | disable | disable, decrease, increase | decrease or increase w/h if necessary to keep the original AR |
force_divisible_by | int | 1 | 1–256 | enforce that the output resolution is divisible by a defined integer when force_original_aspect_ratio is used |
param0 | float | — | — | Scaler param 0 |
param1 | float | — | — | Scaler param 1 |
eval | Scale2refEval | init | init, frame | specify when to evaluate expressions |
FFmpeg also names these options (use the parameter shown above): w → width, h → height, s → size.
Maps to FFmpeg’s scale2ref filter. Verified against ffmpeg n7.1.1.
An Artisan Build project.
Built on FFmpeg — an independent binding, not affiliated with or endorsed by the FFmpeg project. Support FFmpeg.