【问题标题】:How to use gst-launch to streaming mp4 audio and video via rtp and play it?如何使用 gst-launch 通过 rtp 流式传输 mp4 音频和视频并播放?
【发布时间】:2017-02-28 02:17:15
【问题描述】:

我使用这些命令来发送和接收 rtp 数据:

向UDP 5000端口发送rtp数据

gst-launch-1.0 -v filesrc location = haizeiwang.mp4 ! decodebin ! x264enc ! rtph264pay ! udpsink host=192.168.1.101 port=5000

从udp端口5000接收rtp数据并播放。

gst-launch-1.0 -v udpsrc port=5000 caps="application/x-rtp, media=video, clock-rate=90000, encoding-name=H264, payload=96, ssrc=3394826012, timestamp-offset=2215812541, seqnum-offset=46353" ! rtph264depay ! decodebin ! videoconvert ! autovideosink sync=false

但我只能得到视频(不是很清楚),而且没有声音。我可以同时获得视频和音频吗?我应该使用哪些元素?命令应该是什么?

谢谢。

【问题讨论】:

标签: gstreamer rtp gst-launch


【解决方案1】:

发件人(音频+视频):

gst-launch-1.0 -v uridecodebin name=uridec uri=file:///C:\\video.mp4 ! videoconvert ! x264enc noise-reduction=10000 tune=zerolatency byte-stream=true threads=4 key-int-max=15 intra-refresh=true ! mpegtsmux alignment=7 name=mux ! rtpmp2tpay ! queue ! udpsink host=127.0.0.1 port=5000 sync=true uridec. ! audioconvert ! voaacenc ! audio/mpeg ! queue ! mux.  

接收器(音频+视频,短版):

gst-launch-1.0 -v playbin uri=udp://127.0.0.1:5000

接收器(音频+视频,长版):

gst-launch-1.0 -v udpsrc port=5000 ! tsparse ! decodebin name=dec ! videoconvert ! autovideosink sync=true dec. ! queue ! audioconvert ! audioresample ! autoaudiosink sync=true

如果您可以通过 cmd-line 访问 VLC,则可以使用以下方式播放流:

vlc rtp://@:5000

或者直接去VLC图形界面打开网络流(CTRL+N),使用我上面分享的地址。

【讨论】:

  • 您好!您的示例仅适用于我的本地主机。因此,如果我尝试将源广播给另一个客户,我会遇到错误:找不到地址...
  • 我在同一个局域网内的电脑上用过没问题。
  • 我也尝试过,但在我的情况下它不起作用。客户端cmd出现错误。不知道怎么回事……
  • 防火墙或防病毒已打开,也许?无论如何,对于网络相关的问题,我建议去superuserserverfault 寻求帮助。
  • 今天我尝试在 Windp\ows 10 上从我的 PC 流式传输并关闭病毒和 Thred 保护和 Brandmauer 到 Raspberri Pi II,我有同样的错误。但!如果我使用此命令行仅流式传输 H.264 视频:gst-launch-1.0 -v filesrc location=d:/TestVideos/costarica.mp4 ! queue ! decodebin ! x264enc ! rtph264pay ! udpsink host=ххх.ххх.х.ххх port=хххх
猜你喜欢
  • 1970-01-01
  • 2012-04-10
  • 1970-01-01
  • 1970-01-01
  • 2017-12-08
  • 2011-10-13
  • 2012-01-27
  • 2015-05-30
  • 1970-01-01
相关资源
最近更新 更多