gstreamer udp 流传输速度很慢
我正在开发一个视频聊天应用程序,并且在 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的各种参数,都没有什么好的效果。 谁能指导我了解我完全没有得到的(无疑是显而易见的)事情? 提前致谢 :)
I'm working on a videochat application and am having trouble with UDP streaming vs TCP.
When I use the pipelines below, the video streams acceptably. (The application itself is in python, but the pipelines are essentially as below)
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
However, since this app is to perform across/through NAT, I require UDP streaming.
When I switch the tcpserversrc to a "udpsrc port=5000" and the tcpclientsink to a "udpsink host = nnn.nnn.nnn.nnnn port=5000", performance plummets to the point where the receiving computer gets one single frame every 5 seconds or so. (This occurs even when both streams are executed on the same machine)
The sending pipeline generates the following (once):
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.
...and the receiving pipeline generates (every 20 seconds or so):
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.
I've read docs and manpages, fiddled with various parameters to the udpsink, all to no good effect.
Can anyone direct me to the (no doubt obvious) thing that I'm completely not getting?
Thanks in advance :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我也有同样的问题。
尝试
在 tcpclientsink 和 xvimagesink 上进行设置
I had the same problem.
Try setting
on tcpclientsink and xvimagesink
我有类似的问题。我设法通过改变两件事来解决这个问题 (1) 正如 Fuxi 提到的
sync = false
和 (2) 在解码端添加上限匹配编码管道。例如,在您的情况下,类似gst-launch-0.10 tcpserversrc host=127.0.0.1 port=5000 !解码器!视频/x-raw-yuv,宽度=320,高度=240! ffmpeg颜色空间! xvimagesinksync=false
应该可以工作(它对我有用)。我建议您在两个(服务器/客户端)管道中也设置帧速率。 我首先启动解码管道(服务器),然后启动编码管道(客户端),否则 OFCOURSE 会失败。更新:
在适当的解码元素之间添加队列已经多次拯救了我的尾巴。例如gst-launch-0.10 tcpserversrc主机=127.0.0.1端口=5000!队列 !解码器!队列 !视频/x-raw-yuv,宽度=320,高度=240! ffmpeg颜色空间! xvimagesinksync=false。同样,视频速率在某些情况下对我有帮助。
I had a similar problem. I managed to solve it by changing two things (1) As Fuxi mentioned
sync = false
and (2) Adding caps at the decoding side to match the encoding pipeline. For e.g. in your case something likegst-launch-0.10 tcpserversrc host=127.0.0.1 port=5000 ! decodebin ! video/x-raw-yuv,width=320,height=240 ! ffmpegcolorspace ! xvimagesink sync=false
should work (It works for me). I would recommend you set the frame rate in both (server/client) the pipelines as well. I start the decoding pipeline first (server) and then the encoding pipeline (client) otherwise OFCOURSE it fails.Update:
Adding queue between the appropriate decoding elements have saved my tail numerous times. e.g.
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
. Similarly videorate has helped me in some situations.我正在使用这个命令,它的工作方式就像一个魅力。
服务器端:
客户端:
i am using this command and it working like a charm.
server side:
Client side: