我尝试使用RTSP从无线摄像头接收实时H264流。摄像机IP为192.168.150.1,并且不需要验证。
由于我在Windows下开发,我安装了Gstreamer 1.0 - 1.8.3,这是一个完整的安装,包含所有插件以及在安装过程中选择的所有内容。
当我尝试管道时
gst-launch-1.0 rtspsrc location="rtsp://192.168.150.1" latency=100 ! rtph264depay ! avdec_h264 ! autovideosink
我收到了这个输出:
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Progress: (open) Opening Stream
Progress: (connect) Connecting to rtsp://192.168.150.1
Progress: (open) Retrieving server options
Progress: (open) Retrieving media info
ERROR: from element /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0: No supported stream was found. You might need to allow more transport protocols or may otherwise be missing the right GStreamer RTSP extension plugin.
Additional debug info:
gstrtspsrc.c(6421): gst_rtspsrc_setup_streams (): /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0
ERROR: pipeline doesn't want to preroll.
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...
我也尝试了以下命令:
gst-play-1.0 rtsp://192.168.150.1
获得此输出:
Interactive keyboard handling in terminal not available.
Now playing rtsp://192.168.150.1
Pipeline is live.
ERROR Your GStreamer installation is missing a plug-in. for rtsp://192.168.150.1
ERROR debug information: gsturidecodebin.c(1006): no_more_pads_full (): /GstPlayBin:playbin/GstURIDecodeBin:uridecodebin0:
no suitable plugins found:
gstrtspsrc.c(6421): gst_rtspsrc_setup_streams (): /GstPlayBin:playbin/GstURIDecodeBin:uridecodebin0/GstRTSPSrc:source
Reached end of play list.
当我在VLC中尝试相同的URL(rtsp://192.168.150.1)时,我可以看到流。所以我的猜测是我错过了#34;正确的GStreamer RTSP扩展插件"
inspect-1.0 | grep 264
的输出是:
File STDIN:
x264: x264enc: x264enc
videoparsersbad: h264parse: H.264 parser
typefindfunctions: video/x-h264: h264, x264, 264
rtp: rtph264depay: RTP H264 depayloader
rtp: rtph264pay: RTP H264 payloader
openh264: openh264dec: OpenH264 video decoder
openh264: openh264enc: OpenH264 video encoder
libav: avdec_h264: libav H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 decoder
libav: avmux_ipod: libav iPod H.264 MP4 (MPEG-4 Part 14) muxer
我也试过使用FFmpeg,我可以看到视频,但我更喜欢使用Gstreamer,因为我将在Android设备上使用相同的配置(相机,管道,gstreamer库...),以及我认为Gstreamer似乎是最好的选择。
从FFmpeg我得到了关于流的信息
Stream #0:0: Video: h264 (Constrained Baseline), yuv420p, 640x352, 29.92 tbr, 90k tbn, 180k tbc
有没有人有一些建议可以解决这个问题? 我错过了哪个插件?我怎样才能添加我的安装?
修改
gst-launch-1.0.exe -v playbin uri=rtsp://192.168.150.1
Setting pipeline to PAUSED ...
/GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0: ring-buffer-max-size = 0
/GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0: buffer-size = -1
/GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0: buffer-duration = -1
/GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0: use-buffering = false
/GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0: download = false
/GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0: uri = rtsp://192.168.150.1
/GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0: connection-speed = 0
/GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0: source = "\(GstRTSPSrc\)\ source"
Pipeline is live and does not need PREROLL ...
Progress: (open) Opening Stream
Progress: (connect) Connecting to rtsp://192.168.150.1
Progress: (open) Retrieving server options
Progress: (open) Retrieving media info
ERROR: from element /GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0: Your GStreamer installation is missing a plug-in.
Additional debug info:
gsturidecodebin.c(1006): no_more_pads_full (): /GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0:
no suitable plugins found:
gstrtspsrc.c(6421): gst_rtspsrc_setup_streams (): /GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0/GstRTSPSrc:source
ERROR: pipeline doesn't want to preroll.
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...
答案 0 :(得分:1)
我与GStreamer / 1.8.3完全相同。
原因是我的相机没有在其会话描述中提供"Control URL"属性,而GStreamer在这种情况下不够智能回到基本URL(就像其他玩家一样)。
所以,我运行以下命令从GStreamer获取详细日志:
gst-play-1.0 rtsp://camera_ip:port/ --gst-debug-level=9 --gst-debug-no-color &> GSTREAMER_LOGS.txt
在日志中我找到了这一行:
DEBUG rtspsrc gstrtspsrc.c:6109:gst_rtspsrc_setup_streams:<source> skipping stream 0x7f01b402c140, no setup
然后查看来自Kurento的gst-plugins-good软件包的当前gstrtspsrc.c代码,我发现“跳过流...,没有设置”错误只发生在stream->conninfo.location == NULL
。正如我所说的那样,因为我的相机没有在SDP中提供“控制URL”属性。将以下行添加到我的相机SDP会话描述为我解决了这个问题:
a=control:*
但是,通常,这可能需要在GStreamer代码中修复。
答案 1 :(得分:0)
我认为这是GStreamer的限制,VLC和ffmpeg并没有共享。我有类似的情况,我有三个不同的RTSP相机,两个可以与GStreamer一起使用,另一个不用。所有三个都可以使用VLC和ffmpeg。
我使用Wireshark查看原始RTSP协议,发现使用GStreamer的两个摄像头包括一个sprop-parameter-sets参数字段,而那个没有工作的摄像头没有这个字段。
以sprop-parameter-sets(SPS和PPS数据)编码的信息通常存在于来自摄像机的RTP流中。显然VLC和ffmpeg很聪明,可以选择这个,但GStreamer不是。
我尝试使用caps命令行参数手动插入sprop-parameter-sets数据,但是没有成功。