videobox

videobox — Resizes a video by adding borders or cropping

Properties

gdouble alpha Read / Write
gdouble border-alpha Read / Write
gint bottom Read / Write
GstVideoBoxFill fill Read / Write
gint left Read / Write
gint right Read / Write
gint top Read / Write
gboolean autocrop Read / Write

Types and Values

struct GstVideoBox

Object Hierarchy

    GObject
    ╰── GInitiallyUnowned
        ╰── GstObject
            ╰── GstElement
                ╰── GstBaseTransform
                    ╰── GstVideoFilter
                        ╰── GstVideoBox

Description

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 overriden if the caps change, but nothing stops you from doing so.

Sample pipeline:

1
2
gst-launch-1.0 videotestsrc ! videobox autocrop=true ! \
  "video/x-raw, width=600, height=400" ! videoconvert ! ximagesink

Functions

Types and Values

struct GstVideoBox

struct GstVideoBox;

Property Details

The “alpha” property

  “alpha”                    gdouble

Alpha value picture.

Flags: Read / Write

Allowed values: [0,1]

Default value: 1


The “border-alpha” property

  “border-alpha”             gdouble

Alpha value of the border.

Flags: Read / Write

Allowed values: [0,1]

Default value: 1


The “bottom” property

  “bottom”                   gint

Pixels to box at bottom (<0 = add a border).

Flags: Read / Write

Default value: 0


The “fill” property

  “fill”                     GstVideoBoxFill

How to fill the borders.

Flags: Read / Write

Default value: Black


The “left” property

  “left”                     gint

Pixels to box at left (<0 = add a border).

Flags: Read / Write

Default value: 0


The “right” property

  “right”                    gint

Pixels to box at right (<0 = add a border).

Flags: Read / Write

Default value: 0


The “top” property

  “top”                      gint

Pixels to box at top (<0 = add a border).

Flags: Read / Write

Default value: 0


The “autocrop” property

  “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

See Also

GstVideoCrop