Ask Your Question

aestaq's profile - activity

2018-12-22 09:03:46 -0600 received badge  Student (source)
2017-04-27 07:53:52 -0600 commented question build openCV-3.1.0 with GStreamer windows

Check this http://answers.opencv.org/question/65059/opencv-300-build-winder-windows-8-with-gstreamer10-support/ (http://answers.opencv.org/question/65...)

2016-12-19 13:20:38 -0600 received badge  Enthusiast
2016-11-19 14:38:28 -0600 received badge  Organizer (source)
2016-11-14 14:41:16 -0600 received badge  Editor (source)
2016-11-13 09:49:27 -0600 asked a question Videocapture grab function does not return (blocking call) when IP camera is disconnected.

The problem which I am facing is that the grab function of Videocapture object gets stuck when my IP cam is disconnected. Ideally, the grab() function or the isOpened() function should return false on IP cam failure after some timeout but instead function isOpened() returns true and grab() doesn't return anything (stuck at grabbing).

I am using python2.7 interpreter and I have tried this on ubuntu 14.04 and windows 10 with prebuilt opencv package, manually compiled opencv 2.4.13 and 3.1.0 with ffmpeg. Same result on all the versions.

I searched on different forums and dug into the source files to pinpoint the line, function and the file where the grab call is getting stuck. So the function CvCapture_FFMPEG::grabFrame() (sources/modules/highgui/src/cap_ffmpeg_impl.h) is stuck in while loop when IP camera is disconnected and somehow the timeout interrupt is not working in this case. I have checked this by adding log statements at different points in the CvCapture_FFMPEG::grabFrame() function.

So is this the problem with ffmpeg libraries or the CvCapture_FFMPEG::grabFrame() function or am I missing something?

Note: This problem does not occur when I compile OpenCV with gstreamer (either 0.10 or 1.0). There grab() function returns false on IP camera disconnect. I have tested this on opencv 2 and 3 on ubuntu 14.04 and windows 10.

2016-11-13 04:37:25 -0600 commented question OpenCV - Python Instalation

What is the C and CXX compiler identification number identified by the cmake-gui? Secondly, have you launched the Visual Studio 11 2012 even once after you installed it. If not, do it and then go to step 7.

2016-11-13 00:40:07 -0600 answered a question Videocapture suddenly blocks on reading a frame from IP camera

I have also faced the same problem while capturing frames from IP camera. I searched on different forums and dug into the source files to pinpoint the line, function and the file where the grab call is getting stuck. So the function CvCapture_FFMPEG::grabFrame() (sources/modules/highgui/src/cap_ffmpeg_impl.h) is stuck in while loop (check the file for clarity) when IP camera is disconnected and somehow the timeout interrupt is not working in this case. You can check yourself by adding log statements at different points in the CvCapture_FFMPEG::grabFrame() function.

So now coming to the solution. There are two ways: First, make a separate thread in which you call the grab frame function. Monitor this thread in the main thread. When the grab function blocks the thread then kill this thread on timeout (which you can decide) and respawn again if you want to retry grabbing the frame. The other way around is to compile OpenCV with Gstreamer instead of ffmpeg (install gstreamer libraries and set the flags as WITH_GSTREAMER=ON and WITH_FFMPEG=OFF when compiling the OpenCV). After compiling with Gstreamer test the grab function: it will return false when your IP camera is disconnected (the way you expected the grab function to work).

2016-11-12 05:32:11 -0600 received badge  Supporter (source)