Files
gb28181/README.md
T
2026-01-08 13:14:12 +08:00

303 lines
11 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
**English** | [中文](./README_CN.md)
<p align="center">
|<img src="./docs/logo.png" alt="GoWVP Logo" width="550"/>|<img src="./docs/logo2.png" alt="GoWVP Logo" width="550"/>|
|-|-|
</p>
<p align="center">
<a href="https://github.com/gowvp/owl/releases"><img src="https://img.shields.io/github/v/release/ixugo/goddd?include_prereleases" alt="Version"/></a>
</p>
# Out-of-the-Box Video Surveillance Platform
GoWVP is an open-source GB28181 solution implemented in Go, a network video platform based on the GB28181-2022 standard that also supports 2016/2011 versions, with ONVIF/RTMP/RTSP protocol support.
## Live Demo
+ [Online Demo Platform :)](http://gowvp.golang.space:15123/)
![](./docs/demo/play.gif)
|![](./docs/phone/login.webp)|![](./docs/phone/desktop.webp)|![](./docs/phone/gb28181.webp)|![](./docs/phone/discover.webp)|
|-|-|-|-|
## Use Cases
+ Browser-based camera video playback without plugins
+ Support for GB28181-compliant devices (IP cameras, platforms, NVRs, etc.)
+ Support for non-GB28181 devices (RTSP, RTMP, streaming devices, etc.) - maximize your existing equipment
+ Cross-network video preview
+ Deployment via Docker, Docker Compose, or Kubernetes
## Open Source Libraries
Thanks to @panjjo for the open-source library [panjjo/gosip](https://github.com/panjjo/gosip). GoWVP's SIP signaling is based on this library. Due to underlying encapsulation requirements, it's not a direct dependency but rather included in the pkg package.
Two streaming media servers are supported:
+ @夏楚 [ZLMediaKit](https://github.com/ZLMediaKit/ZLMediaKit)
+ **lalmax-pro** - For Go streaming media needs, contact email xx@golang.space
- No environment requirements, no static library installation needed, cross-platform compilation support
- Custom feature development available
- G711 (G711A/G711U) to AAC transcoding support
Player uses @dexter's [jessibuca](https://github.com/langhuihui/jessibuca/tree/v3)
Project framework based on @ixugo's [goddd](https://github.com/ixugo/goddd)
## FAQ
> Where are the frontend resources? How to load the web interface?
[Click to download www.zip package](https://github.com/gowvp/gb28181_web/releases/latest)
Download (packaged) frontend resources and place them in the project root directory, named `www` to load properly.
> Any learning materials about the code?
[GB/T28181 Open Source Diary[1]: Complete Practice from 0 to Implementing GB28181 Protocol](https://juejin.cn/post/7456722441395568651)
[GB/T28181 Open Source Diary[2]: Setting Up Server, Solving CORS, API Integration](https://juejin.cn/post/7456796962120417314)
[GB/T28181 Open Source Diary[3]: Building Monitoring Dashboard with React Components](https://juejin.cn/post/7457228085826764834)
[GB/T28181 Open Source Diary[4]: Using ESLint for Development](https://juejin.cn/post/7461539078111789108)
[GB/T28181 Open Source Diary[5]: Completing Forms with react-hook-form](https://juejin.cn/post/7461899974198181922)
[GB/T28181 Open Source Diary[6]: Quick Integration of jessibuca.js Player in React](https://juejin.cn/post/7462229773982351410)
[GB/T28181 Open Source Diary[7]: Implementing RTMP Authentication and Playback](https://juejin.cn/post/7463504223177261119)
[GB/T28181 Open Source Diary[8]: Quick Guide to GB28181 Development](https://juejin.cn/post/7468626309699338294)
> Any usage documentation?
**RTMP**
[RTMP Push/Pull Stream Rules](https://juejin.cn/post/7463124448540934194)
[How to Use OBS RTMP Push Stream to GB/T28181 Platform](https://juejin.cn/post/7463350947100786739)
[Hikvision Camera RTMP Push Stream to Open Source GB/T28181 Platform](https://juejin.cn/post/7468191617020313652)
[Dahua Camera RTMP Push Stream to Open Source GB/T28181 Platform](https://juejin.cn/spost/7468194672773021731)
**GB/T28181**
[7 Ways to Register GB28181 Devices](https://juejin.cn/post/7465274924899532838)
> Black screen when playing
Check "Quick Desktop" - "ZLM settings button (top right)" - "GB28181 stream receiving default address"
Ensure this address is accessible by the surveillance device.
Check "Quick Desktop" - "ZLM settings button (top right)" - "Hook IP"
Can ZLM access GoWVP? For Docker combined version, use 127.0.0.1. For separate deployment, use explicit IP address.
> Channel list shows fewer channels than actual count
By design. More than 4 channels should be viewed in the management page, or click "View More" on the right.
> Using nginx reverse proxy, returned playback addresses don't work or snapshots don't load
Configure the following parameters in reverse proxy (replace domain with your actual one):
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Prefix "https://gowvp.com";
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
> How to use other databases?
In the `configs/config.toml` configuration file, modify `database.dsn`
[Recommended] SQLite should be a local disk path, default is `configs/data.db`
[Recommended] PostgreSQL format: `postgres://postgres:123456@127.0.0.1:5432/gb28181?sslmode=disable`
MySQL format: `mysql://root:123456@127.0.0.1:5432/gb28181?sslmode=disable`
PostgreSQL and MySQL format pattern:
`<db_type>://<username>:<password>@<ip>:<port>/<db_name>?sslmode=disable`
> How to disable AI?
AI detection is enabled by default, detecting 5 frames per second.
You can disable AI detection by setting `disabledAI = true` in `configs/config.toml`
## Documentation
GoWVP [Online API Documentation](https://apifox.com/apidoc/shared-7b67c918-5f72-4f64-b71d-0593d7427b93)
ZLM Documentation [github.com/ZLMediaKit/ZLMediaKit](https://github.com/ZLMediaKit/ZLMediaKit)
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
<h1>You've made it this far!</h1>
<h1>Give us a ⭐ star!</h1>
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
## Docker
### Video Guide
[How to Build or Run the Project](https://www.bilibili.com/video/BV1QLQeYHEXb)
[How to Deploy with Docker Compose](https://www.bilibili.com/video/BV112QYY3EZX)
[Docker Hub](https://hub.docker.com/r/gospace/gowvp)
**GoWVP & ZLMediaKit Combined Image (Recommended)**
docker-compose.yml
```yml
services:
gowvp:
# If Docker Hub image is unavailable, try:
# registry.cn-shanghai.aliyuncs.com/ixugo/homenvr:latest
image: gospace/gowvp:latest
restart: unless-stopped
# For Linux, uncomment the line below and comment out all ports
# network_mode: host
ports:
# gb28181
- 15123:15123 # Management platform HTTP port
- 15060:15060 # GB28181 SIP TCP port
- 15060:15060/udp # GB28181 SIP UDP port
# zlm
- 1935:1935 # rtmp
- 554:554 # rtsp
- 8080:80 # http
- 8443:443 # https
- 10000:10000
- 8000:8000/udp
- 9000:9000/udp
- 20000-20100:20000-20100 # GB28181 stream receiving ports
- 20000-20100:20000-20100/udp # GB28181 stream receiving UDP ports
volumes:
# Log directory is configs/logs
- ./data:/opt/media/bin/configs
```
**GoWVP & ZLMediaKit Separate Images (More Complex Deployment)**
```yml
services:
gowvp:
image: registry.cn-shanghai.aliyuncs.com/ixugo/gowvp:latest
ports:
- 15123:15123 # Management platform HTTP port
- 15060:15060 # GB28181 SIP TCP port
- 15060:15060/udp # GB28181 SIP UDP port
volumes:
# - ./logs:/app/logs # Uncomment if you need persistent logs
- ./configs:/app/configs
depends_on:
- zlm
zlm:
image: zlmediakit/zlmediakit:master
restart: always
# Recommended: use host mode for Linux
# network_mode: host
ports:
- 1935:1935 # rtmp
- 554:554 # rtsp
- 8080:80 # api
- 8443:443
- 10000:10000
- 10000:10000/udp
- 8000:8000/udp
- 9000:9000/udp
- 20000-20100:20000-20100
- 20000-20100:20000-20100/udp
volumes:
- ./configs:/opt/media/conf
```
## Quick Start
If you're a Go developer familiar with Docker, you can download the source code and run locally.
**Prerequisites**
+ Golang
+ Docker & Docker Compose
+ Make
**Steps**
1. Clone this repository
2. Modify `WebHookIP` in `configs/config.toml` to your LAN IP
3. Run `make build/linux && docker compose up -d`
4. A `zlm.conf` folder is auto-created. Get the API secret from `config.ini` and fill it in `configs/config.toml` under `Secret`
5. Run `docker compose restart`
6. Access `http://localhost:15123` in your browser
## How to Contribute?
1. Fork this project
2. Set your editor's run/debug output directory to the project root
3. Make changes, submit a PR with description of modifications
## Features
- [x] Out-of-the-box with web interface
- [x] RTMP stream distribution support
- [x] RTSP stream distribution support
- [x] Multiple protocol output: HTTP_FLV, Websocket_FLV, HLS, WebRTC, RTSP, RTMP
- [x] LAN/Internet/Multi-layer NAT/Special network environment deployment
- [x] SQLite database for quick deployment
- [x] PostgreSQL/MySQL database support
- [x] Auto offline/reconnect on service restart
- [x] GB/T 28181
- [x] Device registration with 7 connection methods
- [x] UDP and TCP signaling transport modes
- [x] Device time synchronization
- [x] Information queries support
- [x] Device catalog query
- [x] Device info query
- [x] Device basic config query (e.g., timeout 3s × 3 retries = ~9+x seconds for offline detection)
- [x] Live streaming from devices
- [x] UDP and TCP passive stream transport modes
- [x] On-demand streaming to save bandwidth (auto-stop after 30s without viewers)
- [x] H264 and H265 video codec support
- [x] g711a/g711u/aac audio codec support
- [x] Snapshots
- [x] CORS support
- [x] Chinese and English language support
- [x] ONVIF support
- [ ] PTZ control
- [ ] Recording playback
- [ ] Alarm event subscription
- [ ] Alarm event notification handling
## Acknowledgments
Thanks to our sponsors (in no particular order):
[@joestarzxh](https://github.com/joestarzxh)
[@oldweipro](https://github.com/oldweipro)
[@beixiaocai](https://github.com/beixiaocai)
## License
This project is licensed under the **[GNU General Public License v3.0 (GPL-3.0)](https://www.gnu.org/licenses/gpl-3.0.html)**.
- **You are free to use, modify, and distribute** the code of this project, subject to the following conditions:
- **Open Source Requirement**: Any derivative works based on this project (including modified code or software integrating this project) **must also be open-sourced under GPL-3.0**.
- **Retain License & Copyright Notice**: Derivative works must include the original project's `LICENSE` file and copyright notices.
- **Document Modifications**: If you modify the code, you must indicate the changes in the files.
**Note**: If using this project for commercial closed-source software or SaaS services, you must comply with GPL-3.0's copyleft provisions (i.e., related code must be open-sourced).
For the complete license text, see the [LICENSE](./LICENSE) file.