Different nvcompositor / compositor behaviour when trying to overlay transparent png logo

I need to overlay a transparent logo on a videostream.
With software compositor it works this way:
gst-launch-1.0 compositor name=mix sink_0::zorder=1 sink_1::alpha=1.0 sink_1::zorder=2 ! nvvidconv ! nvegltransform ! nveglglessink videotestsrc ! video/x-raw,format=RGBA,width=1920,height=1080 ! queue ! mix.sink_0 filesrc location=di-logo.png ! pngdec ! alphacolor ! video/x-raw,format=RGBA ! imagefreeze ! mix.sink_1
I get correct result but it loads the CPU heavy.
So I’d want to use the nvcompositor to offload:

gst-launch-1.0 \
nvcompositor name=mix sink_0::zorder=1 sink_1::alpha=1.0 sink_1::zorder=2 ! nvvidconv ! nvegltransform ! nveglglessink \
videotestsrc ! video/x-raw,format=RGBA,width=1280,height=720 ! nvvidconv ! queue ! mix.sink_0 \
filesrc location=di-logo.png ! pngdec ! alphacolor ! video/x-raw,format=RGBA ! imagefreeze ! nvvidconv ! mix.sink_1

But with nvcompositor the png renders with square black background around it instead of being transparent. So this is different/unexpected behavior.
Is there a way to work-around this ?

Hi,
This is not implemented in default nvcompositor plugin. If you use the version > Jetpack 4.5, please download the source code from
https://developer.nvidia.com/embedded/l4t/r32_release_v6.1/sources/t186/public_sources.tbz2

And customize the plugin to include the function. The code is based on NvBufferComposite() in

/usr/src/jetson_multimedia_api/include/nvbuf_utils.h

Please check the header file for implementing the function.

1 Like

Thank you for your answer. I always like to know where the code is. Probably if I had some spare time at work I would implement myself, but right now I feel a bit under pressure to do a quick 'n dirty fix and finish the job.
So I found as working solution to replace the nvcompositor with glvideomixer. Sure it is slower, but it works for me reasonably well for 1080p (faster than software compositor) . I can share the pipeline if someone is interested.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.