簡體   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