繁体   English   中英

如何通过UDP从GStreamer 1.0到VLC传输视频

[英]How to Stream Video over UDP from GStreamer 1.0 to VLC

我打算将GStreamer用作应用程序的新视频流库,但是我尝试首先测试其基本功能。 不幸的是存在文档问题,尤其是关于:Windows和v1.x

我可以在GStreamer中播放本地视频文件。 我可以在VStream通过UDP或RTP流式传输的GStreamer中播放视频。 我可以将videotestsrc从GStreamer传输到VLC。

我无法将本地保存的视频从GStreamer流式传输到VLC。 我怎么做?

影片格式.mp4

VLC版本3.0.4

Gstreamer 1.16版


(一些)经过测试的命令

gst-launch-1.0 filesrc location=C:/Users/me/Desktop/big_buck_bunny.mp4 ! queue ! udpsink port=1234 
New clock: GstSystemClock
Got EOS from element "pipeline0".
Execution ended after 0:00:00.027096112
gst-launch-1.0 filesrc location=C:/Users/me/Desktop/big_buck_bunny.mp4 ! decodebin ! x264enc ! rtph264pay ! udpsink port=1234

New clock: GstSystemClock
Got EOS from element "pipeline0".
Execution ended after 0:00:00.027096112

先前命令没有明显错误,但VLC却什么也没收到,而Wireshark却什么也没看到

gst-launch-1.0 -v filesrc location=C:/Users/me/Desktop/big_buck_bunny.mp4 ! decodebin ! x264enc ! rtph264pay ! udpsink port=1234

很多行,关于上限格式的信息很多。

Pastebin输出

我尝试了很多大写字母组合,但到目前为止没有任何效果。 我尝试过的一个:

gst-launch-1.0 -v filesrc location=C:/Users/1137824/Desktop/big_buck_bunny.mp4 ! videoconvert ! videoscale ! video/x-raw,width=800,height=600 ! avenc_mpeg4 ! rtpmp4vpay config-interval=3 ! udpsink port=1234
Pipeline is PREROLLING ...
ERROR: from element /GstPipeline:pipeline0/GstFileSrc:filesrc0: Internal data stream error.
Additional debug info:
../libs/gst/base/gstbasesrc.c(3072): gst_base_src_loop (): /GstPipeline:pipeline0/GstFileSrc:filesrc0:
streaming stopped, reason not-negotiated (-4)
ERROR: pipeline doesn't want to preroll.

尝试从VLC到Gstreamer到VLC进行流传输(可能是GStreamer是以一个数据包而不是逐帧发送整个视频)

gst-launch-1.0 udpsrc port=1234 ! rtph264pay ! udpsink port=1212

ERROR: from element /GstPipeline:pipeline0/GstRtpH264Pay:rtph264pay0: GStreamer error: negotiation problem.
Additional debug info:
../gst-libs/gst/rtp/gstrtpbasepayload.c(714): gst_rtp_base_payload_chain (): /GstPipeline:pipeline0/GstRtpH264Pay:rtph264pay0:
No input format was negotiated, i.e. no caps event was received. Perhaps you need a parser or typefind element before the payloader

gst-launch-1.0 udpsrc port=1234 ! videoconvert ! x264enc ! rtph264pay ! udpsink port=1212

ERROR: from element /GstPipeline:pipeline0/GstUDPSrc:udpsrc0: Internal data stream error.
Additional debug info:
../libs/gst/base/gstbasesrc.c(3072): gst_base_src_loop (): /GstPipeline:pipeline0/GstUDPSrc:udpsrc0:
streaming stopped, reason not-negotiated (-4)

为了能够从VLC接收,您需要从rtph264pay元素传输配置。 这是通过元素的config-interval值完成的。 例如:

gst-launch-1.0 filesrc location=C:/Users/me/Desktop/big_buck_bunny.mp4 ! decodebin ! x264enc ! rtph264pay config-interval=1 pt=96 ! udpsink port=1234

对于接收方。 VLC需要一个.sdp文件来描述网络流。 您可以使用文本编辑器创建一个简单的文本文件,然后将内容写入文件中。 一个示例sdp文件将如下所示:

v=0
m=video 1234 RTP/AVP 96
c=IN IP4 127.0.0.1
a=rtpmap:96 H264/90000

在这里,向VLC描述您将从端口1234接收H264视频流,并且该视频流位于有效载荷为96 RTP数据包中。 您告诉它从IP4 == 127.0.0.1监听。

随时根据您的需要进行修改。

暂无
暂无

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

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