简体   繁体   English

如何在 Windows 中的同一台计算机上使用 GStreamer 发送和接收 RTSP 提要

[英]How to use GStreamer to send and receive a RTSP feed on same computer in Windows

I am trying to send Opencv images over the network.我正在尝试通过网络发送 Opencv 图像。 I was suggested to use GStreamer for that purpose.我被建议为此目的使用 GStreamer。

I have installed GStreamer and now testing it on my Windows 10.我已经安装了 GStreamer,现在在我的 Windows 10 上测试它。

I am able to display test video using the following command:我可以使用以下命令显示测试视频:

gst-launch-1.0 videotestsrc ! videoconvert ! autovideosink

Now I try to send video using RTSP.现在我尝试使用 RTSP 发送视频。 For now, I want to stream my desktop using GStreamer and watch it in VLC.现在,我想使用 GStreamer 流式传输我的桌面并在 VLC 中观看它。 For sending the video I am using:为了发送我正在使用的视频:

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

For which response is:对于哪个响应是:

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

But I am unable to watch it on VLC using rtsp://172.16.15.147:8554但我无法使用 rtsp://172.16.15.147:8554 在 VLC 上观看它

I even tried sending it to 127.0.0.1:5000我什至尝试将其发送到 127.0.0.1:5000

How to know I am even sending the packet?如何知道我什至在发送数据包? I tried capturing packets on Wireshark but it's not useful.我尝试在 Wireshark 上捕获数据包,但没有用。

Please suggest a method to send and receive stream using GStreamer on same PC.请建议一种在同一台 PC 上使用 GStreamer 发送和接收流的方法。

Long story short, you need a .sdp file.长话短说,您需要一个.sdp文件。

This is the minimum your SDP file must contain这是您的 SDP 文件必须包含的最低要求

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

I just tested on a stream from a camera I have at home that happens to have very similar parameters to yours, you'll just need to change the IP address:我刚刚在家里的摄像机上测试了一个流,该摄像机的参数恰好与您的参数非常相似,您只需要更改 IP 地址:

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

Then the following command will just work然后以下命令将起作用

vlc stuff.sdp

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM