Setup Backgroung in nvoverlaysink

Hi,

I am using the below pipeline to save and preview 2 streams. After adjusting the aspect ratio and previewed, The videos are played but the ubuntu desktop is visible in the background.

gst-launch-1.0 -e v4l2src device=/dev/video1 ! tee name=t1 t1. ! queue ! video/x-raw, width=1920, height=1080, framerate=30/1 ! videorate ! video/x-raw, width=1920, height=1080, framerate=30/1 ! nvvidconv ! queue ! nvv4l2h264enc maxperf-enable=1 bitrate=4000000 profile=4 ! queue ! h264parse ! queue ! mux. alsasrc device=“hw:3,0” ! queue ! audio/x-raw ! voaacenc ! queue ! mp4mux name=mux ! filesink location=feed1mp1080HW1.mp4 t1. ! queue ! video/x-raw, width=1920, height=1080, framerate=30/1 ! nvvidconv ! queue ! “video/x-raw(memory:NVMM),width=959,height=540,framerate=30/1,format=NV12” ! queue ! nvoverlaysink overlay-x=0 overlay-y=270 overlay-w=959 overlay-h=540 overlay=1 v4l2src device=/dev/video0 io-mode=2 do-timestamp=true ! tee name=t2 t2. ! queue ! image/jpeg,width=1920,height=1080,framerate=30/1 ! videorate ! image/jpeg,width=1920,height=1080,framerate=30/1 ! nvv4l2decoder mjpeg=1 ! nvvidconv ! video/x-raw,width=1920,height=1080,framerate=30/1 ! nvvidconv ! queue ! ‘video/x-raw(memory:NVMM),framerate=30/1,format=NV12’ ! nvv4l2h264enc maxperf-enable=1 bitrate=4000000 profile=4 ! queue ! h264parse ! queue ! mp4mux ! filesink location=feed2mp1080HW1.mp4 t2. ! queue ! image/jpeg,width=1920,height=1080,framerate=30/1 ! nvv4l2decoder mjpeg=1 ! nvvidconv ! video/x-raw,framerate=30/1 ! nvvidconv ! queue ! ‘video/x-raw(memory:NVMM),framerate=30/1,format=NV12’ ! queue ! nvoverlaysink overlay-x=960 overlay-y=270 overlay-w=960 overlay-h=540 overlay=2

How can I display the 2 videos without the background. How can I incorporate nvcompositor background to this pipeline

Thanks in advanced

Hi,
Are you able to disable X11 and run? We suggest do this in gstreamer user guide
It is for TX2, but we suggest do it for other Jetson platforms also.

1 Like

Hi @DaneLLL ,
I tried this method as in the guide the gdm is disabled but the screen still prints the commands in the background while the video is played.

Can I use the nvcompositor to set the background in black at 1920x1080 resolution and play the videos on it using nvovelaysink?

Thank You

Hi,
The source code of nvcompositor is public from r32.5.1,. If you use the release, you can check the source code and do customization. The implementation is based on NvBuffer APIs in

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

You may try the following.
You would need to know your display resolution. You can get it from xrandr. Here I’m using a 3440x1440 display, you would adapt for your case.
The first pipeline uses videotestsrc with black pattern for making the background.
The second and third pipelines simulate your sources, I have adjusted first source width from 959 to 960 as odd widths would generate warnings.
Then nvcompositor does the layout, and this is finally passed to nvoverlaysink for display.
It may not be required for your case, but if having overlapping areas and alpha composing, you would use zorder property of each sink similar as overlay property of nvoverlaysink.

gst-launch-1.0 -v \
   videotestsrc pattern=black ! video/x-raw,width=320,height=240,framerate=30/1 ! nvvidconv ! queue ! comp.sink_0  \
   videotestsrc ! video/x-raw,width=960,height=540,framerate=30/1 ! nvvidconv ! queue ! comp.sink_1  \
   videotestsrc pattern=colors ! video/x-raw,width=960,height=540,framerate=30/1 ! nvvidconv ! queue ! comp.sink_2 \
   nvcompositor name=comp sink_0::width=3440 sink_0::height=1440 sink_1::xpos=0 sink_1::ypos=270 sink_1::width=960 sink_1::height=540  sink_2::xpos=960 sink_2::ypos=270 sink_2::width=960 sink_2::height=540 ! nvvidconv ! nvoverlaysink
1 Like

Thank You @Honey_Patouceul @DaneLLL I will try this method

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