0

I want to implement something like below:

  1. Reading the video stream from IP-Camera by using RTSP (which is done)
  2. Processing the image by OpenCV (which is done)
  3. Sending the image to the browser to display (which is the problem)

The third part I want to send the images as video stream by using the RTSP protocol.

enter image description here

Note: The language which has used on the server side is Java (OpenCV also is in Java), and the server is TomCat.

And if someone thinks that using RTSP to implement is not better, then what the best way to achieve this functionality, because RTSP is special for video stream so I think this can be the better choice.

Bahramdun Adil
  • 5,907
  • 7
  • 35
  • 68
  • You can achieve this with opencv+ffmpeg+ffserver. I can write a detailed answer but it will take a while. – zindarod Oct 25 '17 at 13:56
  • OK, thanks for the help. Yes, I am now using ffmpeg to get the stream by using RTSP, but now send back to the clink by RTSP is the question, If I using some other technics like UDP/TCP maybe not the best way especially for a long time running applications. – Bahramdun Adil Oct 25 '17 at 14:00
  • It’s not possible to send rtsp to a browser without a plugin. – szatmary Oct 25 '17 at 14:31
  • Is there a reason you want to use RTSP for the output rather than one of the more usual streaming protocols? – Mick Oct 25 '17 at 15:17
  • No problem, any protocol, if can work better (stable, fast and less calculation time) are welcome. If you know the better way, please suggest me, I preferred RTSP because it is special for the video stream. – Bahramdun Adil Oct 25 '17 at 15:23

1 Answers1

0

The solution you select will most likely depend on the type of system you are building.

If you have a small number of users who will be happy to add a plugin to their browser then an RTSP based approach as you have outlined may work - an example plugin for chrome you could experiment with is

The more usual solution is to convert the RTSP stream into a HTTP stream using a proxy or streaming server - again the scale and size of your system will probably dictate what you want to do here.

A 'Rolls Royce' solution which will allow you address as many users as possible with as good quality as possible (based on the current landscape - video keeps changing...) might be:

  • video stream encoded with h.264
  • transcoded into multiple Bit rate versions to support ABR
  • packaged into fragmented mp4 and streamed with both HLS and MPEG DASH (for maximum device coverage)

ABR essentially allows the client device or player download the video in chunks, e.g 10 second chunks, and select the next chunk from the bit rate most appropriate to the current network conditions.

There is an example using GStreamer, an open source streaming server, and hls streaming in this answer here: https://stackoverflow.com/a/35002374/334402

I do realise your question mentioned TomCat and Java, but if you do want this level of service then I would really hesitate to build it from scratch yourself as there is a lot of specialist detail in a streaming server.

Mick
  • 24,231
  • 1
  • 54
  • 120
  • Thanks for the reply! The system which I going to build is not such complex, it will be run in a LAN (Local Area Network), and at most time there will be only one display client, so I want to choose a protocol which has less computation time and bandwidth, and a stable connection, in one PC there can be at most 8 channels of stream to be processed. If the computation cost of video transmission goes very high, so there will be not enough time for image process, and at the end, it will not satisfy the Real Time requirements. – Bahramdun Adil Oct 26 '17 at 01:50
  • On a LAN there will probably not be a bandwidth issue unless you have a very busy LAN, and it sounds like you don't need multiple bit rates so you could simply convert from RTSP to HTTP or to HLS using ffmpeg on your server - see the answers here for some RTSP to HLS for example: https://stackoverflow.com/q/19658216/334402. Note give you may be decoding each frame for your processing you may have more options also. – Mick Oct 26 '17 at 09:44