Rtspsrc cannot read some streams

• Nvidia 3060
• DeepStream Version 6.3
• Bugs
• Working from deepstream container

I’ve implemented a simple pipeline to read an rtsp stream with rtspsrc element and display it in a window.

However, for some streams, I’m getting an error and the pipeline seems to be blocked. Could you suggest some solutions?

Here are the code and logs :
CODE

import gi
gi.require_version("Gst", "1.0")
from gi.repository import Gst, GObject
import threading
import time 
import sys


def cb_newpad(element, element_src_pad, data):
	print("IN NEW PAD")
	caps = element_src_pad.get_current_caps()
	structure = caps.get_structure(0)
	name = structure.get_name()
	media_type = structure.get_value("media")
	print(f"Pad added: {media_type} & {name}")
	
	if media_type == "video" and name == "application/x-rtp":
		print("Here we go")
		sinkpad = data.get_static_pad("sink") #where data is depay element
		print("Source pad capabilities:", element_src_pad.query_caps(None).to_string())
		print("Sink pad capabilities:", sinkpad.query_caps(None).to_string())
		if element_src_pad.link(sinkpad)  != Gst.PadLinkReturn.OK:
			print('Elements could not be linked: 1. Exiting.', flush=True)
			sys.exit(-1)      


def on_error(bus, message):
	err, debug = message.parse_error()
	print(f"Error: {err}, {debug}")

def main():
	GObject.threads_init()
	Gst.init(None)

	# Set the default debug threshold
	Gst.debug_set_default_threshold(3)

	pipeline = Gst.Pipeline.new("dstest-sr-pipeline")
	
	source = Gst.ElementFactory.make("rtspsrc", "rtsp-source")
	source.set_property("location", "rtsp://x.x.x.x/onvif-media/media.amp")
	
	depay_pre_decode = Gst.ElementFactory.make("rtph264depay", "h264-depay")
	
	parse = Gst.ElementFactory.make("h264parse", "parse")
	
	source.connect("pad-added", cb_newpad, depay_pre_decode)
	
	decoder = Gst.ElementFactory.make("nvv4l2decoder", "nvv4l2-decoder")

	convert = Gst.ElementFactory.make("nvvideoconvert", "convert")

	caps = Gst.Caps.from_string("video/x-raw,width=1920,height=1080,formate=I420")
	filter = Gst.ElementFactory.make("capsfilter", "filter")
	filter.set_property("caps", caps)

	queue = Gst.ElementFactory.make("queue", "queue")

	sink = Gst.ElementFactory.make("nveglglessink", "video-sink")
	sink.set_property("window-x", 0)
	sink.set_property("window-y", 0)
	sink.set_property("window-width", 1280)
	sink.set_property("window-height", 720)


	# Create a bin and add elements
	bin = Gst.Bin.new("my-bin")
	bin.add(source)
	bin.add(depay_pre_decode)
	bin.add(parse)
	bin.add(decoder)



	if not depay_pre_decode.link(parse):
		print('Depay_pre_decode could not be linked to parse. Exiting.')
		sys.exit(-1)

	if not parse.link(decoder):
		print('Parse could not be linked to decoder. Exiting.')
		sys.exit(-1)

	# Add a ghost pad to the bin
	bin.add_pad(Gst.GhostPad.new("src", decoder.get_static_pad("src")))



	pipeline.add(bin)
	pipeline.add(convert)
	pipeline.add(filter)
	pipeline.add(queue)
	pipeline.add(sink)
   
	# Link bin to the rest of the pipeline
	if not bin.link(convert):
		print('Bin could not be linked to convert. Exiting.')
		sys.exit(-1)

	if not convert.link(filter):
		print('Convert could not be linked to filter. Exiting.')
		sys.exit(-1)

	if not filter.link(queue):
		print('Filter could not be linked to queue. Exiting.')
		sys.exit(-1)

	if not queue.link(sink):
		print('Queue could not be linked to sink. Exiting.')
		sys.exit(-1)



	bus = pipeline.get_bus()
	bus.add_signal_watch()
	bus.connect("message::error", on_error)



	# Mettre le pipeline en lecture
	ret = pipeline.set_state(Gst.State.PLAYING)
	if ret == Gst.StateChangeReturn.FAILURE:
		print("Unable to set the pipeline to the playing state.", flush=True)
		sys.exit(-1)

	# Attendre que le pipeline rencontre une erreur ou EOS
	print("Running...")
	main_loop = GObject.MainLoop()
	try:
		main_loop.run()
	except KeyboardInterrupt:
		pass
	finally:
		pipeline.set_state(Gst.State.NULL)
		main_loop.quit()

if __name__ == "__main__":
	main()

LOGS

graph-deepstream-deepstream-1 | 0:01:12.551655836 1 0x7f954c007400 WARN rtspmedia rtsp-media.c:3272:wait_preroll: failed to preroll pipeline
graph-deepstream-deepstream-1 | 0:01:12.551715935 1 0x7f954c007400 WARN rtspmedia rtsp-media.c:3652:gst_rtsp_media_prepare: failed to preroll pipeline
graph-deepstream-deepstream-1 | 0:01:12.552460774 1 0x7f954c007400 ERROR rtspclient rtsp-client.c:1077:find_media: client 0x211a130: can't prepare media
graph-deepstream-deepstream-1 | 0:01:12.552631713 1 0x7f954c007400 ERROR rtspclient rtsp-client.c:2963:handle_describe_request: client 0x211a130: no media

It appears that there is an issue with your rtsp source from the log. Could you share the rtsp source to us?

It doesn’t work with the sample either:
/opt/nvidia/deepstream/deepstream-6.3/sources/apps/sample_apps/deepstream-testsr/deepstream_test_sr_app.c

I am using an AXIS P1455-LE Network Camera.

Here is the log :

0:00:01.525553470 372039 0x556bba146f30 INFO                 nvinfer gstnvinfer.cpp:682:gst_nvinfer_logger:<primary-nvinference-engine> NvDsInferContext[UID 1]: Info from NvDsInferContextImpl::deserializeEngineAndBackend() <nvdsinfer_context_impl.cpp:1988> [UID = 1]: deserialized trt engine from :/opt/nvidia/deepstream/deepstream-6.3/samples/models/Primary_Detector/resnet10.caffemodel_b1_gpu0_int8.engine
INFO: ../nvdsinfer/nvdsinfer_model_builder.cpp:610 [Implicit Engine Info]: layers num: 3
0   INPUT  kFLOAT input_1         3x368x640       
1   OUTPUT kFLOAT conv2d_bbox     16x23x40        
2   OUTPUT kFLOAT conv2d_cov/Sigmoid 4x23x40         

0:00:01.580371701 372039 0x556bba146f30 INFO                 nvinfer gstnvinfer.cpp:682:gst_nvinfer_logger:<primary-nvinference-engine> NvDsInferContext[UID 1]: Info from NvDsInferContextImpl::generateBackendContext() <nvdsinfer_context_impl.cpp:2091> [UID = 1]: Use deserialized engine model: /opt/nvidia/deepstream/deepstream-6.3/samples/models/Primary_Detector/resnet10.caffemodel_b1_gpu0_int8.engine
0:00:01.582483048 372039 0x556bba146f30 INFO                 nvinfer gstnvinfer_impl.cpp:328:notifyLoadModelStatus:<primary-nvinference-engine> [UID 1]: Load new model:dstestsr_pgie_config.yml sucessfully
Running...
In cb_newpad
Recording started..
Recording done.
** ERROR: <RunUserCallback:207>: No video stream found
Recording started..
Recording done.
** ERROR: <RunUserCallback:207>: No video stream found
Recording started..
Recording done.
** ERROR: <RunUserCallback:207>: No video stream found
Recording started..
Recording done.
** ERROR: <RunUserCallback:207>: No video stream found

Unfortunately, I can’t give you access to the stream.
However, I can carry out the insrtuctions you provide and send you the results.

Thank you very much.

There is no update from you for a period, assuming this is not an issue anymore.
Hence we are closing this topic. If need further support, please open a new one.
Thanks

First, you need to confirm if your rtsp source is a format that gstreamer can support. Please refer to RTSP and run the pipeline on the page.

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