nvoverlaysink background color


we are using the nvoverlaysink for fullscreen video output on differenct HDMI displays.
When the aspect ratio of the video content differs from the aspect ratio of the HDMI display parts of the Ubuntu desktop are visible since nvoverlaysink maintains the original aspect ratio.
So, how can I achieve having black borders instead of the desktop shining through ?


Please use nvcompositor along with nvoverlaysink.

$ gst-launch-1.0 videotestsrc ! nvvidconv ! 'video/x-raw(memory:NVMM)' ! queue ! nvcom. nvcompositor name=nvcom ! 'video/x-raw(memory:NVMM),width=1920,height=1080' ! nvoverlaysink

You can configure background color in nvcompositor.

Thank you for this suggestion. Functionality-wise that’s what I was looking for. Unfortunately, when using nvcompositor the CPU usage jumps from 25% up to 70% and also video latency seems to get worse. Are there any other approaches for achieving those black borders ?

The high CPU usage of using nvcompositor is known and fixed in upcoming r32.3. Are you able to wait for the release? Or you will stay in r32.2 for product completion?

Can you estimate when r32.3 will be released ?

It’s expected to be out of oven in December. We’re working hard on it.

Ok, thanks for the info. We will wait for it.


How about just opening a black fullscreen window, like so: (requires the python-gi-cairo package)

from gi.repository import Gtk, cairo  

def on_draw(da, ctx):
  alloc = da.get_allocation()
  ctx.rectangle(0,0, alloc.width, alloc.height)
  return True

win = Gtk.Window()
da = Gtk.DrawingArea()
da.connect("draw", on_draw)

We are using C instead of Python. I tried to create a full screen XWindow via XCreateSimpleWindow(), but without success so far. Anyway, thanks for your suggestion.

On r32.2.*, please try the prebuilt lib attached.
r32_2_TEST_libgstnvcompositor.zip (14.4 KB)

Hi DaneLLL,

thanks for providing us with the new nvcompositor version. CPU usage is very good now. Video latency is increased by approx. 10 ms.

For my tests I used the gst-launch command. Now I need to make nvcompositor work in our C application.
The tail part of my pipeline looks like … -> nvcompositor -> capsfilter -> nvoverlaysink. But still with the additional capsfilter I cannot force nvcompositor to output a screen filling format.
So, how can I set the nvcompositors destination width and height programatically ?


Have you tried g_object_set() like:

g_object_set (G_OBJECT (nvcompositor), "width", 1920, , "height", 1080, NULL);

Yes, I’ve tried that, but those properties don’t seem to be defined:

(nanocap:9069): GLib-GObject-WARNING **: 17:50:08.833: g_object_set_is_valid_property: object class 'GstNvCompositor' has no property named 'width'
(nanocap:9069): GLib-GObject-WARNING **: 17:50:08.834: g_object_set_is_valid_property: object class 'GstNvCompositor' has no property named 'height'

Is there an official documentation on the nvcompositor somewhere ?


Those are “Pad Properties”, so g_object_set shoud not be called on the element but on the elements sink pad in question.

Have a look on the documentation for the “normal” GstCompositor on how to set pad properties with gst-launch:


Also, use “gst-inspect-1.0” to see which properties / pad properties an element has.

Also note you could just copy a working “gst-launch-1.0” line into your application by using gst_parse_launch.

We have sample pipelines in gstreamer user guide for using plugins with hardware acceleration. However, all are launched through gst-launch-1.0.

Please check arne.caspari’s suggestion for C code programming.
Found a link which may also help:


thanks for your suggestions. Meanwhile we have found another solution. Instead of adding black borders we are cropping the source video by using the videocrop filter.