先说解决办法
sudo apt-get remove gstreamer1.0-plugins-ugly
分析过程和原因
输入命令
gst-launch-1.0 rtspsrc location="rtsp/url" ! fakesink
终端输出如下
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Progress: (open) Opening Stream
Progress: (connect) Connecting to rtsp:url
Progress: (open) Retrieving server options
ERROR: from element /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0: Could not read from resource.
Additional debug info:
gstrtspsrc.c(6319): gst_rtsp_src_receive_response (): /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0:
Could not receive message. (Timeout while waiting for server response)
ERROR: pipeline doesn't want to preroll.
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...
使用wireshark抓包可以看到,在发送OPTION请求后,大华摄像头迟迟没有给reply,因此超时(即使将time-out的阈值增大也没用)
而正常的连接,比如用VLC是能打开的,正常的建立流程应该是这样
那么我们点进去看OPTION发送了些啥
gstreamer的:
VLC的:
好像也看不出什么端倪,只能说gstreamer的报文内容更多。
因为不是专业搞这块的,因此只能谷歌大法了
首先在英伟达论坛找到了这个回答
按照英伟达技术支持的话来说:gstreamer的rtspsrc使用的标准协议,问题不在我~
但是上面也给出了解决方案,同时网上也有类似的解决方案,即本文开头的方法。其中说法目前看来最靠谱的是
Seems the Gstreamer RTSP source is sending some Header which the Camera doesn’t like and gives denial of service. Now it works after removing the above plugin.
那么移除ugly-plugin之后,我们再看报文长啥样:
很好,很有精神,很简洁干练。
TODO
后续有时间了要去看看gstreamer rtspsrc的源码,到底header是怎么搞的。
标签:...,pipeline,gstreamer,rtspsrc,Gstreamer,Setting,Progress,Rtspsrc,摄像头 From: https://www.cnblogs.com/zhouyuchong/p/17967976