【问题标题】:How to use GStreamer to send and receive a RTSP feed on same computer in Windows如何在 Windows 的同一台计算机上使用 GStreamer 发送和接收 RTSP 提要
【发布时间】:2020-02-28 04:40:14
【问题描述】:

我正在尝试通过网络发送 Opencv 图像。有人建议我为此使用 GStreamer。

我已安装 GStreamer,现在在我的 Windows 10 上对其进行测试。

我可以使用以下命令显示测试视频:

gst-launch-1.0 videotestsrc ! videoconvert ! autovideosink

现在我尝试使用 RTSP 发送视频。现在,我想使用 GStreamer 流式传输我的桌面并在 VLC 中观看。发送我正在使用的视频:

gst-launch-1.0 -v gdiscreencapsrc  ! queue  ! videoconvert !  video/x-raw,format=I420 ! jpegenc ! rtpjpegpay ! queue ! udpsink host=172.16.15.147 port=8554 

响应是:

Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
/GstPipeline:pipeline0/GstGDIScreenCapSrc:gdiscreencapsrc0.GstPad:src: caps = video/x-raw, format=(string)BGR, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, pixel-aspect-ratio=(fraction)1/1
/GstPipeline:pipeline0/GstQueue:queue0.GstPad:sink: caps = video/x-raw, format=(string)BGR, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, pixel-aspect-ratio=(fraction)1/1
/GstPipeline:pipeline0/GstQueue:queue0.GstPad:src: caps = video/x-raw, format=(string)BGR, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, pixel-aspect-ratio=(fraction)1/1
/GstPipeline:pipeline0/GstVideoConvert:videoconvert0.GstPad:src: caps = video/x-raw, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, pixel-aspect-ratio=(fraction)1/1, format=(string)I420
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:src: caps = video/x-raw, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, pixel-aspect-ratio=(fraction)1/1, format=(string)I420
/GstPipeline:pipeline0/GstJpegEnc:jpegenc0.GstPad:sink: caps = video/x-raw, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, pixel-aspect-ratio=(fraction)1/1, format=(string)I420
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:sink: caps = video/x-raw, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, pixel-aspect-ratio=(fraction)1/1, format=(string)I420
/GstPipeline:pipeline0/GstVideoConvert:videoconvert0.GstPad:sink: caps = video/x-raw, format=(string)BGR, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, pixel-aspect-ratio=(fraction)1/1
Setting pipeline to PLAYING ...
New clock: GstSystemClock
/GstPipeline:pipeline0/GstJpegEnc:jpegenc0.GstPad:src: caps = image/jpeg, sof-marker=(int)0, width=(int)1920, height=(int)1080, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)30/1, interlace-mode=(string)progressive, colorimetry=(string)bt709, chroma-site=(string)mpeg2
/GstPipeline:pipeline0/GstRtpJPEGPay:rtpjpegpay0.GstPad:src: caps = application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)JPEG, a-framerate=(string)30.000000, payload=(int)26, ssrc=(uint)665894884, timestamp-offset=(uint)2085395382, seqnum-offset=(uint)6071
/GstPipeline:pipeline0/GstQueue:queue1.GstPad:sink: caps = application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)JPEG, a-framerate=(string)30.000000, payload=(int)26, ssrc=(uint)665894884, timestamp-offset=(uint)2085395382, seqnum-offset=(uint)6071
/GstPipeline:pipeline0/GstQueue:queue1.GstPad:src: caps = application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)JPEG, a-framerate=(string)30.000000, payload=(int)26, ssrc=(uint)665894884, timestamp-offset=(uint)2085395382, seqnum-offset=(uint)6071
/GstPipeline:pipeline0/GstQueue:queue1.GstPad:src: caps = application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)JPEG, a-framerate=(string)30.000000, payload=(int)26, ssrc=(uint)665894884, timestamp-offset=(uint)2085395382, seqnum-offset=(uint)6071
/GstPipeline:pipeline0/GstUDPSink:udpsink0.GstPad:sink: caps = application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)JPEG, a-framerate=(string)30.000000, payload=(int)26, ssrc=(uint)665894884, timestamp-offset=(uint)2085395382, seqnum-offset=(uint)6071
/GstPipeline:pipeline0/GstRtpJPEGPay:rtpjpegpay0: timestamp = 2085395391
/GstPipeline:pipeline0/GstRtpJPEGPay:rtpjpegpay0: seqnum = 6294

但我无法使用 rtsp://172.16.15.147:8554 在 VLC 上观看它

我什至尝试将其发送到 127.0.0.1:5000

如何知道我什至在发送数据包?我尝试在 Wireshark 上捕获数据包,但它没有用。

请建议一种在同一台 PC 上使用 GStreamer 发送和接收流的方法。

【问题讨论】:

  • udpsink != RTSP 要执行 RTSP,您必须使用 github.com/GStreamer/gst-rtsp-server 之类的东西
  • @RSATom 确实 udpsink 与 rtsp 不同,但是在 udpsink 之前使用的元素 rtpjpegpay 将编码的 JPEG 图像打包成 RTP 数据包,适合通过 UDP 发送,有点给出在这种情况下效果相同。

标签: windows opencv command-line streaming gstreamer


【解决方案1】:

长话短说,您需要一个 .sdp 文件。

这是您的 SDP 文件必须包含的最小值

v=<version>
c=IN IP4 <IP4 ADDRESS>
m=<media> <udp port> RTP/AVP <payload>
a=rtpmap:<payload> <encoding-name>/<clock-rate>

我刚刚在家里的摄像机上测试了一个流 恰好与您的参数非常相似,您只需要 更改IP地址:

v=0
c=IN IP4 192.168.1.188
m=video 5200 RTP/AVP 26
a=rtpmap:26 JPEG/90000

那么下面的命令就可以工作了

vlc stuff.sdp

【讨论】:

  • 我已经尝试过了,但没有成功。最后,我最终使用了 gst-rtsp-server。
猜你喜欢
  • 2013-03-22
  • 2014-10-11
  • 2010-10-15
  • 2011-04-24
  • 2011-12-03
  • 1970-01-01
  • 2019-06-15
  • 2011-10-24
  • 2018-06-15
相关资源
最近更新 更多