mirror of
https://mirror.skon.top/https://github.com/FFmpeg/FFmpeg
synced 2026-04-20 21:00:41 +08:00
avfilter/vf_libplacebo: introduce fit_mode option
The semantics of these keywords are well-defined by the CSS 'object-fit' property. This is arguably more user-friendly and less obtuse than the existing `normalize_sar` and `pad_crop_ratio` options. Additionally, this comes with two new (useful) behaviors, `none` and `scale_down`, neither of which map elegantly to the existing options. One additional benefit of this option is that, unlike `normalize_sar`, it does *not* also imply `reset_sar`; meaning that users can now choose to have an anamorphic base layer and still have the overlay images scaled to fit on top of it according to the chosen strategy. See-Also: https://drafts.csswg.org/css-images/#the-object-fit
This commit is contained in:
@@ -16459,7 +16459,7 @@ e.g. anamorphic video sources, are forwarded to the output pixel aspect ratio.
|
||||
@item normalize_sar
|
||||
Like @option{reset_sar}, but instead of stretching the video content to fill
|
||||
the new output aspect ratio, the content is instead padded or cropped as
|
||||
necessary.
|
||||
necessary. Mutually exclusive with @option{fit_mode}. Disabled by default.
|
||||
|
||||
@item pad_crop_ratio
|
||||
Specifies a ratio (between @code{0.0} and @code{1.0}) between padding and
|
||||
@@ -16469,6 +16469,40 @@ content with black borders, while a value of @code{1.0} always crops off parts
|
||||
of the content. Intermediate values are possible, leading to a mix of the two
|
||||
approaches.
|
||||
|
||||
@item fit_mode
|
||||
Specify the content fit strategy according to a list of predefined modes.
|
||||
Determines how the input image is to be placed inside the destination crop
|
||||
rectangle (as defined by @code{pos_x/y} and @code{pos_w/h}). The names and
|
||||
their implementations are taken from the CSS 'object-fit' property. Note that
|
||||
this option is mutually exclusive with @option{normalize_sar}. Defaults to
|
||||
@code{fill}. Valid values are:
|
||||
|
||||
@table @samp
|
||||
@item fill
|
||||
Stretch the input to the output rectangle, ignoring aspect ratio mismatches.
|
||||
Note that unless @option{reset_sar} is also enabled, the output will still
|
||||
have the correct pixel aspect ratio tagged.
|
||||
|
||||
@item contain
|
||||
Scale the input to fit inside the output, preserving aspect ratio by padding.
|
||||
Equivalent to @option{normalize_sar} with @option{pad_crop_ratio} set to
|
||||
@code{0.0}.
|
||||
|
||||
@item cover
|
||||
Scale the input to fill the output, preserving aspect ratio by cropping.
|
||||
Equivalent to @option{normalize_sar} with @option{pad_crop_ratio} set to
|
||||
@code{1.0}.
|
||||
|
||||
@item none, place
|
||||
Don't scale the input. The input will be placed inside the output rectangle at
|
||||
its natural size; which may result in additional padding or cropping.
|
||||
|
||||
@item scale_down
|
||||
Scale the input down as much as needed to fit inside the output. Equivalent
|
||||
to either @code{contain} or @code{none}, depending on whether the input is
|
||||
larger than the output or not.
|
||||
@end table
|
||||
|
||||
@item fillcolor
|
||||
Set the color used to fill the output area not covered by the output image, for
|
||||
example as a result of @option{normalize_sar}. For the general syntax of this
|
||||
|
||||
Reference in New Issue
Block a user