Different nvcompositor / compositor behaviour with jpg background (gstreamer)

I’ve been creating the following pipeline


pipe = Gst.parse_launch(\
    " flvmux name=mux streamable=true ! rtmpsink sync=false async=false location=\'rtmp://a.rtmp.somesite.com/ live=true\' "
    " audiotestsrc wave=4 is-live=true ! audioconvert ! audioresample ! audio/x-raw,rate=48000 ! voaacenc bitrate=96000 ! audio/mpeg ! aacparse ! audio/mpeg, mpegversion=4 ! mux. "
    " nvcompositor name=compositor "
    " sink_1::width=960 sink_1::height=576 sink_1::ypos=100 sink_1::xpos=960 sink_1::operator=0 "
    " sink_2::width=960 sink_2::height=576 sink_2::xpos=0 sink_2::ypos=100 sink_2::operator=0 "
    " sink_3::width=640 sink_3::height=360 sink_3::xpos=1280 sink_3::ypos=680 sink_3::operator=0 "
    " sink_4::xpos=0 sink_4::ypos=0 sink_4::width=1920 sink_4::height=1080 sink_4::operator=2 "
    " ! "
    " nvvidconv ! nvv4l2h264enc maxperf-enable=1 profile=0 preset-level=0 bitrate=4500000 iframeinterval=18 idrinterval=18 ! h264parse ! mux."
    " multifilesrc location=\"background.jpg\" caps=\"image/jpeg,framerate=10/1,width=1920,height=1080\" ! nvjpegdec ! compositor."
    " rtspsrc location=rtsp://someip:554/Streaming/Channels/102?transportmode=unicast latency=100 drop-on-latency=true protocols=tcp caps=\"video/raw(memory:NVMM),width=960,height=576\" ! rtph264depay ! h264parse ! nvv4l2decoder enable-max-performance=1 ! nvvidconv ! compositor. "
    " rtspsrc location=rtsp://someip:554/Streaming/Channels/402?transportmode=unicast latency=100 drop-on-latency=true protocols=tcp caps=\"video/raw(memory:NVMM),width=960,height=576\" ! rtph264depay ! h264parse ! nvv4l2decoder enable-max-performance=1 ! nvvidconv ! compositor. "
    " rtspsrc location=rtsp://someip:554/Streaming/Channels/702?transportmode=unicast latency=100 drop-on-latency=true protocols=tcp caps=\"video/raw(memory:NVMM),width=960,height=576\" ! rtph264depay ! h264parse ! nvv4l2decoder enable-max-performance=1 ! nvvidconv ! compositor. ")
compositor = pipe.get_by_name('compositor')

which should overlay three live streams over a jpg image.

When using the code above with “compositor” everything works fine, I do have the background image and the three video streams on top.

If I use nvcompositor, however, the jpg image is gone and the background is green (which is due to the fact that there’s nothing in the memory if I understand it correctly).

=> what am I doing wrong, and how can I place the JPG as a FHD background with three videos on top ?

Thanks in advance!

Hi,
For the JPEG file source, please try

    " multifilesrc location=\"background.jpg\" caps=\"image/jpeg,framerate=10/1,width=1920,height=1080\" ! nvv4l2decoder mjpeg=1 ! compositor."

And there are 4 sources. For debugging, you may try to run cases of single source, two sources, three sources, to get more information.

No need to further debug - your proposed solution works perfectly. :-)

Thanks a lot!

1 Like