繁体   English   中英

gstreamer udp 流媒体很慢

[英]gstreamer udp Streaming is slow

我正在开发一个视频聊天应用程序,并且在使用 UDP 流与 TCP 时遇到问题。

当我使用下面的管道时,视频流可以接受。 (应用程序本身在 python 中,但管道基本如下)

sender: 

gst-launch-0.10 v4l2src ! video/x-raw-yuv,width=320,height=240 ! 
    theoraenc ! oggmux ! tcpclientsink host=nnn.nnn.nnn.nnn port = 5000

receiver: 

gst-launch-0.10 tcpserversrc host=nnn.nnn.nnn.nnn port=5000 
    ! decodebin ! xvimagesink

但是,由于此应用程序将跨/通过 NAT 执行,因此我需要 UDP 流式传输。 当我将 tcpserversrc 切换到“udpsrc port=5000”并将 tcpclientsink 切换到“udpsink host = nnn.nnn.nnn.nnnn port=5000”时,性能下降到接收计算机每 5 秒获得一帧的地步或者。 (即使两个流都在同一台机器上执行,也会发生这种情况)

发送管道生成以下内容(一次):

WARNING: from element /GstPipeline:pipeline0/GstUDPSink:udpsink0: 
    Internal data flow problem.
    Additional debug info:
    gstbasesink.c(3492): gst_base_sink_chain_unlocked (): /GstPipeline:pipeline0
    /GstUDPSink:udpsink0:
    Received buffer without a new-segment. Assuming timestamps start from 0.

...并且接收管道生成(每 20 秒左右):

WARNING: from element /GstPipeline:pipeline0/GstXvImageSink:xvimagesink0: 
    A lot of buffers are being dropped.
    Additional debug info:
    gstbasesink.c(2739): gst_base_sink_is_too_late (): /GstPipeline:pipeline0
    /GstXvImageSink:xvimagesink0:
    There may be a timestamping problem, or this computer is too slow.

我已经阅读了文档和手册页,对 udpsink 的各种参数进行了摆弄,但效果不佳。 谁能指导我(毫无疑问是显而易见的)我完全没有得到的东西? 提前致谢:)

我有同样的问题。 尝试设置

sync=false

and

我有一个类似的问题。 我设法通过改变两件事来解决它(1)正如 Fuxi 提到的那样sync = false(2)在解码端添加大写以匹配编码管道。 例如,在您的情况下,例如gst-launch-0.10 tcpserversrc host=127.0.0.1 port=5000, decodebin, video/x-raw-yuv,width=320,height=240 ! ffmpegcolorspace ! xvimagesink sync=false gst-launch-0.10 tcpserversrc host=127.0.0.1 port=5000, decodebin, video/x-raw-yuv,width=320,height=240 ! ffmpegcolorspace ! xvimagesink sync=false gst-launch-0.10 tcpserversrc host=127.0.0.1 port=5000, decodebin, video/x-raw-yuv,width=320,height=240 ! ffmpegcolorspace ! xvimagesink sync=false应该可以工作(对我有用)。 我建议您同时在两个(服务器/客户端)管道中设置帧速率。 我首先启动解码管道(服务器),然后启动编码管道(客户端),否则它会失败。

更新:在适当的解码元素之间添加队列已经多次节省了我的尾巴。 例如gst-launch-0.10 tcpserversrc host=127.0.0.1 port=5000, queue, decodebin ! queue ! video/x-raw-yuv,width=320,height=240 ! ffmpegcolorspace ! xvimagesink sync=false gst-launch-0.10 tcpserversrc host=127.0.0.1 port=5000, queue, decodebin ! queue ! video/x-raw-yuv,width=320,height=240 ! ffmpegcolorspace ! xvimagesink sync=false gst-launch-0.10 tcpserversrc host=127.0.0.1 port=5000, queue, decodebin ! queue ! video/x-raw-yuv,width=320,height=240 ! ffmpegcolorspace ! xvimagesink sync=false 同样, videorate在某些情况下也帮助了我。

我正在使用这个命令,它就像一个魅力。

服务器端:

gst-launch v4l2src device=/dev/video1 ! ffenc_mpeg4 ! rtpmp4vpay send-config=true ! udpsink host=127.0.0.1 port=5000

客户端:

gst-launch udpsrc uri=udp://127.0.0.1:5000 caps="application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)MP4V-ES, profile-level-id=(string)1, config=(string)000001b001000001b58913000001000000012000c48d88007d0a041e1463000001b24c61766335322e3132332e30, payload=(int)96, ssrc=(uint)298758266, clock-base=(uint)3097828288, seqnum-base=(uint)63478" ! rtpmp4vdepay ! ffdec_mpeg4 ! autovideosink

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM