textoverlay

textoverlay — Adds text strings on top of a video buffer

Synopsis




            GstTextOverlay;

Object Hierarchy


  GObject
   +----GstObject
         +----GstElement
               +----GstTextOverlay
                     +----GstTimeOverlay
                     +----GstClockOverlay

Properties


  "deltax"               gint                  : Write
  "deltay"               gint                  : Write
  "font-desc"            gchararray            : Write
  "halign"               gchararray            : Write
  "shaded-background"    gboolean              : Write
  "text"                 gchararray            : Write
  "valign"               gchararray            : Write
  "wrap-mode"            gchararray            : Write
  "xpad"                 gint                  : Write
  "ypad"                 gint                  : Write

Description

This plugin renders text on top of a video stream. This can be either static text or text from buffers received on the text sink pad, e.g. as produced by the subparse element. If the text sink pad is not linked, the text set via the "text" property will be rendered. If the text sink pad is linked, text will be rendered as it is received on that pad, honouring and matching the buffer timestamps of both input streams.

The text can contain newline characters and text wrapping is enabled by default.

Here is a simple pipeline that displays a static text in the top left corner of the video picture:

gst-launch -v videotestsrc ! textoverlay text="Room A" valign=top halign=left ! xvimagesink

Here is another pipeline that displays subtitles from an .srt subtitle file, centered at the bottom of the picture and with a rectangular shading around the text in the background:

gst-launch -v filesrc location=subtitles.srt ! subparse ! txt.   videotestsrc ! timeoverlay ! textoverlay name=txt shaded-background=yes ! xvimagesink

If you do not have such a subtitle file, create one looking like this in a text editor:

1
00:00:03,000 --> 00:00:05,000
Hello? (3-5s)

2
00:00:08,000 --> 00:00:13,000
Yes, this is a subtitle. Don't
you like it? (8-13s)

3
00:00:18,826 --> 00:01:02,886
Uh? What are you talking about?
I don't understand  (18-62s)

Element Information

plugin pango
author David Schleef <ds@schleef.org>
class Filter/Editor/Video

Details

GstTextOverlay

typedef struct _GstTextOverlay GstTextOverlay;

Properties

The "deltax" property

  "deltax"               gint                  : Write

Shift X position to the left or to the right. Unit is pixels.

Default value: 0


The "deltay" property

  "deltay"               gint                  : Write

Shift Y position up or down. Unit is pixels.

Default value: 0


The "font-desc" property

  "font-desc"            gchararray            : Write

Pango font description of font to be used for rendering. See documentation of pango_font_description_from_string for syntax.

Default value: ""


The "halign" property

  "halign"               gchararray            : Write

Horizontal alignment of the text. Can be either 'left', 'right', or 'center'.

Default value: "center"


The "shaded-background" property

  "shaded-background"    gboolean              : Write

Whether to shade the background under the text area.

Default value: FALSE


The "text" property

  "text"                 gchararray            : Write

Text to be display.

Default value: ""


The "valign" property

  "valign"               gchararray            : Write

Vertical alignment of the text. Can be either 'baseline', 'bottom', or 'top'.

Default value: "baseline"


The "wrap-mode" property

  "wrap-mode"            gchararray            : Write

Whether to wrap the text and if so how.Can be either 'none', 'word', 'char' or 'wordchar'.

Default value: "wordchar"


The "xpad" property

  "xpad"                 gint                  : Write

Horizontal paddding when using left/right alignment.

Allowed values: >= 0

Default value: 25


The "ypad" property

  "ypad"                 gint                  : Write

Vertical padding when using top/bottom alignment.

Allowed values: >= 0

Default value: 25

See Also

GstTextRender, GstClockOverlay, GstTimeOverlay, GstSubParse