Thank you for your suggestion.
I referred to the link you mentioned and followed the guidelines for Gst-nvstreammux
since I am not using the Gst-nvstreammux New
. I have met all three mentioned requests in my application including:
1- Set the batch-size to the number of sources.
2- Exported the environment variable:
export NVSTREAMMUX_ADAPTIVE_BATCHING=yes
3- Set the batched-push-timeout to:
1000000 us / maximum fps among the videos
However, the issue still persists. When I add the videorate
plugin to the pipeline, while this plugin works well with some RTSP streams, it comes up with the mentioned error with these specific RTSP streams.
I reffered to mentioned error which was:
Error: gst-stream-error-quark: NvStreamMux does not support raw buffers. Use nvvideoconvert before NvStreamMux to convert to NVMM buffers (5): gstnvstreammux.cpp(1278): gst_nvstreammux_sink_event (): /GstPipeline:pipeline2/GstNvStreamMux:Stream-muxer
[NvMultiObjectTracker] De-initialized
and to address this, I decided to add nvvideoconvert
and capsfilter
between each source_bin
and the nvstreammux
to meet the requirement for NVMM buffers
mentined in the above error. Here is the code related to receiving the RTSPs which causes the error:
for i, uri_name in enumerate(rtsp_urls):
print(f"URI Name: {uri_name}")
# Create a new Gst.Bin
bin_name = "source-bin-%02d" % i
print(bin_name)
nbin = Gst.Bin.new(bin_name)
if not nbin:
sys.stderr.write("Unable to create source bin\n")
return
# Create uridecodebin element
uri_decode_bin = Gst.ElementFactory.make("uridecodebin", "uri-decode-bin")
if not uri_decode_bin:
sys.stderr.write("Unable to create uri decode bin\n")
return
uri_decode_bin.set_property("uri", uri_name)
uri_decode_bin.connect("pad-added", cb_newpad, nbin)
uri_decode_bin.connect("child-added", decodebin_child_added, nbin)
Gst.Bin.add(nbin, uri_decode_bin)
bin_pad = nbin.add_pad(Gst.GhostPad.new_no_target("src", Gst.PadDirection.SRC))
if not bin_pad:
sys.stderr.write("Failed to add ghost pad in source bin\n")
return None
self.pipeline.add(nbin)
# Create videorate element
videorate = Gst.ElementFactory.make("videorate", f"videorate-{i}")
if not videorate:
sys.stderr.write("Unable to create videorate\n")
return
videorate.set_property("max-rate", self.max_frame_rate)
self.pipeline.add(videorate)
# Create nvvidconv element
nvvidconv = Gst.ElementFactory.make("nvvideoconvert", f"nvvidconv-{i}")
if not nvvidconv:
sys.stderr.write("Unable to create nvvideoconvert\n")
return
nvvidconv.set_property("nvbuf-memory-type", self.mem_type)
self.pipeline.add(nvvidconv)
# Create filter element
caps = Gst.Caps.from_string("video/x-raw(memory:NVMM), format=RGBA")
filter = Gst.ElementFactory.make("capsfilter", f"filter-{i}")
if not filter:
sys.stderr.write("Unable to create capsfilter\n")
return
filter.set_property("caps", caps)
self.pipeline.add(filter)
# Link source_bin to videorate
source_bin_pad = nbin.get_static_pad("src")
videorate_pad = videorate.get_static_pad("sink")
source_bin_pad.link(videorate_pad)
# Link videorate to nvvidconv
videorate_src_pad = videorate.get_static_pad("src")
nvvidconv_pad = nvvidconv.get_static_pad("sink")
videorate_src_pad.link(nvvidconv_pad)
# Link nvvidconv to filter
nvvidconv_src_pad = nvvidconv.get_static_pad("src")
filter_pad = filter.get_static_pad("sink")
nvvidconv_src_pad.link(filter_pad)
# Link filter to streammux
sinkpad = self.streammux.get_request_pad(f"sink_{i}")
if not sinkpad:
sys.stderr.write(f"Unable to get the sink pad of streammux\n")
return
filter_src_pad = filter.get_static_pad("src")
filter_src_pad.link(sinkpad)
The structure for each source bin:
nbin --> videorate --> nvvidconv --> filter --> streammux
But now, the following error occurs:
Warning: gst-stream-error-quark: not negotiated (11): ../libs/gst/base/gstbasetransform.c(1431): gst_base_transform_reconfigure_unlocked (): /GstPipeline:pipeline0/GstBin:source-bin-02/GstURIDecodeBin:uri-decode-bin/GstDecodeBin:decodebin0/GstCapsFilter:capsfilter0:
not negotiated
Error: gst-stream-error-quark: Internal data stream error. (1): ../libs/gst/base/gstbasesrc.c(3127): gst_base_src_loop (): /GstPipeline:pipeline0/GstBin:source-bin-02/GstURIDecodeBin:uri-decode-bin/GstRTSPSrc:source/GstUDPSrc:udpsrc14:
streaming stopped, reason not-negotiated (-4)
[NvMultiObjectTracker] De-initialized
The problem seems to relate to elements in the GStreamer pipeline being unable to agree on a common format after adding videorate to the pipeline for FPS tuning of sources.
Again I want to mention that when I remove the videorate
plugin, my application has no problem with any RTSP streams!
Could you kindly help me resolve this issue?