compositor

Compositor can accept AYUV, VUYA, ARGB and BGRA video streams. For each of the requested sink pads it will compare the incoming geometry and framerate to define the output parameters. Indeed output video frames will have the geometry of the biggest incoming video stream and the framerate of the fastest incoming one.

Compositor will do colorspace conversion.

Individual parameters for each input stream can be configured on the GstCompositorPad:

  • "xpos": The x-coordinate position of the top-left corner of the picture (#gint)
  • "ypos": The y-coordinate position of the top-left corner of the picture (#gint)
  • "width": The width of the picture; the input will be scaled if necessary (#gint)
  • "height": The height of the picture; the input will be scaled if necessary (#gint)
  • "alpha": The transparency of the picture; between 0.0 and 1.0. The blending is a simple copy when fully-transparent (0.0) and fully-opaque (1.0). (#gdouble)
  • "zorder": The z-order position of the picture in the composition (#guint)

Sample pipelines

 gst-launch-1.0 \
   videotestsrc pattern=1 ! \
   video/x-raw,format=AYUV,framerate=\(fraction\)10/1,width=100,height=100 ! \
   videobox border-alpha=0 top=-70 bottom=-70 right=-220 ! \
   compositor name=comp sink_0::alpha=0.7 sink_1::alpha=0.5 ! \
   videoconvert ! xvimagesink \
   videotestsrc ! \
   video/x-raw,format=AYUV,framerate=\(fraction\)5/1,width=320,height=240 ! comp.

A pipeline to demonstrate compositor used together with videobox. This should show a 320x240 pixels video test source with some transparency showing the background checker pattern. Another video test source with just the snow pattern of 100x100 pixels is overlaid on top of the first one on the left vertically centered with a small transparency showing the first video test source behind and the checker pattern under it. Note that the framerate of the output video is 10 frames per second.

 gst-launch-1.0 videotestsrc pattern=1 ! \
   video/x-raw, framerate=\(fraction\)10/1, width=100, height=100 ! \
   compositor name=comp ! videoconvert ! ximagesink \
   videotestsrc !  \
   video/x-raw, framerate=\(fraction\)5/1, width=320, height=240 ! comp.

A pipeline to demonstrate bgra comping. (This does not demonstrate alpha blending).

 gst-launch-1.0 videotestsrc pattern=1 ! \
   video/x-raw,format =I420, framerate=\(fraction\)10/1, width=100, height=100 ! \
   compositor name=comp ! videoconvert ! ximagesink \
   videotestsrc ! \
   video/x-raw,format=I420, framerate=\(fraction\)5/1, width=320, height=240 ! comp.

A pipeline to test I420

 gst-launch-1.0 compositor name=comp sink_1::alpha=0.5 sink_1::xpos=50 sink_1::ypos=50 ! \
   videoconvert ! ximagesink \
   videotestsrc pattern=snow timestamp-offset=3000000000 ! \
   "video/x-raw,format=AYUV,width=640,height=480,framerate=(fraction)30/1" ! \
   timeoverlay ! queue2 ! comp. \
   videotestsrc pattern=smpte ! \
   "video/x-raw,format=AYUV,width=800,height=600,framerate=(fraction)10/1" ! \
   timeoverlay ! queue2 ! comp.

A pipeline to demonstrate synchronized compositing (the second stream starts after 3 seconds)

Hierarchy

GObject
    ╰──GInitiallyUnowned
        ╰──GstObject
            ╰──GstElement
                ╰──GstAggregator
                    ╰──GstVideoAggregator
                        ╰──compositor

Implemented interfaces

Factory details

Authors: – Wim Taymans , Sebastian Dröge

Classification:Filter/Editor/Video/Compositor

Rank – primary + 1

Plugin – compositor

Package – GStreamer Base Plug-ins

Pad Templates

sink_%u

video/x-raw:
         format: { A444_16LE, A444_16BE, AYUV64, RGBA64_LE, ARGB64, ARGB64_LE, BGRA64_LE, ABGR64_LE, RGBA64_BE, ARGB64_BE, BGRA64_BE, ABGR64_BE, A422_16LE, A422_16BE, A420_16LE, A420_16BE, A444_12LE, GBRA_12LE, A444_12BE, GBRA_12BE, Y412_LE, Y412_BE, A422_12LE, A422_12BE, A420_12LE, A420_12BE, A444_10LE, GBRA_10LE, A444_10BE, GBRA_10BE, A422_10LE, A422_10BE, A420_10LE, A420_10BE, BGR10A2_LE, RGB10A2_LE, Y410, A444, GBRA, AYUV, VUYA, RGBA, RBGA, ARGB, BGRA, ABGR, A422, A420, AV12, Y444_16LE, GBR_16LE, Y444_16BE, GBR_16BE, v216, P016_LE, P016_BE, Y444_12LE, GBR_12LE, Y444_12BE, GBR_12BE, I422_12LE, I422_12BE, Y212_LE, Y212_BE, I420_12LE, I420_12BE, P012_LE, P012_BE, Y444_10LE, GBR_10LE, Y444_10BE, GBR_10BE, r210, I422_10LE, I422_10BE, NV16_10LE32, Y210, UYVP, v210, I420_10LE, I420_10BE, P010_10LE, NV12_10LE40, NV12_10LE32, P010_10BE, MT2110R, MT2110T, NV12_10BE_8L128, NV12_10LE40_4L4, Y444, BGRP, GBR, RGBP, NV24, v308, IYU2, RGBx, xRGB, BGRx, xBGR, RGB, BGR, Y42B, NV16, NV61, YUY2, YVYU, UYVY, VYUY, I420, YV12, NV12, NV21, NV12_16L32S, NV12_32L32, NV12_4L4, NV12_64Z32, NV12_8L128, Y41B, IYU1, YUV9, YVU9, BGR16, RGB16, BGR15, RGB15, RGB8P, GRAY16_LE, GRAY16_BE, GRAY10_LE32, GRAY8 }
          width: [ 1, 2147483647 ]
         height: [ 1, 2147483647 ]
      framerate: [ 0/1, 2147483647/1 ]

Presencerequest

Directionsink

Object typeGstCompositorPad


src

video/x-raw:
         format: { A444_16LE, A444_16BE, AYUV64, RGBA64_LE, ARGB64, ARGB64_LE, BGRA64_LE, ABGR64_LE, RGBA64_BE, ARGB64_BE, BGRA64_BE, ABGR64_BE, A422_16LE, A422_16BE, A420_16LE, A420_16BE, A444_12LE, GBRA_12LE, A444_12BE, GBRA_12BE, Y412_LE, Y412_BE, A422_12LE, A422_12BE, A420_12LE, A420_12BE, A444_10LE, GBRA_10LE, A444_10BE, GBRA_10BE, A422_10LE, A422_10BE, A420_10LE, A420_10BE, BGR10A2_LE, RGB10A2_LE, Y410, A444, GBRA, AYUV, VUYA, RGBA, RBGA, ARGB, BGRA, ABGR, A422, A420, AV12, Y444_16LE, GBR_16LE, Y444_16BE, GBR_16BE, v216, P016_LE, P016_BE, Y444_12LE, GBR_12LE, Y444_12BE, GBR_12BE, I422_12LE, I422_12BE, Y212_LE, Y212_BE, I420_12LE, I420_12BE, P012_LE, P012_BE, Y444_10LE, GBR_10LE, Y444_10BE, GBR_10BE, r210, I422_10LE, I422_10BE, NV16_10LE32, Y210, UYVP, v210, I420_10LE, I420_10BE, P010_10LE, NV12_10LE40, NV12_10LE32, P010_10BE, MT2110R, MT2110T, NV12_10BE_8L128, NV12_10LE40_4L4, Y444, BGRP, GBR, RGBP, NV24, v308, IYU2, RGBx, xRGB, BGRx, xBGR, RGB, BGR, Y42B, NV16, NV61, YUY2, YVYU, UYVY, VYUY, I420, YV12, NV12, NV21, NV12_16L32S, NV12_32L32, NV12_4L4, NV12_64Z32, NV12_8L128, Y41B, IYU1, YUV9, YVU9, BGR16, RGB16, BGR15, RGB15, RGB8P, GRAY16_LE, GRAY16_BE, GRAY10_LE32, GRAY8 }
          width: [ 1, 2147483647 ]
         height: [ 1, 2147483647 ]
      framerate: [ 0/1, 2147483647/1 ]

Presencealways

Directionsrc

Object typeGstAggregatorPad


Properties

background

“background” GstCompositorBackground *

Background type

Flags : Read / Write

Default value : checker (0)


ignore-inactive-pads

“ignore-inactive-pads” gboolean

Don't wait for inactive pads when live. An inactive pad is a pad that hasn't yet received a buffer, but that has been waited on at least once.

The purpose of this property is to avoid aggregating on timeout when new pads are requested in advance of receiving data flow, for example the user may decide to connect it later, but wants to configure it already.

Flags : Read / Write

Default value : false

Since : 1.20


max-threads

“max-threads” guint

Maximum number of blending/rendering worker threads to spawn (0 = auto)

Flags : Read / Write

Default value : 0

Since : 1.20


zero-size-is-unscaled

“zero-size-is-unscaled” gboolean

Whether a pad with height or width 0 should be left unscaled in that dimension, or simply not composited in. Setting it to FALSE might be useful when animating those properties.

Flags : Read / Write

Default value : true

Since : 1.20


Named constants

GstCompositorBackground

The different backgrounds compositor can blend over.

Members

checker (0) – Checker pattern
black (1) – Black
white (2) – White
transparent (3) – Transparent Background to enable further compositing

GstCompositorPad

GObject
    ╰──GInitiallyUnowned
        ╰──GstObject
            ╰──GstPad
                ╰──GstAggregatorPad
                    ╰──GstVideoAggregatorPad
                        ╰──GstVideoAggregatorConvertPad
                            ╰──GstVideoAggregatorParallelConvertPad
                                ╰──GstCompositorPad

The opaque GstCompositorPad structure.


Properties

alpha

“alpha” gdouble

Alpha of the picture

Flags : Read / Write

Default value : 1


height

“height” gint

Height of the picture

Flags : Read / Write

Default value : -1


operator

“operator” GstCompositorOperator *

Blending operator to use for blending this pad over the previous ones

Flags : Read / Write

Default value : over (1)


sizing-policy

“sizing-policy” Compositor-sizing-policy *

Specifies sizing policy to use. Depending on selected sizing policy, scaled image might not fully cover the configured target rectangle area (e.g., "keep-aspect-ratio"). In that case, any uncovered area will be filled with background unless the uncovered area is drawn by other image.

Flags : Read / Write

Default value : none (0)

Since : 1.20


width

“width” gint

Width of the picture

Flags : Read / Write

Default value : -1


xpos

“xpos” gint

X Position of the picture

Flags : Read / Write

Default value : 0


ypos

“ypos” gint

Y Position of the picture

Flags : Read / Write

Default value : 0


Named constants

GstCompositorOperator

The different blending operators that can be used by compositor.

See https://www.cairographics.org/operators/ for some explanation and visualizations.

Members
source (0) – Source
over (1) – Over
add (2) – Add

Compositor-sizing-policy

Members
none (0) – None: Image is scaled to fill configured destination rectangle without padding or keeping the aspect ratio
keep-aspect-ratio (1) – Keep Aspect Ratio: Image is scaled to fit destination rectangle specified by GstCompositorPad:{xpos, ypos, width, height} with preserved aspect ratio. Resulting image will be centered in the destination rectangle with padding if necessary

Since : 1.20


The results of the search are