[FFmpeg-user] What is a "pad" in the context of an "input pad", an "output pad" and a "filter pad"

Clay Clay at FTL.com
Fri Oct 28 18:06:43 EEST 2022

> 36.39 apad
> Pad the end of an audio stream with silence.
> This can be used together with ffmpeg -shortest to extend audio
> streams to the same length as the video stream
> 39.181 pad
> Add paddings to the input image, and place the original input at the
> provided x, y coordinates.
> It accepts the following parameters: width, w height, h
> Specify an expression for the size of the output image with the
> paddings added. If the value for width or height is 0, the
> corresponding input size is used for the output.
> pad, p
> If set to 1, the filter will pad the last audio packet with silence,
> so that it will contain the same number of samples (or roughly the
> same number of samples, see frame_rate) as the previous ones. Default
> value is 1.
> first_pts
> For swr only, assume the first pts should be this value. The time unit
> is 1 / sample rate. This allows for padding/trimming at the start of
> stream. By default, no assumption is made about the first frame’s
> expected pts, so no padding or trimming is done
As previously indicated, padding audio or video is covered. 

I am referring to the logical and syntactical meaning as it relates to
filters/filterchains. This is a minor issue, I know. :-D

My question is simply: what is the definition of a "pad" in the context
of Chapter 32
[Thanks to Michael for the chapter callout!].  

Even in chapter 32, the meaning of "pad" is presumptive rather than
defined (note how, in 32.1, the "link label" is so clearly defined? 
This is what I am looking for):

32 Filtergraph description

A filtergraph is a directed graph of connected filters. It can contain
cycles, and there can be multiple links between a pair of filters.Each
link has one input pad on one side connecting it to one filter from
which it takes its input, and one output pad on the other side
connecting it to one filter accepting its output.

Each filter in a filtergraph is an instance of a filter class registered
in the application, which defines the features and the number ofinput
and output pads of the filter.

A filter with noinput padsis called a "source", and a filter with
nooutput pads is called a "sink".

32.1 Filtergraph syntax
The name and arguments of the filter are optionally preceded and
followed by a list of link labels.A link label allows one to name a link
and associate it to a filter output or input pad. The preceding labels
in_link_1 ... in_link_N, are associated to the filter input pads, the
following labels out_link_1 ... out_link_M, are associated to the output

When two link labels with the same name are found in the filtergraph, a
link between the corresponding input and output pad is created.

If an output pad is not labelled, it is linked by default to the first
unlabelled input pad of the next filter in the filterchain. For example
in the filterchain

nullsrc, split[L1], [L2]overlay, nullsink
the split filter instance has two output pads, and the overlay filter
instance two input pads. The first output pad of split is labelled "L1",
the first input pad of overlay is labelled "L2", and the second output
pad of split is linked to the second input pad of overlay, which are
both unlabelled.

In a filter description, if the input label of the first filter is not
specified, "in" is assumed; if the output label of the last filter is
not specified, "out" is assumed.

In a complete filterchain all the unlabelled filter input and output
pads must be connected. A filtergraph is considered valid if all the
filter input and output pads of all the filterchains are connected.

We know the definition of a Source (a filter with no input pads) and the
definition of a Sink (a filter with no output pads) but we still do not
have the definition of what a "pad" actually is.

Maybe something like this?:

A padis [here's where I am looking for help]a/an
tunnel-interface/connector/teleportation-endpoint [...?] used to apply
input to, or output from a filter, within a filtergraph or filterchain.

Pads may be called into being (established) by appending link labels to
filters. Pads are also established without link labels on the first
filter (assuming it to be an input pad) and on the last filter (assuming
it to be an output pad) within a filterchain.  

32.1 Filtergraph syntax
<https://www.ffmpeg.org/ffmpeg-all.html#toc-Filtergraph-syntax-1> does
an admirably good job of defining much of Filtergraph's relevant parts,
but it glosses over this bit.

More information about the ffmpeg-user mailing list