基于DeepStream搭建GStreamer RTSP ONVIF服务器无报错但无法拉流求助
基于DeepStream搭建RTSP ONVIF服务器无法推流的问题
我以DeepStream SDK的deepstream-test1-rtsp-out示例为基础开发,原示例的RTSP服务器可正常推送视频,能通过VLC打开流。原RTSP服务器代码片段如下:
# 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)
我尝试将其改为RTSP ONVIF服务器,运行时未出现GStreamer报错,但无法打开流。测试代码如下:
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)
查阅GStreamer的RTSP Server文档后,相关要点如下:
GstRtspServer.RTSPOnvifServer与GstRtspServer.RTSPServer的唯一区别是前者会创建GstRtspServer.RTSPOnvifClient,该客户端支持ONVIF特定功能,比如允许客户端向服务器回传媒体的反向通道。RTSP ONVIF Media Factory的set_backchannel_launch函数:当前支持的特殊ONVIF功能是反向通道,允许客户端在常规PLAY媒体中向服务器回传媒体;传入的管道需包含名为depay_backchannel的解封装器,解封装器接收端的caps需指定负载类型、时钟速率和编码名称;管道必须以设置了async=false的接收器结尾,否则媒体无法准备。
请问该如何修改代码才能让RTSP ONVIF服务器正常推流?
内容的提问来源于stack exchange,提问作者CYrOgAV
相关产品推荐
相关产品推荐

