I want to capture the RTSP video stream from an ip camera using Nexus S. To watch the stream using VideoView and a media player is not a problem.
I tried to save it as follows:
URL url = new URL("rtsp://192.168.4.222:554/ipcam.sdp"); URLConnection ucon = url.openConnection(); ucon.connect(); InputStream is = ucon.getInputStream(); fos = new FileOutputStream(VideoFile); bis = new BufferedInputStream(is); isRecording = true; baf = new ByteArrayBuffer(50); int current = 0; FileOutputStream fos = new FileOutputStream(VideoFile); while (((current = bis.read()) != -1) & isRecording) { baf.append((byte) current); fos.write(baf.toByteArray()); baf.clear(); } fos.close();
I get MalformedURLException because android does not support rtsp: // urls.
Does anyone know how to solve this problem?
source share