opencv rtsp stream freezing
Hi,
I have a live view system - DS-7108HWI-SL from HIKVISION. I am using opencv 2.4.13 to capture its rtsp stream from one channel. The channel options are :
<streamingchannel version="1.0"><id>301</id><channelname/><enabled>true</enabled><transport><rtspportno>554</rtspportno><controlprotocollist><controlprotocol><streamingtransport>RTSP</streamingtransport></controlprotocol></controlprotocollist></transport><video><enabled>true</enabled><videoinputchannelid>3</videoinputchannelid><videocodectype>H.264</videocodectype><videoresolutionwidth>960</videoresolutionwidth><videoresolutionheight>576</videoresolutionheight><videoqualitycontroltype>VBR</videoqualitycontroltype><fixedquality>60</fixedquality><vbruppercap>512</vbruppercap><vbrlowercap>32</vbrlowercap><maxframerate>2500</maxframerate><snapshotimagetype>JPEG</snapshotimagetype></video><audio><enabled>false</enabled><audioinputchannelid>3</audioinputchannelid><audiocompressiontype>G.711ulaw</audiocompressiontype></audio></streamingchannel>
This information is given by the system while giving an url in browser for the specific channel -in this case channel 3. So to access this stream - the rtsp protocol is used; video compression is h264.
I set the video stream url for my opencv application and I open it with a video capture object. Everything seems fine; for a couple of seconds I have a good fps but then the capture window that I display from opencv freezes and will block for tens of seconds then the process repeats (it works then after a short time it blocks).
I will appreciate if anyone could give me a hint of how to avoid this blocking.
Note that I used this application with an ip cam which provided a http stream and the video format was mjpg. There were small delays and jams but it was acceptable.
As an observation I do not know how reliable is rtsp with h264 in a WAN with lots of hops. I forgot to mention that I try to open the rtsp stream over internet - I am not in a local network. I mention that I tried the stream in vlc and there it blocks too. I tried from different locations with vlc and the same result. Is there another transport option? I checked in the video system but I saw only rtsp.