Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to fix delay (latency) of my OPENCV stream

I have an IP camera which streams a rtsp The follow code allows me to show the rtsp stream

int main(int, char**) { cv::VideoCapture vcap; cv::Mat image;

const std::string videoStreamAddress = "rtsp://my_rtspstream";

//open the video stream and make sure it's opened
if(!vcap.open(videoStreamAddress)) {
    std::cout << "Error opening video stream or file" << std::endl;
    return -1;
}

for(;;) {
    if(!vcap.read(image)) {
        std::cout << "No frame" << std::endl;
        cv::waitKey();
    }
    cv::imshow("Output Window", image);
    if(cv::waitKey(1) >= 0) break;
}

} The problem is that i have about 450-600 ms of delay difference between what is the camera seeing and what i have o the window of opencv, and i need less becouse is camera with pt control.

Do you have any aproach? I should use another thing instead opencv??

Thanks

How to fix delay (latency) of my OPENCV stream

I have an IP camera which streams a rtsp The follow code allows me to show the rtsp stream

int main(int, char**) {
     cv::VideoCapture vcap;
     cv::Mat image;

image;

     const std::string videoStreamAddress = "rtsp://my_rtspstream";

 //open the video stream and make sure it's opened
 if(!vcap.open(videoStreamAddress)) {
     std::cout << "Error opening video stream or file" << std::endl;
     return -1;
}

    }

    for(;;) {
     if(!vcap.read(image)) {
         std::cout << "No frame" << std::endl;
         cv::waitKey();
    }
    }
        cv::imshow("Output Window", image);
     if(cv::waitKey(1) >= 0) break;
    }
}

} The problem is that i have about 450-600 ms of delay difference between what is the camera seeing and what i have o the window of opencv, and i need less becouse is camera with pt control.

Do you have any aproach? I should use another thing instead opencv??

Thanks