Skip to content

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 pad

Shorthand. Not available — apply() returns a single stream, and Scale2ref has multiple outputs. Use addFilter() + outputs() above.

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.

TODO — prose: how the filter actually works and what its key parameters mean (the explanation FFmpeg’s terse option help omits).

TODO — runnable PHP, with the equivalent ffmpeg CLI alongside.

TODO

TODO

ParameterTypeDefaultRange / valuesDescription
widthint|float|stringexpressionOutput video width
heightint|float|stringexpressionOutput video height
flagsstringFlags to pass to libswscale
interlboolfalseset interlacing
sizestringset video size
in_color_matrixScale2refColorautoauto, smpte170m, bt709, fcc, smpte240m, bt2020set input YCbCr type
out_color_matrixScale2refColor2auto, smpte170m, bt709, fcc, smpte240m, bt2020set output YCbCr type
in_rangeScale2refRangeunknownunknown, full, limitedset input color range
out_rangeScale2refRangeunknownunknown, full, limitedset output color range
in_chroma_locScale2refChromaLocunknownunknown, left, center, topleft, top, bottomleft, bottomset input chroma sample location
out_chroma_locScale2refChromaLocunknownunknown, left, center, topleft, top, bottomleft, bottomset output chroma sample location
in_v_chr_posint-513-513512input vertical chroma position in luma grid/256
in_h_chr_posint-513-513512input horizontal chroma position in luma grid/256
out_v_chr_posint-513-513512output vertical chroma position in luma grid/256
out_h_chr_posint-513-513512output horizontal chroma position in luma grid/256
force_original_aspect_ratioScale2refForceOardisabledisable, decrease, increasedecrease or increase w/h if necessary to keep the original AR
force_divisible_byint11256enforce that the output resolution is divisible by a defined integer when force_original_aspect_ratio is used
param0floatScaler param 0
param1floatScaler param 1
evalScale2refEvalinitinit, framespecify when to evaluate expressions

FFmpeg also names these options (use the parameter shown above): wwidth, hheight, ssize.


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.