UDP H264 stream

asked 2017-11-12 10:22:59 -0500

Hi everyone, I'm new to opencv and I'm trying to view a UDP H264 stream coming from a camera.

I tried that way

cv::VideoCapture * stream = new cv::VideoCapture("udp://@");
if (!stream->isOpened()) return -1;

cv::namedWindow("udp_stream", CV_WINDOW_AUTOSIZE);
cv::Mat frame;

while (true) {

    if (!stream->read(frame)) return -1;

    cv::imshow("udp_stream", frame);

but after a few seconds isOpened are false and the code ends.

The code works correctly with an RTSP stream.

If I try to use, for example, gStreamer or VLC I see the UDP flush on port 5000 properly.

Where am I wrong?

Thank you.

edit retag flag offensive close merge delete