textoverlay

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.

Example launch lines

 gst-launch-1.0 -v videotestsrc ! textoverlay text="Room A" valignment=top halignment=left font-desc="Sans, 72" ! autovideosink

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

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

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:

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)

Hierarchy

GObject
    ╰──GInitiallyUnowned
        ╰──GstObject
            ╰──GstElement
                ╰──GstBaseTextOverlay
                    ╰──textoverlay

Factory details

Authors: – David Schleef , Zeeshan Ali

Classification:Filter/Editor/Video

Rank – none

Plugin – gstpango

Package – GStreamer Base Plug-ins git

Pad Templates

src

video/x-raw:
         format: { BGRx, RGBx, xRGB, xBGR, RGBA, BGRA, ARGB, ABGR, RGB, BGR, I420, YV12, AYUV, YUY2, UYVY, v308, Y41B, Y42B, Y444, NV12, NV21, A420, YUV9, YVU9, IYU1, GRAY8 }
          width: [ 1, 2147483647 ]
         height: [ 1, 2147483647 ]
      framerate: [ 0/1, 2147483647/1 ]

video/x-raw(ANY):
         format: { I420, YV12, YUY2, UYVY, AYUV, VUYA, RGBx, BGRx, xRGB, xBGR, RGBA, BGRA, ARGB, ABGR, RGB, BGR, Y41B, Y42B, YVYU, Y444, v210, v216, Y210, Y410, NV12, NV21, GRAY8, GRAY16_BE, GRAY16_LE, v308, RGB16, BGR16, RGB15, BGR15, UYVP, A420, RGB8P, YUV9, YVU9, IYU1, ARGB64, AYUV64, r210, I420_10BE, I420_10LE, I422_10BE, I422_10LE, Y444_10BE, Y444_10LE, GBR, GBR_10BE, GBR_10LE, NV16, NV24, NV12_64Z32, A420_10BE, A420_10LE, A422_10BE, A422_10LE, A444_10BE, A444_10LE, NV61, P010_10BE, P010_10LE, IYU2, VYUY, GBRA, GBRA_10BE, GBRA_10LE, BGR10A2_LE, RGB10A2_LE, GBR_12BE, GBR_12LE, GBRA_12BE, GBRA_12LE, I420_12BE, I420_12LE, I422_12BE, I422_12LE, Y444_12BE, Y444_12LE, GRAY10_LE32, NV12_10LE32, NV16_10LE32, NV12_10LE40 }
          width: [ 1, 2147483647 ]
         height: [ 1, 2147483647 ]
      framerate: [ 0/1, 2147483647/1 ]

Presencealways

Directionsrc


text_sink

text/x-raw:
         format: { pango-markup, utf8 }

Presencealways

Directionsink


video_sink

video/x-raw:
         format: { BGRx, RGBx, xRGB, xBGR, RGBA, BGRA, ARGB, ABGR, RGB, BGR, I420, YV12, AYUV, YUY2, UYVY, v308, Y41B, Y42B, Y444, NV12, NV21, A420, YUV9, YVU9, IYU1, GRAY8 }
          width: [ 1, 2147483647 ]
         height: [ 1, 2147483647 ]
      framerate: [ 0/1, 2147483647/1 ]

video/x-raw(ANY):
         format: { I420, YV12, YUY2, UYVY, AYUV, VUYA, RGBx, BGRx, xRGB, xBGR, RGBA, BGRA, ARGB, ABGR, RGB, BGR, Y41B, Y42B, YVYU, Y444, v210, v216, Y210, Y410, NV12, NV21, GRAY8, GRAY16_BE, GRAY16_LE, v308, RGB16, BGR16, RGB15, BGR15, UYVP, A420, RGB8P, YUV9, YVU9, IYU1, ARGB64, AYUV64, r210, I420_10BE, I420_10LE, I422_10BE, I422_10LE, Y444_10BE, Y444_10LE, GBR, GBR_10BE, GBR_10LE, NV16, NV24, NV12_64Z32, A420_10BE, A420_10LE, A422_10BE, A422_10LE, A444_10BE, A444_10LE, NV61, P010_10BE, P010_10LE, IYU2, VYUY, GBRA, GBRA_10BE, GBRA_10LE, BGR10A2_LE, RGB10A2_LE, GBR_12BE, GBR_12LE, GBRA_12BE, GBRA_12LE, I420_12BE, I420_12LE, I422_12BE, I422_12LE, Y444_12BE, Y444_12LE, GRAY10_LE32, NV12_10LE32, NV16_10LE32, NV12_10LE40 }
          width: [ 1, 2147483647 ]
         height: [ 1, 2147483647 ]
      framerate: [ 0/1, 2147483647/1 ]

Presencealways

Directionsink


Properties

auto-resize

“auto-resize” gboolean *

Automatically adjust font size to screen-size.

Flags : Read / Write

Default value : true


color

“color” guint *

Color to use for text (big-endian ARGB).

Flags : Read / Write

Default value : -1


deltax

“deltax” gint *

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

Flags : Read / Write

Default value : 0


deltay

“deltay” gint *

Shift Y position up or down. Unit is pixels.

Flags : Read / Write

Default value : 0


draw-outline

“draw-outline” gboolean *

Whether to draw outline

Flags : Read / Write

Default value : true


draw-shadow

“draw-shadow” gboolean *

Whether to draw shadow

Flags : Read / Write

Default value : true


font-desc

“font-desc” gchararray *

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

Flags : Read / Write


halignment

“halignment” Base-text-overlay-halign

Horizontal alignment of the text

Flags : Read / Write

Default value : center (1)


line-alignment

“line-alignment” Base-text-overlay-line-align

Alignment of text lines relative to each other.

Flags : Read / Write

Default value : center (1)


name

“name” gchararray *

The name of the object

Flags : Read / Write / Construct

Default value : NULL


outline-color

“outline-color” guint *

Color of the outline of the rendered text.

Flags : Read / Write

Default value : -16777216


parent

“parent” GstObject *

The parent of the object

Flags : Read / Write


scale-mode

“scale-mode” Base-text-overlay-scale-mode

Scale text to compensate for and avoid distortion by subsequent video scaling.

Flags : Read / Write

Default value : none (0)


scale-pixel-aspect-ratio

“scale-pixel-aspect-ratio” GstFraction*

Pixel aspect ratio of video scale to compensate for in user scale-mode

Flags : Read / Write

Default value : 1/1


shaded-background

“shaded-background” gboolean *

Whether to shade the background under the text area

Flags : Read / Write

Default value : false


shading-value

“shading-value” guint *

Shading value to apply if shaded-background is true

Flags : Read / Write

Default value : 80


silent

“silent” gboolean *

Whether to render the text string

Flags : Read / Write

Default value : false


text

“text” gchararray *

Text to be display.

Flags : Read / Write


text-height

“text-height” guint *

Resulting height of font rendering

Flags : Read

Default value : 1


text-width

“text-width” guint *

Resulting width of font rendering

Flags : Read

Default value : 1


text-x

“text-x” gint *

Resulting X position of font rendering.

Flags : Read

Default value : 0


text-y

“text-y” gint *

Resulting X position of font rendering.

Flags : Read

Default value : 0


valignment

“valignment” Base-text-overlay-valign

Vertical alignment of the text

Flags : Read / Write

Default value : baseline (0)


vertical-render

“vertical-render” gboolean *

Vertical Render.

Flags : Read / Write

Default value : false


wait-text

“wait-text” gboolean *

Whether to wait for subtitles

Flags : Read / Write

Default value : true


wrap-mode

“wrap-mode” Base-text-overlay-wrap-mode

Whether to wrap the text and if so how.

Flags : Read / Write

Default value : wordchar (2)


x-absolute

“x-absolute” gdouble *

Horizontal position when using absolute alignment

Flags : Read / Write

Default value : 0.5


xpad

“xpad” gint *

Horizontal paddding when using left/right alignment

Flags : Read / Write

Default value : 25


xpos

“xpos” gdouble *

Horizontal position when using clamped position alignment

Flags : Read / Write

Default value : 0.5


y-absolute

“y-absolute” gdouble *

Vertical position when using absolute alignment

Flags : Read / Write

Default value : 0.5


ypad

“ypad” gint *

Vertical padding when using top/bottom alignment

Flags : Read / Write

Default value : 25


ypos

“ypos” gdouble *

Vertical position when using clamped position alignment

Flags : Read / Write

Default value : 0.5


Named constants

Base-text-overlay-halign

Members

left (0) – left
center (1) – center
right (2) – right
Absolute position clamped to canvas (4) – position
Absolute position (5) – absolute

Base-text-overlay-line-align

Members

left (0) – left
center (1) – center
right (2) – right

Base-text-overlay-scale-mode

Members

none (0) – none
par (1) – par
display (2) – display
user (3) – user

Base-text-overlay-valign

Members

baseline (0) – baseline
bottom (1) – bottom
top (2) – top
Absolute position clamped to canvas (3) – position
center (4) – center
Absolute position (5) – absolute

Base-text-overlay-wrap-mode

Members

none (-1) – none
word (0) – word
char (1) – char
wordchar (2) – wordchar

The results of the search are