How to fix delay (latency) of my OPENCV stream

asked 2014-06-05 11:06:37 -0500

isra60 gravatar image

updated 2014-06-05 11:07:57 -0500

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

edit retag flag offensive close merge delete