JavaCV class may be connected in the live stream FrameGrabber address decoding, Frame acquires frame information, commonly used as follows
FrameGrabber grabber = new FrameGrabber("rtsp:/192.168.0.0");
grabber.start();
while(true) {
Frame frame = grabber.grabImage();
// ...
}
In fact the internal call is ffmpeg's avformat_open_input () method to resolve network flow, and ffmpeg's avformat_open_input () is blocked by default.
When parsing errors encountered network flow, it causes the function does not return for a long time. For this purpose the set parameters -stimeout ffmpeg, pay attention to the unit is us -stimeout microseconds (1 second = 1 * 1000 * 1000 microseconds).
Usage (set before parsing the url):
1.javaCV
FrameGrabber grabber = new FrameGrabber("rtsp:/192.168.0.0");
// Increase the timeout parameter grabber.setOption("stimoout", "5*1000*1000");
grabber.start; while(true) { Frame frame = grabber.grabImage(); // ... }
2.ffmpeg command line
ffmpeg -stimeout 5000000 -i rtsp://admin:[email protected]:554/h264...........