【问题标题】:Stream video using OpenCV, GStreamer使用 OpenCV、GStreamer 流式传输视频
【发布时间】:2016-10-12 18:54:35
【问题描述】:

我正在开发一个程序,该程序使用 GStreamer 捕获 raspicam 和流式传输。第一个课程,捕获 raspicam 没有问题。但是,接下来的课程是有一个大问题。我总共创建了 2 个源代码(服务器、客户端)。流数据非常慢。我有办法改善它吗?

请帮帮我。

谢谢。

----------- Server.cpp (Raspberry Pi, Raspbian) -----------

cap.set(CAP_PROP_FPS, 30);
cap.open(0);
//  Movie Frame Setup

fps         =   cap.get(CAP_PROP_FPS);
width       =   cap.get(CAP_PROP_FRAME_WIDTH);
height      =   cap.get(CAP_PROP_FRAME_HEIGHT);
cout << "Capture camera with " << fps << " fps, " << width << "x" << height << " px" << 

writer.open("appsrc ! gdppay ! tcpserversink host=192.168.0.29 port=5000", 0, fps, cv::Size(width, height), true);

while(1){
        printf("AA");
        cap >> frame;
        writer << frame;


}

----------- Client.cpp (PC, Ubuntu) -----------

Mat test;
String captureString = "tcpclientsrc host=192.168.0.29 port=5000 ! gdpdepay ! appsink";

VideoCapture cap(captureString);//0); 

namedWindow("t");
while(1)
{


    cap >> test;

    imshow("t", test);

    if( waitKey(10) > 0)
        break;
}

}

【问题讨论】:

  • “我有办法改进它吗?” 你最好在SE Code Review 询问以改进工作代码。
  • 您好,先生!你是如何解决问题的?我也有同样的问题。谢谢!

标签: c++ opencv streaming gstreamer


【解决方案1】:

您可能会受益于使用 udp 流而不是 tcp。查看this link 的示例,其中视频从 rpi 流式传输到 pc,延迟仅为 100 毫秒。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-11-01
    • 2013-09-22
    • 2019-01-26
    • 1970-01-01
    • 1970-01-01
    • 2019-10-16
    • 2013-06-23
    • 2013-07-26
    相关资源
    最近更新 更多