发布
社区首页 >问答首页 >在Windows环境下如何使用GStreamer在同一台计算机上发送和接收RTSP提要

在Windows环境下如何使用GStreamer在同一台计算机上发送和接收RTSP提要
EN

Stack Overflow用户
提问于 2020-02-25 04:34:44
回答 1查看 1.6K关注 0票数 1

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

我已经安装了GStreamer,现在在我的Windows 10上测试它。

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

代码语言:javascript
代码运行次数:0
复制
gst-launch-1.0 videotestsrc ! videoconvert ! autovideosink

现在我试着用RTSP发送视频。现在,我想使用GStreamer流我的桌面,并在VLC中观看它。用于发送我正在使用的视频:

代码语言:javascript
代码运行次数:0
复制
gst-launch-1.0 -v gdiscreencapsrc  ! queue  ! videoconvert !  video/x-raw,format=I420 ! jpegenc ! rtpjpegpay ! queue ! udpsink host=172.16.15.147 port=8554 

对此的答复是:

代码语言:javascript
代码运行次数:0
复制
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发送和接收流的方法。

EN

回答 1

Stack Overflow用户

发布于 2020-02-27 20:40:14

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

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

代码语言:javascript
代码运行次数:0
复制
v=<version>
c=IN IP4 <IP4 ADDRESS>
m=<media> <udp port> RTP/AVP <payload>
a=rtpmap:<payload> <encoding-name>/<clock-rate>

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

代码语言:javascript
代码运行次数:0
复制
v=0
c=IN IP4 192.168.1.188
m=video 5200 RTP/AVP 26
a=rtpmap:26 JPEG/90000

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

代码语言:javascript
代码运行次数:0
复制
vlc stuff.sdp
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/60387561

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档