textoverlay stability issue

Peter Biro pettair at gmail.com
Wed May 12 06:54:14 UTC 2021

Hi all,

We are using textoverlay in our pipeline to dynamically update text on a camera feed. It is not the optimal way to do this since it introduces a very high CPU overhead (without the text overlay it uses ~20% with the overlay its ~60% in 1080p at 30fps) but there were no other big CPU users so it was not crucial. 

After 6-8 hours of operation we see that the stream is stopped and the CPU usage of the pipeline drops to 1% of CPU.

Our pipeline:
nvarguscamerasrc sensor-id=0 sensor-mode=0 gainrange="1 16" ispdigitalgainrange="1 1"
        ! video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)NV12, framerate=(fraction)30/1
        ! nvvidconv ! textoverlay name=text_overlay ! video/x-raw,format=I420 
        ! nvvidconv ! nvv4l2vp8enc bitrate=8000000 control-rate=1 ! rtpvp8pay mtu=1400 ! udpsink auto-multicast=true clients=<DCL_UDP_SINK_CLIENTS>

We tried to debug it in:
info log we dont have any printouts (unfortunately we are not able to set the debug level higher since logs would fill up the disk)
we added the 'silent=false' option to 'nvarguscamerasrc' to verify that frames still arriving from the camera but they do
did some exploratory testing to remove elements from the pipeline and if we remove the textoverlay the issue is not happening

This is how I get a reference to the overlay and set it up:

    textOverlay = gst_bin_get_by_name(GST_BIN(pipelineElement), getName().c_str());


        "font-desc", FONT_TYPE.c_str(),
        "shaded-background", true,
        "shading-value", 40,
        "xpos", 0.0,
        "ypos", 0.0,
        "wrap-mode", -1,
        "halignment", /* position */ 0,
        "valignment", /* position */ 3,

and this is how I update the text on it from a thread:

            g_object_set(textOverlay, "text", firstLine.c_str(), NULL);

After each cycle I call 'clear' on the string to empty the previous content.

Also after each update we sleep the thread for 0.3 seconds, we tried to play around with the refresh rate but it does not seem to have any effect.

Do you have any idea what can cause this? What I am doing wrong here? Or any suggestions how could we debug it further?

Thanks for your help!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20210512/cf4f7bdc/attachment-0001.htm>

More information about the gstreamer-devel mailing list