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
(一些)经过测试的命令
1 | gst-launch-1.0 filesrc location=C:/Users/me/Desktop/big_buck_bunny.mp4 ! queue ! udpsink port=1234 |
1 2 3 | New clock: GstSystemClock Got EOS from element"pipeline0". Execution ended after 0:00:00.027096112 |
1 | gst-launch-1.0 filesrc location=C:/Users/me/Desktop/big_buck_bunny.mp4 ! decodebin ! x264enc ! rtph264pay ! udpsink port=1234 |
1 2 3 | New clock: GstSystemClock Got EOS from element"pipeline0". Execution ended after 0:00:00.027096112 |
以前的命令没有明显错误,但VLC却什么也没收到,而Wireshark却什么也没看到
1 | gst-launch-1.0 -v filesrc location=C:/Users/me/Desktop/big_buck_bunny.mp4 ! decodebin ! x264enc ! rtph264pay ! udpsink port=1234 |
很多行,关于上限格式的信息很多。
垃圾箱输出。
我尝试了很多大写字母组合,但到目前为止没有任何效果。我尝试过的一个:
1 | 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 |
1 2 3 4 5 6 | 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正在将整个视频发送到一个数据包中,而不是逐帧发送)
1 2 3 4 | 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 |
1 2 3 4 | 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接收,您需要从
1 | 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需要
1 2 3 4 | v=0 m=video 1234 RTP/AVP 96 c=IN IP4 127.0.0.1 a=rtpmap:96 H264/90000 |
在这里,向VLC描述您将从端口
随时根据您的需要进行修改。