Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

stream RTSP to HTML website

I would like to display IP cameras streaming in RTSP into a web page.

I've tried many solutions, like using VLC to transcode the stream, but none of them seems to be reliable enough to create a real web service. I'm thinking on using some media server like flussonic or Red5. But I don't know if it will work.

This is why I would like to know what is the best (and the simple) solution to display RTSP streams on a webpage.

like image 682
Arnaud Geotribu Avatar asked Mar 04 '17 16:03

Arnaud Geotribu


People also ask

Can you view an RTSP stream with a browser?

As a rule, browsers do not support RTSP, so the video stream is converted for a browser using an intermediate server.

Does HTML5 support RTSP?

One can't directly play RTSP (Real Time Streaming Protocol) streams on HTML5 webpage since RTSP is not supported by the HTML5 <video> tag. But RTSP HTML5 playback is achievable if you transcode RTSP to HTTP, and you can also implement RTSP live streaming by doing so. Keep reading and I'll show you how.

Can Chrome open RTSP stream?

Direct RTSP streaming is still not supported by browsers, if you have to play an RTSP stream in the browser then you need a proxy server that will convert RTSP to HTTP stream.


1 Answers

...to create a real web service.

I've been looking for an answer for the past two or three days (I need support on as many browsers as possible, and latency as low as possible, so WebRTC was the way to go (is there anything better?)) and I've finally found it.

Check out this repo.

From the repo's readme + the additional steps I had to take (on Ubuntu 18.04) to make this work:

  1. Install go

    $ sudo snap install go --classic

  2. Get the code on your local device (Could someone enlighten me on what the export is for?).

    $ export GO111MODULE=on

    $ go get github.com/deepch/RTSPtoWebRTC

  3. This step didn't work for me, so I just downloaded the code in a .zip file and extracted it in the given directory and proceeded. (What did I miss? The src directory was not there before I made it)

    $ cd ~/go/src/github.com/deepch/RTSPtoWebRTC

  4. Run from current directory.

    $ go run .

  5. Then I opened the link below a web browser ( I tested on Chrome, iOS Safari, but it also works on Firefox).

    http://127.0.0.1:8083

This took me very little time to implement. Big thanks to the guys making this. All the other stuff I've found is either 5-7 years old and not working or non-WebRTC or a marketed paid service asking for unreasonable amounts of money.

I hope I answered your question.

like image 172
Mikaels Slava Avatar answered Oct 04 '22 09:10

Mikaels Slava