You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用GStreamer UDP推流出现黑屏 求解决方案

解决UDP推流黑屏的GStreamer管道方案

原管道的问题点

  • 端口不匹配:服务器端udpsink使用5000端口,但接收端udpsrc监听5001端口,导致接收不到数据流
  • 视频格式不兼容:服务器端输出I420(对应YCbCr-4:2:0),但接收端caps指定YCbCr-4:2:2,格式不匹配导致解码失败
  • 接收端caps参数错误:a-framerate应为framerate,且需用分数格式30/1

修正后的推流管道

服务器端(i.MX6Dual Processor)

gst-launch-1.0 v4l2src device=/dev/video0 ! videoconvert ! videoscale ! videorate ! video/x-raw,width=720,height=576,format=I420,framerate=30/1 ! rtpvrawpay ! udpsink host=192.168.0.105 port=5000 sync=false

注:请确认host参数为接收端Ubuntu 18的实际IP,若原IP162.168.0.105是正确的则保留,否则替换为真实局域网IP

接收端(Ubuntu 18 x86系统)

gst-launch-1.0 udpsrc port=5000 caps="application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)RAW,sampling=(string)YCbCr-4:2:0,depth=(string)8,width=(string)720,height=(string)576,payload=(int)96,framerate=(fraction)30/1" ! rtpvrawdepay ! videoconvert ! queue ! xvimagesink sync=false

额外排查建议

  • 先验证网络连通性:在服务器端执行ping 接收端IP,确保两台设备在同一局域网且能互通
  • 服务器端本地预览验证:执行gst-launch-1.0 v4l2src ! videoconvert ! video/x-raw,width=720,height=576,format=I420,framerate=30/1 ! xvimagesink,确认摄像头采集正常
  • 若接收端xvimagesink兼容性差,替换为autovideosink:
    gst-launch-1.0 udpsrc port=5000 caps="application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)RAW,sampling=(string)YCbCr-4:2:0,depth=(string)8,width=(string)720,height=(string)576,payload=(int)96,framerate=(fraction)30/1" ! rtpvrawdepay ! videoconvert ! queue ! autovideosink sync=false
    
  • 启用调试日志排查细节:在管道前添加GST_DEBUG=3,例如GST_DEBUG=3 gst-launch-1.0 ...,查看是否有格式不支持、数据丢失等错误提示

内容的提问来源于stack exchange,提问作者Virti Choksi

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.03 11:31:04