rtsp-stream is an easy to use, out of box solution that can be integrated into existing systems resolving the problem of not being able to play raw rtsp stream natively in browsers.
The application converts raw
RTSP streams into
The goal is make raw RTSP streams easily playable in browsers using HLS.
Supports transcoding based on traffic
The idea behind this is that it should not transcode anything until someone is actually watching the stream. This can help with network bottlenecks in systems where there are a lot of cameras installed.
There is a running go routine in the background that checks if a stream is being active or not. If it's not active anymore, the transcoding stops until the next request for that stream.
This functionality is configurable though so you can use it as a normal transcoding service if you would like.
Why should you use it with Docker?
Because the application relies on ffmpeg heavily therefore ensuring the environment is much easier with docker as everything comes with the image and you do not have to install anything besides docker. Other than installation, this way we can also avoid compatibility issues between operating systems.
The application has an offical Docker repository at Dockerhub, therefore you can easily run it with simple commands:
docker run -p 80:8080 roverr/rtsp-stream:2
There are 4 endpoints that are fully configurable to call
/start- to start transcoding of a stream
/stream/id/*fileId- static endpoint to serve video files for your browser
/list- lists streams already known
/stop- stops and removes a given stream
The application offers different ways for authentication. There are situations when you can get away with no authentication, just trusting requests because they are from reliable sources or just because they know how to use the API. In other cases, production cases, you definitely want to protect the service. This application was not written to handle users and logins, so authentication is as lightweight as possible.
By default there is no authentication what so ever. This can be useful if you have private subnets where there is no real way to reach the service from the internet. (So every request is kind of trusted.) Also works great if you just wanna try it out, maybe for home use.
You can use shared key JWT authentication for the service.
The service does not create any tokens, but your authentication service can create.
After it's created it can be validated in the transcoder using the same secret / keys.
It is the easiest way to integrate into existing systems.
The following environment variables are available for this setup:
|RTSP_STREAM_AUTH_JWT_ENABLED||Indicates if the service should use the JWT authentication for the requests||
|RTPS_STREAM_AUTH_JWT_SECRET||The secret used for creating the JWT tokens||
|RTSP_STREAM_AUTH_JWT_PUB_PATH||Path to the public shared RSA key.||
You won't need the private key for it because no signing happens in this application.
The application tries to be as flexible as possible therefore there are a lot of configuration options available. You can set the following information in the application:
Check the full list of environment variables here
You can use the included UI for handling the streams. The UI is not a compact solution right now, but it gets the job done.
Running it with docker:
docker run -p 80:80 -p 8080:8080 roverr/rtsp-stream:2-management
If you decide to use the management image, you should know that port 80 is flexible, you can set it to whatever you prefer, but 8080 is currently burnt into the UI as the ultimate port of the backend.
You should expect something like this:
Debug information is described here
The following list of players has been already tried out in production environment using this backend:
See more information about this here.