RTSPtoWeb
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
ytx@queuingsystem.cn 2a37fbf7be feat(数据库): 添加MySQL和SQL Server数据库支持并实现摄像头管理功能
实现数据库集成功能,支持MySQL和SQL Server作为后端存储。主要变更包括:
1. 新增数据库配置结构和初始化逻辑
2. 添加摄像头管理API接口和Web页面
3. 实现流配置与数据库的同步机制
4. 新增数据库初始化SQL脚本和文档
5. 优化日志系统和启动流程

同时更新了前端界面,完成中文本地化适配,并添加了相关API文档。
8 months ago
.github/workflows Initial commit 1 year ago
.vscode feat(数据库): 添加MySQL和SQL Server数据库支持并实现摄像头管理功能 8 months ago
docs feat(数据库): 添加MySQL和SQL Server数据库支持并实现摄像头管理功能 8 months ago
web feat(数据库): 添加MySQL和SQL Server数据库支持并实现摄像头管理功能 8 months ago
.gitignore Initial commit 1 year ago
DATABASE_README.md feat(数据库): 添加MySQL和SQL Server数据库支持并实现摄像头管理功能 8 months ago
Dockerfile Initial commit 1 year ago
LICENSE.md Initial commit 1 year ago
Makefile Initial commit 1 year ago
README.md Initial commit 1 year ago
RTSPtoWeb.exe feat(数据库): 添加MySQL和SQL Server数据库支持并实现摄像头管理功能 8 months ago
RTSPtoWeb.go feat(数据库): 添加MySQL和SQL Server数据库支持并实现摄像头管理功能 8 months ago
SECURITY.md Initial commit 1 year ago
apiHTTPCamera.go feat(数据库): 添加MySQL和SQL Server数据库支持并实现摄像头管理功能 8 months ago
apiHTTPChannel.go Initial commit 1 year ago
apiHTTPHLS.go Initial commit 1 year ago
apiHTTPHLSLL.go Initial commit 1 year ago
apiHTTPMSE.go Initial commit 1 year ago
apiHTTPPages.go feat(数据库): 添加MySQL和SQL Server数据库支持并实现摄像头管理功能 8 months ago
apiHTTPRouter.go feat(数据库): 添加MySQL和SQL Server数据库支持并实现摄像头管理功能 8 months ago
apiHTTPSaveMP4.go Initial commit 1 year ago
apiHTTPServer.go Initial commit 1 year ago
apiHTTPStream.go Initial commit 1 year ago
apiHTTPWebRTC.go Initial commit 1 year ago
config.json feat(数据库): 添加MySQL和SQL Server数据库支持并实现摄像头管理功能 8 months ago
database.go feat(数据库): 添加MySQL和SQL Server数据库支持并实现摄像头管理功能 8 months ago
database_init.sql feat(数据库): 添加MySQL和SQL Server数据库支持并实现摄像头管理功能 8 months ago
go.mod feat(数据库): 添加MySQL和SQL Server数据库支持并实现摄像头管理功能 8 months ago
go.sum feat(数据库): 添加MySQL和SQL Server数据库支持并实现摄像头管理功能 8 months ago
hlsFragment.go Initial commit 1 year ago
hlsMuxer.go Initial commit 1 year ago
hlsSegment.go Initial commit 1 year ago
loggingLog.go feat(数据库): 添加MySQL和SQL Server数据库支持并实现摄像头管理功能 8 months ago
renovate.json Initial commit 1 year ago
server.crt Initial commit 1 year ago
server.key Initial commit 1 year ago
serverRTSP.go Initial commit 1 year ago
storageClient.go Initial commit 1 year ago
storageConfig.go feat(数据库): 添加MySQL和SQL Server数据库支持并实现摄像头管理功能 8 months ago
storageDatabase.go feat(数据库): 添加MySQL和SQL Server数据库支持并实现摄像头管理功能 8 months ago
storageServer.go Initial commit 1 year ago
storageStream.go feat(数据库): 添加MySQL和SQL Server数据库支持并实现摄像头管理功能 8 months ago
storageStreamChannel.go Initial commit 1 year ago
storageStreamHLS.go Initial commit 1 year ago
storageStruct.go feat(数据库): 添加MySQL和SQL Server数据库支持并实现摄像头管理功能 8 months ago
streamCore.go Initial commit 1 year ago
streamRemoteAuthorization.go Initial commit 1 year ago
supportFunc.go Initial commit 1 year ago
test.bytes Initial commit 1 year ago
test.curl Initial commit 1 year ago
test.exe feat(数据库): 添加MySQL和SQL Server数据库支持并实现摄像头管理功能 8 months ago
test_multi.curl Initial commit 1 year ago

README.md

RTSPtoWeb share you ip camera to world!

RTSPtoWeb converts your RTSP streams to formats consumable in a web browser like MSE (Media Source Extensions), WebRTC, or HLS. It's fully native Golang without the use of FFmpeg or GStreamer!

Table of Contents

Installation

Installation from source

  1. Download source
    $ git clone https://github.com/deepch/RTSPtoWeb
    
  2. CD to Directory
     $ cd RTSPtoWeb/
    
  3. Test Run
     $ GO111MODULE=on go run *.go
    
  4. Open Browser
    open web browser http://127.0.0.1:8083 work chrome, safari, firefox
    

Installation from docker

  1. Run docker container
    $ docker run --name rtsp-to-web --network host ghcr.io/deepch/rtsptoweb:latest 
    
  2. Open Browser
    open web browser http://127.0.0.1:8083 in chrome, safari, firefox
    

You may override the configuration /PATH_TO_CONFIG/config.json and mount as a docker volume:

$ docker run --name rtsp-to-web \
    -v /PATH_TO_CONFIG/config.json:/config/config.json \
    --network host \
    ghcr.io/deepch/rtsptoweb:latest 

Configuration

Server settings

debug           - enable debug output
log_level       - log level (trace, debug, info, warning, error, fatal, or panic)

http_demo       - serve static files
http_debug      - debug http api server
http_login      - http auth login
http_password   - http auth password
http_port       - http server port
http_dir        - path to serve static files from
ice_servers     - array of servers to use for STUN/TURN
ice_username    - username to use for STUN/TURN
ice_credential  - credential to use for STUN/TURN
webrtc_port_min - minimum WebRTC port to use (UDP)
webrtc_port_max - maximum WebRTC port to use (UDP)

https
https_auto_tls
https_auto_tls_name
https_cert
https_key
https_port

rtsp_port       - rtsp server port

Stream settings

name            - stream name

Channel settings

name            - channel name
url             - channel rtsp url
on_demand       - stream mode static (run any time) or ondemand (run only has viewers)
debug           - enable debug output (RTSP client)
audio           - enable audio
status          - default stream status

Authorization play video

1 - enable config

"token": {
"enable": true,
"backend": "http://127.0.0.1/file.php"
}

2 - try

rtsp://127.0.0.1:5541/demo/0?token=you_key

file.php need response json

   status: "1" or "0"

RTSP pull modes

  • on demand (on_demand=true) - only pull video from the source when there's a viewer
  • static (on_demand=false) - pull video from the source constantly

Example config.json

{
  "server": {
    "debug": true,
    "log_level": "info",
    "http_demo": true,
    "http_debug": false,
    "http_login": "demo",
    "http_password": "demo",
    "http_port": ":8083",
    "ice_servers": ["stun:stun.l.google.com:19302"],
    "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,
          "audio": true,
          "status": 0
        },
        "1": {
          "name": "ch2",
          "url": "rtsp://admin:admin@YOU_CAMERA_IP/uri",
          "on_demand": true,
          "debug": false,
          "audio": true,
          "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
        }
      }
    }
  },
  "channel_defaults": {
    "on_demand": true
  }
}

Command-line

Use help to show available args

./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

See the API docs

Limitations

Video Codecs Supported: H264 all profiles

Audio Codecs Supported: no

Performance

CPU usage ≈0.2%-1% one (thread) core cpu intel core i7 per stream

Authors

  • Andrey Semochkin - Initial work video - deepch
  • Dmitriy Vladykin - Initial work web UI - vdalex25

See also the list of contributors who participated in this project.

License

This project licensed. License - see the LICENSE.md file for details

webrtc follows license MIT license.

joy4 follows license MIT license.

Other Example

Examples of working with video on golang

paypal.me/AndreySemochkin - You can make one-time donations via PayPal. I'll probably buy a coffee tea. 🍵