Ask Your Question

VideoCapture blocked after loosing connection

asked 2015-06-12 02:53:02 -0600

yari gravatar image

Hi everybody,

I have this problem, I am using opencv 2.4.10 to read a rtsp stream.

I used the VideoCapture end everything is going fine.

The problem is that I need to handle connection lost and failure during the opening of the connection.

At the moment I have two similar problem:

1) When I am trying to open the stream ( cv::VideoCapture inputVideo("rtsp://..."); ) and the streaming server is not available the program stay blocked forever without any error message.

2) If during the reading of the stream the connection is lost the program stay blocked forever without any error message.

There is a way to handle this problem?



edit retag flag offensive close merge delete


@yari this is a known problem with rstp streams in the VideoCapture interface. It just assumes that the stream is open and stable and gives limited streaming functionality. If you want to avoid that and have error handling, you are better off with a third party c++ package for the streaming handling.

Since you are using OpenCV2.4.10 the possibility is large that there is already some update that fixed this. First look at the latest 2.4 branch or the latest master branch, compile that one and see if it still exists.

StevenPuttemans gravatar imageStevenPuttemans ( 2015-06-12 04:27:57 -0600 )edit

2 answers

Sort by ยป oldest newest most voted

answered 2017-03-23 11:51:22 -0600

Will_agner gravatar image

Post of the long time a go, but i have this problem to...

You managed to solve?

I no have acess to look in youtube now, i see later.

edit flag offensive delete link more

answered 2015-06-12 04:02:03 -0600

Well there are so many videos available on youtube regarding your query. Go and watch them.

edit flag offensive delete link more


Seriously, your remark is inappropriate and just plain stupid. Consider this a warning.

StevenPuttemans gravatar imageStevenPuttemans ( 2015-06-12 04:25:40 -0600 )edit

Sorry, but I can find lot of videos explaining how to set up a videoCapture in order to read a video, but no one that explain how to handle connection lost. May you link one video here please?

yari gravatar imageyari ( 2015-06-12 04:33:23 -0600 )edit

@StevenPuttemans Well my remark is not inappropriate I think your searching way is not quite good to found useful things on the net. For your help I am giving a link check out there are so many videos related to such problems and more out there.

JavierMosher gravatar imageJavierMosher ( 2015-06-13 00:24:13 -0600 )edit

Question Tools

1 follower


Asked: 2015-06-12 02:53:02 -0600

Seen: 1,936 times

Last updated: Jun 12 '15