Capture image from an RTSP stream
Marcounnet
Posted messages
22
Status
Member
-
Marcounnet Posted messages 22 Status Member -
Marcounnet Posted messages 22 Status Member -
Hello,
I am currently trying to retrieve images from an RTSP stream using Java code.
I have an address URL in rtsp://host/file pointing to a camera, and right now I am doing the following to recover the stream image by image:
However, although this works perfectly with an http:// URL (I specify that I do not want to keep this HTTP address since I cannot obtain it automatically depending on my camera, unlike my RTSP URL), it does not work with my rtsp:// URL.
To work around this problem, I tried turning to JMF (which apparently has become obsolete…) and RtspUrl. I also tried to dissect my RTSP URL to transform it into http://host/file, but although it does not return any errors, it does not return any images either^^
There you go, I have tried to be as clear as possible to explain my problem; I hope someone can help me, even if it’s just to tell me that it is not possible (but I doubt that^^)
Thank you in advance.
I am currently trying to retrieve images from an RTSP stream using Java code.
I have an address URL in rtsp://host/file pointing to a camera, and right now I am doing the following to recover the stream image by image:
url = new URL(rtspAddr); InputStream is = url.openStream(); OutputStream os = new FileOutputStream(dst); byte[] b = new byte[2048]; int length; while ((length = is.read(b)) != -1) { os.write(b, 0, length); } is.close(); os.close();
However, although this works perfectly with an http:// URL (I specify that I do not want to keep this HTTP address since I cannot obtain it automatically depending on my camera, unlike my RTSP URL), it does not work with my rtsp:// URL.
To work around this problem, I tried turning to JMF (which apparently has become obsolete…) and RtspUrl. I also tried to dissect my RTSP URL to transform it into http://host/file, but although it does not return any errors, it does not return any images either^^
There you go, I have tried to be as clear as possible to explain my problem; I hope someone can help me, even if it’s just to tell me that it is not possible (but I doubt that^^)
Thank you in advance.