Request to add two new filters


#1

@shotcut

Would it be possible to add two new filters, from latest avfilter?
They are, fieldorder and fillborders.

fieldorder:

From the official documentation:

Transform the field order of the input video.
It accepts the following parameters:

order:

The output field order. Valid values are tff for top field first or bff for bottom field first.

The default value is ‘tff’.

The transformation is done by shifting the picture content up or down by one line,
and filling the remaining line with appropriate picture content.
This method is consistent with most broadcast field order converters.

If the input video is not flagged as being interlaced,
or it is already flagged as being of the required output field order,
then this filter does not alter the incoming video.
It is very useful when converting to or from PAL DV material, which is bottom field first.

fillborders

Fill borders of the input video, without changing video stream dimensions. Sometimes video can have garbage at the four edges and you may not want to crop video input to keep size multiple of some number.

This filter accepts the following options:

left: Number of pixels to fill from left border.

right: Number of pixels to fill from right border.

top: Number of pixels to fill from top border.

bottom: Number of pixels to fill from bottom border.

mode

Set fill mode.

It accepts the following values:

‘smear’: fill pixels using outermost pixels

‘mirror’: fill pixels using mirroring

‘fixed’: fill pixels with constant value

Default is smear.

color

Set color for pixels in fixed mode. Default is black.

This has several uses:

  1. Sometimes the video has rubbish on the edges, we want to get rid of it but keep the video’s dimensions unchanged so cropping is not an option.
    We even have an option of “mode”, i.e. a solid border or filling with copies of the outermost pixels.

  2. When using the BLUR filter, it adds a strange effect on the edges, not always acceptable.
    The fillborders filter can then be used to hide/mask this.

  3. Create a simple “drop shadow” effect.

  4. Can in it’s self be used as an extra blur/smear effect. Set top,bottom,left and right each to half of video’s dimensions and we get a strange blur/smear effect.

  5. Create a border on any (or all 4) sides of a video of any colour and width.

Hoping you give some consideration to these two filters, as I believe they could be useful.

Thanks.


#2

fieldorder

This is not needed. MLT has its own way to manage field order that is controlled by overriding the detected field order in Properties and/or setting a field order in Export.

fillborders

The next version has a new filter called Crop: Rectangle that does this but using not using libavfilter. Our version supports keyframes with sub-pixel rendering while filborders does neither. However, it lacks the different fill modes, but the fill color including alpha is a parameter.

When using the BLUR filter, it adds a strange effect on the edges,

There are new blur filters in the next version to remedy this.


#3

Perfect, thank you very much @shotcut