videobox
This plugin crops or enlarges the image. It takes 4 values as input, a top, bottom, left and right offset. Positive values will crop that much pixels from the respective border of the image, negative values will add that much pixels. When pixels are added, you can specify their color. Some predefined colors are usable with an enum property.
The plugin is alpha channel aware and will try to negotiate with a format that supports alpha channels first. When alpha channel is active two other properties, alpha and border_alpha can be used to set the alpha values of the inner picture and the border respectively. an alpha value of 0.0 means total transparency, 1.0 is opaque.
The videobox plugin has many uses such as doing a mosaic of pictures, letterboxing video, cutting out pieces of video, picture in picture, etc..
Setting autocrop to true changes the behavior of the plugin so that caps determine crop properties rather than the other way around: given input and output dimensions, the crop values are selected so that the smaller frame is effectively centered in the larger frame. This involves either cropping or padding.
If you use autocrop there is little point in setting the other properties manually because they will be overridden if the caps change, but nothing stops you from doing so.
Sample pipeline:
gst-launch-1.0 videotestsrc ! videobox autocrop=true ! \
"video/x-raw, width=600, height=400" ! videoconvert ! ximagesink
Hierarchy
GObject ╰──GInitiallyUnowned ╰──GstObject ╰──GstElement ╰──GstBaseTransform ╰──GstVideoFilter ╰──videobox
Factory details
Authors: – Wim Taymans
Classification: – Filter/Effect/Video
Rank – none
Plugin – videobox
Package – GStreamer Good Plug-ins
Pad Templates
sink
video/x-raw:
format: { AYUV, ARGB, BGRA, ABGR, RGBA, xRGB, BGRx, xBGR, RGBx, RGB, BGR, Y444, Y42B, YUY2, YVYU, UYVY, I420, YV12, Y41B, GRAY8, GRAY16_BE, GRAY16_LE }
width: [ 1, 2147483647 ]
height: [ 1, 2147483647 ]
framerate: [ 0/1, 2147483647/1 ]
src
video/x-raw:
format: { AYUV, ARGB, BGRA, ABGR, RGBA, xRGB, BGRx, xBGR, RGBx, RGB, BGR, Y444, Y42B, YUY2, YVYU, UYVY, I420, YV12, Y41B, GRAY8, GRAY16_BE, GRAY16_LE }
width: [ 1, 2147483647 ]
height: [ 1, 2147483647 ]
framerate: [ 0/1, 2147483647/1 ]
Properties
autocrop
“autocrop” gboolean
If set to TRUE videobox will automatically crop/pad the input video to be centered in the output.
Flags : Read / Write
Default value : false
border-alpha
“border-alpha” gdouble
Alpha value of the border
Flags : Read / Write
Default value : 1
bottom
“bottom” gint
Pixels to box at bottom (<0 = add a border)
Flags : Read / Write
Default value : 0
fill
“fill” GstVideoBoxFill *
How to fill the borders
Flags : Read / Write
Default value : black (0)
right
“right” gint
Pixels to box at right (<0 = add a border)
Flags : Read / Write
Default value : 0
Named constants
GstVideoBoxFill
Members
black
(0) – Black
green
(1) – Green
blue
(2) – Blue
red
(3) – Red
yellow
(4) – Yellow
white
(5) – White
The results of the search are