【发布时间】: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