All Gstreamer'Compositor' approaches work slower than parallel pipelines

Hello.
I have the quest, that is really confusing me more and more.
Short task description:
I need display 8 cameras at the same time on single screen.
In my app I am using libgst-1.0 library and NV-related API.

At first, I tried ways used the command line. I ran multiple screens using the sequence:
gst-launch-1.0 nvv4l2camerasrc device=/dev/video0 ! ‘video/x-raw(memory:NVMM),format=UYVY’ ! nvvidconv ! ‘video/x-raw,format=UYVY’ ! xvimagesink &
gst-launch-1.0 nvv4l2camerasrc device=/dev/video1 ! ‘video/x-raw(memory:NVMM),format=UYVY’ ! nvvidconv ! ‘video/x-raw,format=UYVY’ ! xvimagesink &
gst-launch-1.0 nvv4l2camerasrc device=/dev/video2 ! ‘video/x-raw(memory:NVMM),format=UYVY’ ! nvvidconv ! ‘video/x-raw,format=UYVY’ ! xvimagesink &
gst-launch-1.0 nvv4l2camerasrc device=/dev/video3 ! ‘video/x-raw(memory:NVMM),format=UYVY’ ! nvvidconv ! ‘video/x-raw,format=UYVY’ ! xvimagesink &
gst-launch-1.0 nvv4l2camerasrc device=/dev/video4 ! ‘video/x-raw(memory:NVMM),format=UYVY’ ! nvvidconv ! ‘video/x-raw,format=UYVY’ ! xvimagesink &
gst-launch-1.0 nvv4l2camerasrc device=/dev/video5 ! ‘video/x-raw(memory:NVMM),format=UYVY’ ! nvvidconv ! ‘video/x-raw,format=UYVY’ ! xvimagesink &
gst-launch-1.0 nvv4l2camerasrc device=/dev/video6 ! ‘video/x-raw(memory:NVMM),format=UYVY’ ! nvvidconv ! ‘video/x-raw,format=UYVY’ ! xvimagesink &
gst-launch-1.0 nvv4l2camerasrc device=/dev/video7 ! ‘video/x-raw(memory:NVMM),format=UYVY’ ! nvvidconv ! ‘video/x-raw,format=UYVY’ ! xvimagesink

Above command sequence is fine. All works fast and with smooth streaming.

But when I try to use some composing approach (nvcompositor/compositor or nvstreammux and etc) the output result works always slower, than individual pipelines.

1.I tried many variations (something like this. Works well for 2 cameras. But have eye-noticeable lags for 6 cameras tile-screen. With 8 cameras situation is more bad):
gst-launch-1.0 compositor name=comp \
sink_0::xpos=0 sink_0::ypos=0 sink_0::width=1920 sink_0::height=1080 \
sink_1::xpos=1920 sink_1::ypos=0 sink_1::width=1920 sink_1::height=1080 \
! ‘video/x-raw(memory:NVMM), width=1920, height=1080’ \
! nvvidconv ! ‘video/x-raw(memory:NVMM), format=UYVY’ \
! xvimagesink \
nvv4l2camerasrc device=/dev/video0 ! ‘video/x-raw(memory:NVMM), format=UYVY, width=1920, height=1080, framerate=30/1’ \
! nvvidconv ! ‘video/x-raw, format=UYVY’ ! comp.sink_0 \
nvv4l2camerasrc device=/dev/video1 ! ‘video/x-raw(memory:NVMM), format=UYVY, width=1920, height=1080, framerate=30/1’ \
! nvvidconv ! ‘video/x-raw, format=UYVY’ ! comp.sink_1

2.Or this (also works with some lags)
gst-launch-1.0
nvstreammux name=mux batch-size=10 width=480 height=270 !
nvmultistreamtiler rows=2 columns=2 width=960 height=540 !
nvvidconv ! ‘video/x-raw(memory:NVMM),width=1920,height=1080’ !
nv3dsink sync=0
v4l2src device=/dev/video0 !
‘video/x-raw,width=1920,height=1080,framerate=30/1,format=UYVY’ !
nvvidconv interpolation-method=0 !
‘video/x-raw(memory:NVMM),width=480,height=270’ ! mux.sink_0
v4l2src device=/dev/video1 !
‘video/x-raw,width=1920,height=1080,framerate=30/1,format=UYVY’ !
nvvidconv interpolation-method=0 !
‘video/x-raw(memory:NVMM),width=480,height=270’ ! mux.sink_1
v4l2src device=/dev/video2 !
‘video/x-raw,width=1920,height=1080,framerate=30/1,format=UYVY’ !
nvvidconv interpolation-method=0 !
‘video/x-raw(memory:NVMM),width=480,height=270’ ! mux.sink_2
v4l2src device=/dev/video3 !
‘video/x-raw,width=1920,height=1080,framerate=30/1,format=UYVY’ !
nvvidconv interpolation-method=0 !
‘video/x-raw(memory:NVMM),width=480,height=270’ ! mux.sink_3

Nothing works good like individual pipelines.
I really start think that is impossible to achieve a performance, which I have using individual call GST pipelines (through & delimiter for each camera). Compositors and similar approaches are terribly slower. ( I need the performance as with individual pipelines, but in tile mode in own window app).
I already started look inside the gstreamer source for better understanding the ‘magic’.
Trying to use compositors, the FPS is almost 30, but the images are flickering on each tile (4x2).
What can I do to achieve a fast render, but render all cameras in one common app-window.??

Note: I don’t use libargus, because our sensors are not ‘Bayer’ sensors.
That is the reason, why I cannot test some samples like 13_argus_multi_camera.
The 12_v4l2_camera_cuda works much slower even on single camera.
(sudo ./v4l2_camera_cuda -d /dev/video1 -s 1920x1080 -f UYVY -r 30 -c)
Thanks.

Hi,
Do you use Jetpack 6.2.2 r36.5? Would like to make sure you use latest Jetpack release for Orin.

I am using Jetpack 5.1.4/5.1.5. Sensor driver adopted for this, not for 6+.

I am looking the way how to run all pipelines in parallel, but show them on single window.
By default the Gstreamer creates the individual window for each pipeline. Compositor (nvstreammux or e.g.) unites all pipelines in one resulting pipeline, that works slower. The result performance after composing looks more slow (in comparison using separated pipelines).

Also I found that12_v4l2_camera_cuda starts work fine, if I start some Gstreamer pipeline in parallel (for example below).
gst-launch-1.0 nvv4l2camerasrc device=/dev/video0 ! ‘video/x-raw(memory:NVMM),format=UYVY’ ! nvvidconv ! ‘video/x-raw,format=UYVY’ ! xvimagesink
And hence, this sample app returns slower again, if I exit from Gstreamer pipeline launched above.
What exactly Gstreamer do inside, that “overclocks” the 12_v4l2_camera_cuda sample?
I suspect some hardware configuration is missing in default 12_v4l2_camera_cuda sample for JP-51.5
Absolutely confusing thing.

AI told me that ‘composing’ pipelines in one result pipeline will be always slower in any case, than pipelines were invoked individually.

  1. Fast: gst-launch [pipeline0] + gst-launch [pipeline1] + …
  2. Slow: gst-launch [pipeline0 + pipeline1+ … + pipeline N’]

Hi,
Please run the script to enable CPU cores and VIC engine at maximum clocks:
VPI - Vision Programming Interface: Performance Benchmark

And check if there is improvement. You can profile system status by executing $ sudo tegrastats. Probably the VIC engine is at full loading already.

This is not a satisfactory method for me.
If I run the script with argument –max
I get the Jetson fan moving air stronger and noisy.
Nothing more approved. All the same.
GStreamer’s parallel pipelines work well, the composed (via compositor) pipelines - work slower.
The 12_v4l2_camera_cuda example works also slower.

This script not a satisfactory method for me, because I have fast working parallel Gstreamer pipelines (in separated windows) without it (pseudo-template below):

gst-launch-1.0 nvv4l2camerasrc device=/dev/video0 ! ‘video/x-raw(memory:NVMM),format=UYVY’ ! nvvidconv ! ‘video/x-raw,format=UYVY’ ! xvimagesink &
[pipeline 1] &
[pipeline 2] &
…. &
[pipeline N]

But all bad with
gst-launch-1.0 compositor method
Now the example from v4l2_camera sample:
sudo ./v4l2_camera_cuda -d /dev/video0 -s 1920x1980
is obviously slower than single Gstreamer pipeline (pipe below works like a charm):

gst-launch-1.0 nvv4l2camerasrc device=/dev/video0 \
! ‘video/x-raw(memory:NVMM),format=UYVY’ ! nvvidconv ! \
‘video/x-raw,format=UYVY’ ! xvimagesink

I’m currently trying to figure out how to make the standard v4l2_camera example run as fast as a single GStreamer pipeline.
In my app I have modified app based on v4l2_camera sample which works a little bit better than original, although the issue is same.

Hi,
The compositor plugin doesn’t use hardware engine. Please try nvcompositor plugin which uses hardware VIC engine. To check further you can run $ sudo tegrastats to get system status and see where the bottleneck is.

Hello.
Seems the nvcompositor works well.
Although I am now thinking how to achieve the same result with 12_v4l2_camera_cuda sample (for single camera) modifying the source code.
By default the compiled sample code works bad (Gstreamer pipeline with single camera works faster). I want to go away from GStreamer libs to implement the more “bare” solution.
Thanks.

Hi @axentsky good to hear that nvcompositor is working, regarding your question, if you need to create an application you can also continue to use gstreamer with C, Python or Rust APIs.

Also if you want to profile your pipelines further you can checkout GstShark

Best regards,
Daniel Gonzalez
Embedded SW Engineer at RidgeRun
Contact us: support@ridgerun.com
Developers wiki: https://developer.ridgerun.com
Website: www.ridgerun.com

Hello.
I already tested myself app with Gstremer. This works fine.
My aim is going far from Gstreamer libs. Only NV API using is acceptable.
I am planning to use VPI in future, and this is not trivial task to link VPI with Gstreamer.
RidgeRun’s Gstreamer plugin is huge for price (half of Jetson Thor).