RTSP Stream to WebBrowser MSE or WebRTC or HLS, full native! not use ffmpeg or gstreamer
- [Installation from binary](#Installation from binary)
- [Installation from source](#Installation from source)
- Configuration
- [API Documentation](#API documentation)
- Limitations
- Performance
- Authors
- License
- Download source
$ git clone https://github.com/deepch/RTSPtoWeb
- CD to Directory
$ cd RTSPtoWeb/
- Test Run
$ GO111MODULE=on go run *.go
- Open Browser
open web browser http://127.0.0.1:8083 work chrome, safari, firefox
on_demand true - receive video from source only has viewer
on_demand false - receive video from source any time
you can set mode use config "on_demand": true or "on_demand": false
###Options
####Server section's
debug - enable debug output
log_level - log level
http_debug - debug http api server
http_login - http auth login
http_password - http auth password
http_port - http server port
rtsp_port - rtsp server port
####Stream section's
name - stream name
####Stream section's
name - channel name
url - channel rtsp url
on_demand - stream mode static (run any time) or ondaemand (run only has viewers)
debug - enable debug output (RTSP client)
status - default stream status
{
"server": {
"debug": true,
"log_level": "info",
"http_demo": true,
"http_debug": false,
"http_login": "demo",
"http_password": "demo",
"http_port": ":8083",
"rtsp_port": ":5541"
},
"streams": {
"demo1": {
"name": "test video stream 1",
"channels": {
"0": {
"name": "ch1",
"url": "rtsp://admin:admin@YOU_CAMERA_IP/uri",
"on_demand": true,
"debug": false,
"status": 0
},
"1": {
"name": "ch2",
"url": "rtsp://admin:admin@YOU_CAMERA_IP/uri",
"on_demand": true,
"debug": false,
"status": 0
}
}
},
"demo2": {
"name": "test video stream 2",
"channels": {
"0": {
"name": "ch1",
"url": "rtsp://admin:admin@YOU_CAMERA_IP/uri",
"on_demand": true,
"debug": false,
"status": 0
},
"1": {
"name": "ch2",
"url": "rtsp://admin:admin@YOU_CAMERA_IP/uri",
"on_demand": true,
"debug": false,
"status": 0
}
}
}
}
}
######Use help show arg
./RTSPtoWeb --help
######Response
Usage of ./RTSPtoWeb:
-config string
config patch (/etc/server/config.json or config.json) (default "config.json")
-debug
set debug mode (default true)
##API documentation
GET /streams
curl http://demo:[email protected]:8083/streams
{
"status": 1,
"payload": {
"demo1": {
"name": "test video",
"channels": {
"0": {
"name": "ch1",
"url": "rtsp://admin:admin@YOU_CAMERA_IP/uri",
"on_demand": true,
"debug": false,
"status": 0
},
"1": {
"name": "ch2",
"url": "rtsp://admin:admin@YOU_CAMERA_IP/uri",
"on_demand": true,
"debug": false,
"status": 0
}
}
},
"demo2": {
"name": "test video",
"channels": {
"0": {
"name": "ch1",
"url": "rtsp://admin:admin@YOU_CAMERA_IP/uri",
"on_demand": true,
"debug": false,
"status": 0
},
"1": {
"name": "ch2",
"url": "rtsp://admin:admin@YOU_CAMERA_IP/uri",
"on_demand": true,
"debug": false,
"status": 0
}
}
}
}
}
POST /stream/{STREAM_ID}/add
curl --header "Content-Type: application/json" \
--request POST \
--data '{
"name": "test video",
"channels": {
"0": {
"name": "ch1",
"url": "rtsp://admin:admin@YOU_CAMERA_IP/uri",
"on_demand": true,
"debug": false,
"status": 0
},
"1": {
"name": "ch2",
"url": "rtsp://admin:admin@YOU_CAMERA_IP/uri",
"on_demand": true,
"debug": false,
"status": 0
}
}
}' \
http://demo:[email protected]:8083/stream/{STREAM_ID}/add
{
"status": 1,
"payload": "success"
}
POST /stream/{STREAM_ID}/edit
curl --header "Content-Type: application/json" \
--request POST \
--data '{
"name": "test video",
"channels": {
"0": {
"name": "ch1",
"url": "rtsp://admin:admin@YOU_CAMERA_IP/uri",
"on_demand": true,
"debug": false,
"status": 0
},
"1": {
"name": "ch2",
"url": "rtsp://admin:admin@YOU_CAMERA_IP/uri",
"on_demand": true,
"debug": false,
"status": 0
}
}
}' \
http://demo:[email protected]:8083/stream/{STREAM_ID}/edit
{
"status": 1,
"payload": "success"
}
GET /stream/{STREAM_ID}/reload
curl http://demo:[email protected]:8083/stream/{STREAM_ID}/reload
{
"status": 1,
"payload": "success"
}
GET /stream/{STREAM_ID}/reload
curl http://demo:[email protected]:8083/stream/{STREAM_ID}/channel/{CHANNEL_ID}/reload
{
"status": 1,
"payload": "success"
}
GET /stream/{STREAM_ID}/info
curl http://demo:[email protected]:8083/stream/{STREAM_ID}/info
{
"status": 1,
"payload": {
"name": "test video",
"channels": {
"0": {
"name": "ch1",
"url": "rtsp://admin:admin@YOU_CAMERA_IP/uri",
"on_demand": true,
"debug": false,
"status": 0
},
"1": {
"name": "ch2",
"url": "rtsp://admin:admin@YOU_CAMERA_IP/uri",
"on_demand": true,
"debug": false,
"status": 0
}
}
}
}
GET /stream/{STREAM_ID}/delete
curl http://demo:[email protected]:8083/stream/{STREAM_ID}/delete
{
"status": 1,
"payload": "success"
}
POST /stream/{STREAM_ID}/channel/{CHANNEL_ID}/add
curl --header "Content-Type: application/json" \
--request POST \
--data '{
"name": "ch4",
"url": "rtsp://admin:admin@YOU_CAMERA_IP/uri",
"on_demand": false,
"debug": false,
"status": 0
}' \
http://demo:[email protected]:8083/stream/{STREAM_ID}/channel/{CHANNEL_ID}/add
{
"status": 1,
"payload": "success"
}
POST /stream/{STREAM_ID}/channel/{CHANNEL_ID}/edit
curl --header "Content-Type: application/json" \
--request POST \
--data '{
"name": "ch4",
"url": "rtsp://admin:admin@YOU_CAMERA_IP/uri",
"on_demand": true,
"debug": false,
"status": 0
}' \
http://demo:[email protected]:8083/stream/{STREAM_ID}/channel/{CHANNEL_ID}/edit
{
"status": 1,
"payload": "success"
}
GET /stream/{STREAM_ID}/channel/{CHANNEL_ID}/reload
curl http://demo:[email protected]:8083/stream/{STREAM_ID}/channel/{CHANNEL_ID}/reload
{
"status": 1,
"payload": "success"
}
GET /stream/{STREAM_ID}/channel/{CHANNEL_ID}/info
curl http://demo:[email protected]:8083/stream/{STREAM_ID}/channel/{CHANNEL_ID}/info
{
"status": 1,
"payload": {
"name": "ch4",
"url": "rtsp://admin:admin@YOU_CAMERA_IP/uri",
"on_demand": false,
"debug": false,
"status": 1
}
}
GET /stream/{STREAM_ID}/{CHANNEL_ID}/codec
curl http://demo:[email protected]:8083/stream/{STREAM_ID}/{CHANNEL_ID}/codec
{
"status": 1,
"payload": [
{
"Record": "AU0AFP/hABRnTQAUlahQfoQAAAMABAAAAwCiEAEABGjuPIA=",
"RecordInfo": {
"AVCProfileIndication": 77,
"ProfileCompatibility": 0,
"AVCLevelIndication": 20,
"LengthSizeMinusOne": 3,
"SPS": [
"Z00AFJWoUH6EAAADAAQAAAMAohA="
],
"PPS": [
"aO48gA=="
]
},
"SPSInfo": {
"ProfileIdc": 77,
"LevelIdc": 20,
"MbWidth": 20,
"MbHeight": 15,
"CropLeft": 0,
"CropRight": 0,
"CropTop": 0,
"CropBottom": 0,
"Width": 320,
"Height": 240
}
}
]
}
GET /stream/{STREAM_ID}/channel/{CHANNEL_ID}/delete
curl http://demo:[email protected]:8083/stream/{STREAM_ID}/channel/{CHANNEL_ID}/delete
{
"status": 1,
"payload": "success"
}
GET /stream/{STREAM_ID}/hls/live/index.m3u8
curl http://127.0.0.1:8083/stream/{STREAM_ID}/channel/{CHANNEL_ID}/hls/live/index.m3u8
index.m3u8
ffplay http://127.0.0.1:8083/stream/{STREAM_ID}/channel/{CHANNEL_ID}/hls/live/index.m3u8
ffplay -rtsp_transport tcp rtsp://127.0.0.1/{STREAM_ID}/{CHANNEL_ID}
http://localhost:8083/pages/multiview/full?grid=5
http://localhost:8083/pages/multiview/full?controls
Video Codecs Supported: H264 all profiles
Audio Codecs Supported: no
CPU usage โ0.2%-1% one (thread) core cpu intel core i7 per stream
See also the list of contributors who participated in this project.
This project licensed. License - see the LICENSE.md file for details
webrtc follows license MIT license.
joy4 follows license MIT license.
Examples of working with video on golang
- You can make one-time donations via PayPal. I'll probably buy a
coffee tea. ๐ต