2017-01-09 389 views
3

我试图使用流式传输的Gstreamer视频和音频的RTMP服务器(Wowza),但也有一些问题。如何通过使用RTMP流的Gstreamer?

有一个关于如何正确使用rtmpsink,即通过RTMP媒体发送到指定的服务器插件几乎没有任何文档。不仅如此,但各具特色正确的Gstreamer流水线是rtmpsink兼容简直是当前试错运动。

我目前的Gstreamer管道是:

sudo gst-launch-1.0 -e videotestsrc ! queue ! videoconvert ! x264enc ! flvmux streamable=true ! queue ! rtmpsink location='rtmp://<ip_address>/live live=true' 

运行上面我的Linux机器上的这个错误吐出:

Setting pipeline to PAUSED ... 
Pipeline is PREROLLING ... 
Redistribute latency... 
Pipeline is PREROLLED ... 
Setting pipeline to PLAYING ... 
New clock: GstSystemClock 
ERROR: from element /GstPipeline:pipeline0/GstRTMPSink:rtmpsink0: Could not  open resource for writing. 
Additional debug info: 
gstrtmpsink.c(246): gst_rtmp_sink_render(): /GstPipeline:pipeline0/GstRTMPSink:rtmpsink0: 
Could not connect to RTMP stream "rtmp://31.24.217.8/live live=true" for writing 
EOS on shutdown enabled -- waiting for EOS after Error 
Waiting for EOS... 
ERROR: from element /GstPipeline:pipeline0/GstVideoTestSrc:videotestsrc0: Internal data flow error. 
Additional debug info: 
gstbasesrc.c(2948): gst_base_src_loop(): /GstPipeline:pipeline0/GstVideoTestSrc:videotestsrc0: 
streaming task paused, reason error (-5) 
ERROR: from element /GstPipeline:pipeline0/GstQueue:queue0: Internal data flow error. 
Additional debug info: 
gstqueue.c(992): gst_queue_handle_sink_event(): /GstPipeline:pipeline0/GstQueue:queue0: 
streaming task paused, reason error (-5) 

由于缺乏对Wowza侧文档的另一个问题实际上是针-pointing正确的IP地址指向rtmpsink在缺乏对GStreamer的侧文件,适当的RTMP认证一旁是难以捉摸的,从一些论坛上发现了一些例子不能被确认为因其他变量工作。

通过使用rtmpsink通过RTMP进行流式传输的正确Gstreamer管道是什么,以及如何正确实施rtmpsink以进行验证?

回答

2

其实你正在使用的管道工作正常。

但是,禁用Wowza的RTMP安全是必须的,还指着太正确方向。

之后的下一个页面上的指引:https://www.wowza.com/forums/content.php?36-How-to-set-up-live-streaming-using-an-RTMP-based-encoder

  • 重新检查RTMP在应用程序中启用播放类型

Applications

  • 禁用所有的安全选项以确保GStreamer的兼容性。

Security

  • 播放安全选项卡,选中选择无客户端的限制(默认设置)。

Playback

  • 来源选项卡,在左边的列,可以检查服务器设置:

Output

一旦我们所做的一切这个步骤,我们可以推出之前的管道:

gst-launch-1.0 -e videotestsrc ! queue ! videoconvert ! x264enc ! flvmux streamable=true ! queue ! rtmpsink location='rtmp://192.168.1.40:1935/livertmp/myStream' 

它的工作原理,它可以检查考验玩家按钮,结果点击。其结果是下一个:

TestPlayers

虽然可能是超出范围,就可以添加音频管道,提高其添加人失踪,一些属性:

gst-launch-1.0 videotestsrc is-live=true ! videoconvert ! x264enc bitrate=1000 tune=zerolatency ! video/x-h264 ! h264parse ! video/x-h264 ! queue ! flvmux name=mux ! rtmpsink location='rtmp://192.168.1.40:1935/livertmp/myStream' audiotestsrc is-live=true ! audioconvert ! audioresample ! audio/x-raw,rate=48000 ! voaacenc bitrate=96000 ! audio/mpeg ! aacparse ! audio/mpeg, mpegversion=4 ! mux. 

关于到密码加密的内容,并不是直接用GStreamer来实现的。

+0

感谢您的答复。在启动管道'sudo gst-launch-1.0 -e videotestsrc后,我完全按照您的指示!队列! videoconvert! x264enc! flvmux streamable = true!队列! rtmpsink location ='rtmp://192.168.78.10:1935/live/myStream''的结果与前面描述的相同。不过,将其指向Wowza服务器的公共IP地址的其他观察失败,并立即出现上述错误,但使用本地IP地址“Wowza给出的”192.168.78.10“导致它在投掷之前尝试工作一分钟左右相同的错误。 – Shiri

+0

感谢您的帮助。事实证明,防火墙阻止了1935端口的通信,因此无法通过RTMP建立连接。 – Shiri

+0

另一个后续问题,我有一个管道'sudo gst-launch-1.0 shmsrc socket-path =/tmp/mixer1 do-timestamp = true is-live = true! '视频/ X-原料,格式= BGRA,像素纵横比= 1/1中,隔行扫描模式=逐行,帧速率= 24/1,宽度= 1024,高度= 576'! videoconvert! x264enc比特率= 1024! h264parse! flvmux name = mux streamable = true! rtmpsink位置='rtmp://192.168.78.10:1935/live/RTMPStream'报告它正在接收数据,但只播放黑屏。虽然将其更改为“udpsink”并通过VLC播放成功。你知道这个问题可能是什么吗? – Shiri