View Source Membrane.FFmpeg.SWScale.Scaler (Membrane FFmpeg SWScale plugin v0.7.0)
This element performs video scaling, using SWScale module of FFmpeg library.
There are two options that have to be specified when creating Scaler:
output_width
- desired scaled video width.output_height
- desired scaled video height.
Both need to be even numbers.
Scaling consists of two operations:
- scaling itself - resizing video frame with keeping original ratio. After that operation at least one of the dimensions of the input frame match the respective dimension of the desired output size. The second one (if does not match) is smaller than its respective dimension.
- adding paddings - if one dimension does not match after scaling, paddings have to be added. They are put on both sides of the scaled frame equally. They are either above and below the frame or on the left and right sides of it. It depends on the dimension that did not match after scaling.
Scaler needs input in the YUV420p format, processes one frame at a time and requires getting caps with input video
width and height. To meet all requirements either Membrane.Element.RawVideo.Parser
or some decoder
(e.g. Membrane.H264.FFmpeg.Decoder
) have to precede Scaler in the pipeline.
The output of the element is also in the YUV420p format. It has the size as specified in the options. All caps except for width and height are passed unchanged to the next element in the pipeline.
element-options
Element options
Passed via struct Membrane.FFmpeg.SWScale.Scaler.t/0
output_width
any
Required
Width of the scaled video.output_height
any
Required
Height of the scaled video.use_shm?
boolean
Default value:
false
pads
Pads
input
:input
Availability | :always |
Caps | Membrane.RawVideo , restrictions:pixel_format: :I420 ,aligned: true |
Demand mode | :auto |
Demand unit | :buffers |
Direction | :input |
Mode | :pull |
Name | :input |
output
:output
Availability | :always |
Caps | Membrane.RawVideo , restrictions:pixel_format: :I420 ,aligned: true |
Demand mode | :auto |
Demand unit | :buffers |
Direction | :output |
Mode | :pull |
Name | :output |
Link to this section Summary
Types
Struct containing options for Membrane.FFmpeg.SWScale.Scaler
Functions
Returns pads descriptions for Membrane.FFmpeg.SWScale.Scaler
Returns description of options available for this module
Link to this section Types
Specs
t() :: %Membrane.FFmpeg.SWScale.Scaler{ output_height: any(), output_width: any(), use_shm?: boolean() }
Struct containing options for Membrane.FFmpeg.SWScale.Scaler
Link to this section Functions
Specs
membrane_pads() :: [{Membrane.Pad.name_t(), Membrane.Pad.description_t()}]
Returns pads descriptions for Membrane.FFmpeg.SWScale.Scaler
Specs
options() :: keyword()
Returns description of options available for this module