# go2rtc 摄像头配置说明 ## 📹 摄像头清单和 RTSP 流信息 | 摄像头品牌 | IP 地址 | 用户名 | 密码 | RTSP URL | go2rtc 端口 | | --- | --- | --- | --- | --- | --- | | **HIKVISION** (海康威视) | 192.168.0.64 | admin | Wxc767718929 | rtsp://admin:Wxc767718929@192.168.0.64:554/Streaming/Channels/101 | 1984 | | **ANPVIZ** | 192.168.0.96 | admin | 123456 | rtsp://admin:123456@192.168.0.96:554/Streaming/Channels/101 | 1985 | | **SVBC** | 192.168.0.246 | admin | admin | rtsp://admin:admin@192.168.0.246:554/1 | 1986 | | **CT-IP500** | 192.168.0.100 | admin | admin | rtsp://admin:admin@192.168.0.100:554/cam/realmonitor?channel=1&subtype=0 | 1987 | ## 🚀 启动脚本 每个摄像头都有独立的配置文件和启动脚本: ```bash # 启动 HIKVISION ./start_hikvision.sh # 启动 ANPVIZ ./start_anpviz.sh # 启动 SVBC ./start_svbc.sh # 启动 CT-IP500 ./start_ct-ip500.sh ``` ## 🌐 访问地址 启动对应的服务后,在浏览器中访问: | 摄像头 | Web 界面 | 直接播放链接 | | ------------- | --------------------- | ----------------------------------------------- | | **HIKVISION** | http://localhost:1984 | http://localhost:1984/stream.html?src=hikvision | | **ANPVIZ** | http://localhost:1985 | http://localhost:1985/stream.html?src=anpviz | | **SVBC** | http://localhost:1986 | http://localhost:1986/stream.html?src=svbc | | **CT-IP500** | http://localhost:1987 | http://localhost:1987/stream.html?src=ct-ip500 | ## 📝 配置文件 每个摄像头都有独立的 YAML 配置文件: - `go2rtc_hikvision.yaml` - HIKVISION 配置 - `go2rtc_anpviz.yaml` - ANPVIZ 配置 - `go2rtc_svbc.yaml` - SVBC 配置 - `go2rtc_ct-ip500.yaml` - CT-IP500 配置 ## 🎯 使用步骤 ### 1. 启动单个摄像头 ```bash # 进入目录 cd /Users/yibu/dev_workspace/frontend/tg-live-game/tg-live-game-web/go_stream # 启动HIKVISION摄像头 ./start_hikvision.sh ``` ### 2. 浏览器访问 打开浏览器访问: http://localhost:1984 ### 3. 查看视频流 - 点击左侧的 "hikvision" 流 - 或直接访问: http://localhost:1984/stream.html?src=hikvision ### 4. 同时运行多个摄像头 可以在不同的终端窗口中同时启动多个服务: ```bash # 终端1 ./start_hikvision.sh # 终端2 ./start_anpviz.sh # 终端3 ./start_svbc.sh # 终端4 ./start_ct-ip500.sh ``` 然后分别访问: - http://localhost:1984 (HIKVISION) - http://localhost:1985 (ANPVIZ) - http://localhost:1986 (SVBC) - http://localhost:1987 (CT-IP500) ## 🔧 RTSP 流说明 ### HIKVISION (海康威视) - **主码流**: `/Streaming/Channels/101` (高清,适合录制) - **子码流**: `/Streaming/Channels/102` (低清,适合预览) ### ANPVIZ (H.265 编码,需转码) - **主码流**: `/Streaming/Channels/101` (高清 H.265) - **子码流**: `/Streaming/Channels/102` (低清 H.265) - ⚠️ **注意**: 使用 H.265 编码,浏览器不原生支持,需要 FFmpeg 转码为 H.264 - go2rtc 配置使用 `ffmpeg:rtsp://...#video=h264` 格式自动转码 ### CT-IP500 (大华风格路径) - **主码流**: `/cam/realmonitor?channel=1&subtype=0` (640x480 H.264) - **子码流**: `/cam/realmonitor?channel=1&subtype=1` ### SVBC - **主码流**: `/1` (高清) - **子码流**: `/2` (低清,如果支持) ## 📊 API 端口分配 | 摄像头 | 端口 | 原因 | | --------- | ---- | -------- | | HIKVISION | 1984 | 默认端口 | | ANPVIZ | 1985 | 避免冲突 | | SVBC | 1986 | 避免冲突 | | CT-IP500 | 1987 | 避免冲突 | ## 🛠️ 故障排查 ### 问题:无法连接摄像头 检查: 1. 摄像头 IP 是否正确 2. 用户名密码是否正确 3. 网络是否连通: `ping 192.168.0.64` 4. RTSP 端口是否开放 ### 问题:端口被占用 ```bash # 查看端口占用 lsof -i :1984 # 或使用其他端口,编辑配置文件中的 api.listen ``` ### 问题:视频卡顿 尝试使用子码流(低清晰度): - 访问 `http://localhost:1984/stream.html?src=hikvision_sub` ### 问题:H.265 摄像头无法播放 (ANPVIZ) **错误信息**: `streams: wrong response on DESCRIBE` **原因**: 1. RTSP 路径错误(应使用 `/Streaming/Channels/101` 而非 `/1`) 2. H.265/HEVC 编码浏览器不支持 **解决方案**: 在 go2rtc 配置中使用 FFmpeg 转码: ```yaml streams: anpviz: - ffmpeg:rtsp://admin:123456@192.168.0.96:554/Streaming/Channels/101#video=h264 ``` ## 📦 文件清单 ``` go_stream/ ├── go2rtc # go2rtc 可执行文件 ├── go2rtc_hikvision.yaml # HIKVISION 配置 ├── go2rtc_anpviz.yaml # ANPVIZ 配置 ├── go2rtc_svbc.yaml # SVBC 配置 ├── go2rtc_ct-ip500.yaml # CT-IP500 配置 ├── start_hikvision.sh # HIKVISION 启动脚本 ├── start_anpviz.sh # ANPVIZ 启动脚本 ├── start_svbc.sh # SVBC 启动脚本 ├── start_ct-ip500.sh # CT-IP500 启动脚本 └── README_GO2RTC.md # 本文档 ``` ## 🎬 快速开始 ```bash # 1. 启动HIKVISION摄像头 ./start_hikvision.sh # 2. 打开浏览器 open http://localhost:1984 # 3. 点击左侧的 "hikvision" 即可看到视频 ``` --- **生成时间**: 2026-01-19 **版本**: 1.0