【问题标题】:Gstreamer RSTP serverGstreamer RTSP 服务器
【发布时间】:2014-03-21 12:33:41
【问题描述】:

我想使用 Gstreamer 1.0 (gst-launch-1.0) 设置 RTSP 服务器流。

我的“服务器”目前看起来像这样

gst-launch-1.0.exe videotestsrc  ! x264enc ! rtph264pay ! udpsink host=localhost port=5000

我的客户看起来像这样

gst-launch-1.0.exe udpsrc port=5000 ! rtpmp2tdepay ! decodebin ! autovideosink

两个命令都运行没有错误,但我在“客户端”上看不到任何视频。此外,我知道我的命令只是通过 RTP 将 H.264 编码的视频流式传输到 UDP 端口。

我在 UDP 端口 5000 上看到了一些数据,因此我假设发送方部分是正确的。

我的问题:

  1. 我在接收端做错了什么?
  2. 如何设置 gst-launch-1.0 以提供 RTSP 流(带有元信息 .sdp 文件)?

编辑(2014-03-24): 发送端调试输出:

gst-launch-1.0.exe -v videotestsrc ! x264enc ! rtph264pay ! udpsink host=localhost port=5000
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
/GstPipeline:pipeline0/GstVideoTestSrc:videotestsrc0.GstPad:src: caps = video/x-raw, framerate=(fraction)30/1, width=(int)320, height=(int)240, format=(string)I420, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive
/GstPipeline:pipeline0/GstX264Enc:x264enc0.GstPad:sink: caps = video/x-raw, framerate=(fraction)30/1, width=(int)320, height=(int)240, format=(string)I420, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive
Redistribute latency...
/GstPipeline:pipeline0/GstX264Enc:x264enc0.GstPad:src: caps = video/x-h264, codec_data=(buffer)01640014ffe1001967640014acd94141fb0110000003001000000303c8f142996001000568ebecb22c, stream-format=(string)avc, alignment=(string)au, level=(string)2, profile=(string)high, width=(int)320, height=(int)240, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)30/1
/GstPipeline:pipeline0/GstRtpH264Pay:rtph264pay0.GstPad:src: caps = application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, sprop-parameter-sets=(string)"Z2QAFKzZQUH7ARAAAAMAEAAAAwPI8UKZYA\=\=\,aOvssiw\=", payload=(int)96, ssrc=(uint)383435573, timestamp-offset=(uint)786392204, seqnum-offset=(uint)781
/GstPipeline:pipeline0/GstUDPSink:udpsink0.GstPad:sink: caps = application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, sprop-parameter-sets=(string)"Z2QAFKzZQUH7ARAAAAMAEAAAAwPI8UKZYA\=\=\,aOvssiw\=", payload=(int)96, ssrc=(uint)383435573, timestamp-offset=(uint)786392204, seqnum-offset=(uint)781
/GstPipeline:pipeline0/GstRtpH264Pay:rtph264pay0.GstPad:sink: caps = video/x-h264, codec_data=(buffer)01640014ffe1001967640014acd94141fb0110000003001000000303c8f142996001000568ebecb22c, stream-format=(string)avc, alignment=(string)au, level=(string)2, profile=(string)high, width=(int)320, height=(int)240, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)30/1
/GstPipeline:pipeline0/GstRtpH264Pay:rtph264pay0: timestamp = 786392204
/GstPipeline:pipeline0/GstRtpH264Pay:rtph264pay0: seqnum = 781
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock

接收方:

gst-launch-1.0.exe -vvv udpsrc port=5000 ! "application/x-rtp, media=video, clock-rate=90000, encoding-name=H264, payload=96" ! queue ! rtph264depay ! queue ! decodebin ! autovideosink sync=false
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock

谢谢!

【问题讨论】:

    标签: gstreamer gst-launch


    【解决方案1】:

    问题#1。您在发送端使用rtph264pay,但在接收端使用rtpmp2tdepay。您需要使用rtph264depay

    问题#2。您需要为rtph264depay 提供正确识别视频格式的功能。
    要获得正确的功能,只需使用-v 标志运行发送代码并将特定于 rtp 的上限复制到接收管道。

    gst-launch-1.0 udpsrc port=5000 ! "application/x-rtp, media=video, clock-rate=90000, encoding-name=H264, payload=96" ! rtph264depay ! decodebin ! autovideosink
    

    【讨论】:

    • 按照你的2个问题解决方案,它仍然不起作用:gst-launch-1.0.exe -vvv udpsrc port=5000 ! “应用程序/x-rtp,媒体=视频,时钟速率=90000,编码名称=H264,有效负载=96”! rtph264depay!解码器! autovideosink 我没有看到弹出的视频窗口。我实际上几乎没有日志(即使我设置了 -vvv 参数)。你有什么进一步的提示吗?
    • 您是否从 sending 管道的调试输出中复制了功能?
    • 请使用发送管道的调试输出更新您的问题。
    • 我已经添加了日志。是的,我已经从发送方(x-rtp)拿走了大写。
    • 你的新管道没有任何问题(除了几个没用的queues)。这可能是一些与 Windows 相关的问题(或防火墙设置),我在这里没有帮助。对不起。
    猜你喜欢
    • 1970-01-01
    • 2013-01-31
    • 2018-05-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多