Skip to content

Text overlays and brightness/hue/saturation

Text overlays

A text overlay is configured by passing a text overlay string containing the text and the overlay settings (width, height, font, etc...) as follows:

DatasteadRTSPConfig.SetStr(RTSP_VideoStream_ConfigureTextOverlay_str, OVERLAYSTRING);

E.g.:

DatasteadRTSPConfig.SetStr(RTSP_VideoStream_ConfigureTextOverlay_str, "|overlayid=1|text=Hello World!|fontsize=40|x=20|y=20|fontcolor=white");
  • the 1st character of the string is used as separator for all the parameters. In this example it is "|" (ASCII 124), but any other character that is not a letter or number can be used,
  • "overlayid" can specify any short string that is used to identify this text overlay. This identifier will be used by the filter to retrieve the overlay when updating it in real time while the filter is running,
  • THE OVERLAYS MUST BE SET BEFORE OPENING THE URL. If an overlay must not be displayed immediately, configure it with an empty string, then invoke the function again while the filter is running and pass the string to display,
  • passing an incorrect string syntax may crash the filter (e.g. wrong color name).

In the example below 2 overlays are defined at startup, and the 2nd is not displayed (empty string), then they are updated in real time while the filter is running:

  • before running the filter, invoke:
DatasteadRTSPConfig.SetStr(RTSP_VideoStream_ConfigureTextOverlay_str, "|overlayid=first|text=this is the first text displayed at startup|fontsize=40|x=20|y=20|fontcolor=white");
DatasteadRTSPConfig.SetStr(RTSP_VideoStream_ConfigureTextOverlay_str, "|overlayid=second|text=|fontsize=40|x=60|y=60|fontcolor=white");
  • then, later, while the filter is running, invoke:
DatasteadRTSPConfig.SetStr(RTSP_VideoStream_ConfigureTextOverlay_str, "|overlayid=first|text=now the 1st text is updated|fontsize=40|x=20|y=20|fontcolor=white");
DatasteadRTSPConfig.SetStr(RTSP_VideoStream_ConfigureTextOverlay_str, "|overlayid=second|text=now the 2nd text appears|fontsize=40|x=60|y=60|fontcolor=white");

Brightness / hue / saturation

These settings can be enabled as follows, e.g.:

DatasteadRTSPConfig.SetStr(RTSP_VideoStream_ConfigureHueBrightSat_str, "|b=1.4|s=1.5|h=180");

The 1st character of the string is used as separator for all the parameters. In this example it is "|" (ASCII 124), but any other character that is not a letter or number can be used.

  • brightness (b): in the -10..10 range (default 0),
  • hue (h): in degrees (default 0),
  • saturation (s): in the -10..10 range (default 1).

Note that the brightness/hue/saturation setting must be set BEFORE LOADING the URL to be activated.

To prevent it from being applied immediately, set the default value(s) (b=0, h=0, s=1), then update them when needed while the filter is running, e.g.:

  • before loading the URL:
DatasteadRTSPConfig.SetStr(RTSP_VideoStream_ConfigureHueBrightSat_str, "|b=0");
  • while the filter is running:
DatasteadRTSPConfig.SetStr(RTSP_VideoStream_ConfigureHueBrightSat_str, "|b=1.4");