Create Gstreamer RTSP Onvif server

255 Views Asked by At

Thanks in advance for any guidance. This issue is frustrating me.

I'm using deepstream SDK,deepstream-test1-rtsp-out sample as base code. This sample sends video over the rtsp server, and it works. I can open the stream via VLC.

Here is a code snippet of the rtsp server part:

 # Start streaming
rtsp_port_num = 8554
    
server = GstRtspServer.RTSPServer.new()
server.props.service = "%d" % rtsp_port_num
server.attach(None)
    
factory = GstRtspServer.RTSPMediaFactory.new()
factory.set_launch( "( udpsrc name=pay0 port=%d buffer-size=524288 caps=\"application/x-rtp, media=video, clock-rate=90000, encoding-name=(string)%s, payload=96 \" )" % (updsink_port_num, codec))
factory.set_shared(True)
server.get_mount_points().add_factory("/ds-test", factory)
    
print("\n *** DeepStream: Launched RTSP Streaming at rtsp://localhost:%d/ds-test ***\n\n" % rtsp_port_num)
    

I tried several options for changing from the rtsp server to the rtsp onvif server. I got no GStreamer errors, but I couldn't open the stream. here is my one of my testing:

rtsp_port_num_onvif = 8554
server1 = GstRtspServer.RTSPOnvifServer.new()
server1.props.service = "%d" % rtsp_port_num_onvif
server1.attach(None)

factory1 = GstRtspServer.RTSPOnvifMediaFactory.new()
factory1.set_backchannel_launch("( udpsrc name=pay0 port=%d caps=\"application/x-rtp, media=video, clock-rate=90000, encoding-name=(string)%s, name=depay_backchannel, payload=96\ ! rtph264depay name=depay0 ! fakesink async=false")" % (updsink_port_num, codec))
factory1.set_shared(False)
server1.get_mount_points().add_factory("/ds-test-onvif", factory1)

print("\n *** DeepStream: Launched RTSP Onvif Streaming at rtsp://localhost:%d/ds-test-onvif ***\n\n" % rtsp_port_num_onvif)

By reading the Gstreamer documentation on RTSP Server I found it has an element for rtsp onvif server, It mentions there that: "The only different to GstRtspServer.RTSPServer is that GstRtspServer.RTSPOnvifServer creates GstRtspServer.RTSPOnvifClient that have special handling for ONVIF specific features, like a backchannel that allows clients to send back media to the server."

Reading rtsp onvif media factory and the function set_backchannel_launch :

"Special ONVIF features that are currently supported is a backchannel for the client to send back media to the server in a normal PLAY media"

"The description should return a pipeline with a single depayloader named depay_backchannel. A caps query on the depayloader's sinkpad should return all possible, complete RTP caps that are going to be supported. At least the payload type, clock-rate and encoding-name need to be specified.

Note: The pipeline part passed here must end in sinks that are not waiting until pre-rolling before reaching the PAUSED state, i.e. setting async=false on GstBase.BaseSink. Otherwise the whole media will not be able to prepare.

Please, is there any GStreamer magician who could help me with it?

Thanks a lot.

0

There are 0 best solutions below