A simple script that brings RTSP to web. Usually helpful if you want to bring your video or IP cam streams to web.
-
Rename
.env.example
to.env
-
Replace
.env
variables respectively:RTSP_NAME=YourNameHere RTSP_URL=rtsp://user:pass@ip
-
Build this container by running this command:
docker build --tag rtsp2web .
-
After building the container, you can run it as follow:
docker run -p 8000:80 -p 1935:1935 rtsp2web
You can access the link to your stream as follows:
rtmp://localhost/live/<RTSP_NAME>
http://localhost/live/<RTSP_NAME>.flv
ws://localhost/live/<RTSP_NAME>.flv
http://localhost/live/<RTSP_NAME>/index.m3u8
http://localhost/live/<RTSP_NAME>/index.mpd
<script src="https://cdn.bootcss.com/flv.js/1.5.0/flv.min.js"></script>
<video id="videoElement"></video>
<script>
if (flvjs.isSupported()) {
var videoElement = document.getElementById('videoElement');
var flvPlayer = flvjs.createPlayer({
type: 'flv',
url: 'http://localhost/live/<RTSP_NAME>.flv'
});
flvPlayer.attachMediaElement(videoElement);
flvPlayer.load();
flvPlayer.play();
}
</script>
<script src="https://cdn.bootcss.com/flv.js/1.5.0/flv.min.js"></script>
<video id="videoElement"></video>
<script>
if (flvjs.isSupported()) {
var videoElement = document.getElementById('videoElement');
var flvPlayer = flvjs.createPlayer({
type: 'flv',
url: 'ws://localhost/live/<RTSP_NAME>.flv'
});
flvPlayer.attachMediaElement(videoElement);
flvPlayer.load();
flvPlayer.play();
}
</script>
Note: <RTSP_NAME>
is the value you set in for <RTSP_NAME> in your .env
file.
You can access the dashboard at:
http://localhost/admin
If you want to customize the settings, you can refer to Node-Media-Server which this script is based on.