videobox

videobox — Resizes a video by adding borders or cropping

Synopsis

                    GstVideoBox;

Object Hierarchy

  GObject
   +----GstObject
         +----GstElement
               +----GstBaseTransform
                     +----GstVideoBox

Properties

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

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:

gst-launch videotestsrc ! videobox autocrop=true ! \
  "video/x-raw-yuv, width=600, height=400" ! ffmpegcolorspace ! ximagesink

Details

GstVideoBox

typedef struct _GstVideoBox GstVideoBox;

Property Details

The "alpha" property

  "alpha"                    gdouble               : Read / Write

Alpha value picture.

Allowed values: [0,1]

Default value: 1


The "border-alpha" property

  "border-alpha"             gdouble               : Read / Write

Alpha value of the border.

Allowed values: [0,1]

Default value: 1


The "bottom" property

  "bottom"                   gint                  : Read / Write

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

Default value: 0


The "fill" property

  "fill"                     GstVideoBoxFill       : Read / Write

How to fill the borders.

Default value: Black


The "left" property

  "left"                     gint                  : Read / Write

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

Default value: 0


The "right" property

  "right"                    gint                  : Read / Write

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

Default value: 0


The "top" property

  "top"                      gint                  : Read / Write

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

Default value: 0


The "autocrop" property

  "autocrop"                 gboolean              : Read / Write

If set to TRUE videobox will automatically crop/pad the input video to be centered in the output.

Default value: FALSE

Since 0.10.16

See Also

GstVideoCrop