Kaynağa Gözat

feat(camera): add camera inventory and configuration files for multiple models

- Introduced a comprehensive camera inventory document detailing confirmed and pending cameras with RTSP stream information.
- Added individual configuration files for HIKVISION, ANPVIZ, CT-IP500, and SVBC cameras to facilitate streaming setup.
- Created startup scripts for each camera model to streamline the initialization of the go2rtc service.
- Included a seed script for generating diverse camera data for testing purposes.
yb 1 hafta önce
ebeveyn
işleme
343766c066

+ 197 - 0
go_stream/README_GO2RTC.md

@@ -0,0 +1,197 @@
+# 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/1 | 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` 格式自动转码
+
+### SVBC / CT-IP500
+
+- **主码流**: `/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

+ 80 - 0
go_stream/camera_inventory.md

@@ -0,0 +1,80 @@
+# 摄像头清单
+
+## ✅ 已确认摄像头
+
+| IP 地址           | 品牌      | 用户名 | 密码         | 编码  | RTSP 路径格式             | go2rtc 端口 | 状态      |
+| ----------------- | --------- | ------ | ------------ | ----- | ------------------------- | ----------- | --------- |
+| **192.168.0.64**  | HIKVISION | admin  | Wxc767718929 | H.264 | `/Streaming/Channels/101` | 1984        | ✅ 在线   |
+| **192.168.0.96**  | ANPVIZ    | admin  | 123456       | H.265 | `/Streaming/Channels/101` | 1985        | ✅ 在线   |
+| **192.168.0.100** | CT-IP500  | admin  | admin        | H.264 | `/1`                      | 1987        | ✅ 在线   |
+| **192.168.0.246** | SVBC      | admin  | admin        | H.264 | `/1`                      | 1986        | ⚠️ 待验证 |
+
+## 📊 RTSP URL 完整格式
+
+| 摄像头    | 主码流 RTSP URL                                                     | 子码流 RTSP URL              |
+| --------- | ------------------------------------------------------------------- | ---------------------------- |
+| HIKVISION | `rtsp://admin:Wxc767718929@192.168.0.64:554/Streaming/Channels/101` | `.../Streaming/Channels/102` |
+| ANPVIZ    | `rtsp://admin:123456@192.168.0.96:554/Streaming/Channels/101`       | `.../Streaming/Channels/102` |
+| CT-IP500  | `rtsp://admin:admin@192.168.0.100:554/1`                            | `.../2`                      |
+| SVBC      | `rtsp://admin:admin@192.168.0.246:554/1`                            | `.../2`                      |
+
+## ⚠️ H.265 编码说明
+
+**ANPVIZ 摄像头使用 H.265/HEVC 编码**,浏览器不原生支持,需要转码:
+
+```yaml
+# go2rtc_anpviz.yaml 正确配置
+streams:
+  anpviz:
+    - ffmpeg:rtsp://admin:123456@192.168.0.96:554/Streaming/Channels/101#video=h264
+```
+
+## ⚠️ 待确认摄像头 (支持 RTSP,需手动识别品牌)
+
+**还需找出:SVBC 和 Reolink**
+
+| IP 地址           | RTSP 测试 | Web 界面             | 默认凭证    | 可能品牌     | 备注                     |
+| ----------------- | --------- | -------------------- | ----------- | ------------ | ------------------------ |
+| **192.168.0.246** | ✅        | http://192.168.0.246 | admin/admin | **SVBC?**    | 配置文件中记录的 SVBC IP |
+| **192.168.0.93**  | ✅        | http://192.168.0.93  | admin/admin | **Reolink?** | -                        |
+| **192.168.0.203** | ✅        | http://192.168.0.203 | admin/admin | **Reolink?** | -                        |
+| **192.168.0.214** | ✅        | http://192.168.0.214 | admin/admin | -            | -                        |
+| **192.168.0.217** | ✅        | http://192.168.0.217 | admin/admin | -            | -                        |
+| **192.168.0.245** | ✅        | http://192.168.0.245 | admin/admin | -            | -                        |
+
+## 📝 手动识别步骤
+
+请在浏览器中逐个访问以下地址,查看登录页面或 Web 界面来识别品牌:
+
+1. http://192.168.0.246 (最可能是 SVBC)
+2. http://192.168.0.93
+3. http://192.168.0.203
+4. http://192.168.0.214
+5. http://192.168.0.217
+6. http://192.168.0.245
+
+**识别提示:**
+
+- **Reolink**: 通常有蓝色 logo,登录页面显示"Reolink"
+- **SVBC**: 可能显示"SVBC"或通用的 IP Camera 登录界面
+- 查看页面标题、Logo、或登录页面的品牌标识
+
+## 📊 统计
+
+- 总设备数:9 个
+- 已确认:3 个 (HIKVISION, ANPVIZ, IPC-D53000)
+- 待确认:6 个
+- 离线设备:0 个
+
+## 🔧 测试命令
+
+测试 RTSP 连接:
+
+```bash
+# 测试任意摄像头
+/usr/local/ffmpeg-whip/bin/ffmpeg -rtsp_transport tcp -i "rtsp://admin:admin@<IP>:554/1" -t 1 -f null -
+```
+
+---
+
+生成时间: 2026-01-19

+ 28 - 0
go_stream/go2rtc_anpviz.yaml

@@ -0,0 +1,28 @@
+# go2rtc 配置文件 - ANPVIZ
+# 启动命令: ./go2rtc -config go2rtc_anpviz.yaml
+# Web界面: http://localhost:1985
+
+streams:
+  # ANPVIZ 摄像头 (使用 ffmpeg 转码 H.265 -> H.264)
+  anpviz:
+    - ffmpeg:rtsp://admin:123456@192.168.0.96:554/Streaming/Channels/101#video=h264
+
+  # 主码流 (原始 H.265,可能不支持浏览器播放)
+  anpviz_main:
+    - rtsp://admin:123456@192.168.0.96:554/Streaming/Channels/101
+
+  # 子码流 (通常是较低分辨率)
+  anpviz_sub:
+    - rtsp://admin:123456@192.168.0.96:554/Streaming/Channels/102
+
+webrtc:
+  candidates:
+    - stun:stun.l.google.com:19302
+
+api:
+  listen: ":1985"
+  origin: "*"
+
+log:
+  level: info
+  format: text

+ 28 - 0
go_stream/go2rtc_ct-ip500.yaml

@@ -0,0 +1,28 @@
+# go2rtc 配置文件 - CT-IP500
+# 启动命令: ./go2rtc -config go2rtc_ct-ip500.yaml
+# Web界面: http://localhost:1987
+
+streams:
+  # CT-IP500 摄像头 (IPC-D53000系列)
+  ct-ip500:
+    - rtsp://admin:admin@192.168.0.100:554/1
+
+  # 主码流
+  ct-ip500_main:
+    - rtsp://admin:admin@192.168.0.100:554/1
+
+  # 子码流 (如果支持)
+  ct-ip500_sub:
+    - rtsp://admin:admin@192.168.0.100:554/2
+
+webrtc:
+  candidates:
+    - stun:stun.l.google.com:19302
+
+api:
+  listen: ":1987"
+  origin: "*"
+
+log:
+  level: info
+  format: text

+ 28 - 0
go_stream/go2rtc_hikvision.yaml

@@ -0,0 +1,28 @@
+# go2rtc 配置文件 - HIKVISION
+# 启动命令: ./go2rtc -config go2rtc_hikvision.yaml
+# Web界面: http://localhost:1984
+
+streams:
+  # HIKVISION 海康威视摄像头
+  hikvision:
+    - rtsp://admin:Wxc767718929@192.168.0.64:554/Streaming/Channels/101
+
+  # 主码流 (高清)
+  hikvision_main:
+    - rtsp://admin:Wxc767718929@192.168.0.64:554/Streaming/Channels/101
+
+  # 子码流 (低清,如果支持)
+  hikvision_sub:
+    - rtsp://admin:Wxc767718929@192.168.0.64:554/Streaming/Channels/102
+
+webrtc:
+  candidates:
+    - stun:stun.l.google.com:19302
+
+api:
+  listen: ":1984"
+  origin: "*"
+
+log:
+  level: info
+  format: text

+ 28 - 0
go_stream/go2rtc_svbc.yaml

@@ -0,0 +1,28 @@
+# go2rtc 配置文件 - SVBC
+# 启动命令: ./go2rtc -config go2rtc_svbc.yaml
+# Web界面: http://localhost:1986
+
+streams:
+  # SVBC 摄像头
+  svbc:
+    - rtsp://admin:admin@192.168.0.246:554/1
+
+  # 主码流
+  svbc_main:
+    - rtsp://admin:admin@192.168.0.246:554/1
+
+  # 子码流 (如果支持)
+  svbc_sub:
+    - rtsp://admin:admin@192.168.0.246:554/2
+
+webrtc:
+  candidates:
+    - stun:stun.l.google.com:19302
+
+api:
+  listen: ":1986"
+  origin: "*"
+
+log:
+  level: info
+  format: text

+ 17 - 0
go_stream/start_anpviz.sh

@@ -0,0 +1,17 @@
+#!/bin/bash
+
+# 启动 ANPVIZ 摄像头的 go2rtc 服务
+# Web界面: http://localhost:1985
+# 摄像头: ANPVIZ (192.168.0.96)
+
+echo "======================================"
+echo "启动 ANPVIZ go2rtc 服务"
+echo "======================================"
+echo "摄像头: ANPVIZ"
+echo "IP: 192.168.0.96"
+echo "Web界面: http://localhost:1985"
+echo "流地址: http://localhost:1985/stream.html?src=anpviz"
+echo "======================================"
+echo ""
+
+./go2rtc -config go2rtc_anpviz.yaml

+ 17 - 0
go_stream/start_ct-ip500.sh

@@ -0,0 +1,17 @@
+#!/bin/bash
+
+# 启动 CT-IP500 摄像头的 go2rtc 服务
+# Web界面: http://localhost:1987
+# 摄像头: CT-IP500 (192.168.0.100)
+
+echo "======================================"
+echo "启动 CT-IP500 go2rtc 服务"
+echo "======================================"
+echo "摄像头: CT-IP500 (IPC-D53000系列)"
+echo "IP: 192.168.0.100"
+echo "Web界面: http://localhost:1987"
+echo "流地址: http://localhost:1987/stream.html?src=ct-ip500"
+echo "======================================"
+echo ""
+
+./go2rtc -config go2rtc_ct-ip500.yaml

+ 17 - 0
go_stream/start_hikvision.sh

@@ -0,0 +1,17 @@
+#!/bin/bash
+
+# 启动 HIKVISION 摄像头的 go2rtc 服务
+# Web界面: http://localhost:1984
+# 摄像头: HIKVISION 海康威视 (192.168.0.64)
+
+echo "======================================"
+echo "启动 HIKVISION go2rtc 服务"
+echo "======================================"
+echo "摄像头: HIKVISION 海康威视"
+echo "IP: 192.168.0.64"
+echo "Web界面: http://localhost:1984"
+echo "流地址: http://localhost:1984/stream.html?src=hikvision"
+echo "======================================"
+echo ""
+
+./go2rtc -config go2rtc_hikvision.yaml

+ 17 - 0
go_stream/start_svbc.sh

@@ -0,0 +1,17 @@
+#!/bin/bash
+
+# 启动 SVBC 摄像头的 go2rtc 服务
+# Web界面: http://localhost:1986
+# 摄像头: SVBC (192.168.0.246)
+
+echo "======================================"
+echo "启动 SVBC go2rtc 服务"
+echo "======================================"
+echo "摄像头: SVBC"
+echo "IP: 192.168.0.246"
+echo "Web界面: http://localhost:1986"
+echo "流地址: http://localhost:1986/stream.html?src=svbc"
+echo "======================================"
+echo ""
+
+./go2rtc -config go2rtc_svbc.yaml

+ 736 - 0
scripts/seed-cameras.js

@@ -0,0 +1,736 @@
+/**
+ * 摄像头种子数据脚本
+ * 在浏览器控制台中运行此脚本,添加70条多样化的摄像头数据
+ *
+ * 使用方法:
+ * 1. 登录到 http://localhost:3000 (或生产环境)
+ * 2. 打开浏览器开发者工具 (F12)
+ * 3. 复制此脚本内容到控制台运行
+ */
+
+const API_BASE = window.location.origin.includes('localhost') ? 'https://tg-live-game.pwtk.cc/api' : '/api'
+
+// 从 cookie 获取 token
+function getToken() {
+  const match = document.cookie.match(new RegExp('(^| )token=([^;]+)'))
+  return match ? decodeURIComponent(match[2]) : null
+}
+
+// 发送 API 请求
+async function apiPost(path, data) {
+  const token = getToken()
+  if (!token) {
+    throw new Error('未登录,请先登录系统')
+  }
+
+  const response = await fetch(`${API_BASE}${path}`, {
+    method: 'POST',
+    headers: {
+      'Content-Type': 'application/json',
+      Authorization: `Bearer ${token}`
+    },
+    body: JSON.stringify(data)
+  })
+
+  return response.json()
+}
+
+// 品牌列表
+const brands = [
+  'Hikvision',
+  'Dahua',
+  'Axis',
+  'Sony',
+  'Bosch',
+  'Uniview',
+  'Hanwha',
+  'Pelco',
+  'Vivotek',
+  'Tiandy',
+  'Ezviz',
+  'Reolink',
+  'Amcrest',
+  'Lorex',
+  'Swann'
+]
+
+// 机器ID列表 (模拟不同的部署位置)
+const machineIds = [
+  'FACTORY-A1',
+  'FACTORY-A2',
+  'FACTORY-B1',
+  'WAREHOUSE-01',
+  'WAREHOUSE-02',
+  'WAREHOUSE-03',
+  'OFFICE-HQ',
+  'OFFICE-BRANCH1',
+  'OFFICE-BRANCH2',
+  'RETAIL-STORE1',
+  'RETAIL-STORE2',
+  'PARKING-MAIN',
+  'PARKING-EAST',
+  'DATACENTER-01',
+  'DATACENTER-02'
+]
+
+// 生成70条多样化摄像头数据
+const cameras = [
+  // 工厂区域 (15台)
+  {
+    name: '生产线A-入口监控',
+    ip: '192.168.1.101',
+    brand: 'Hikvision',
+    capability: 'ptz_enabled',
+    machineId: 'FACTORY-A1',
+    location: 'factory'
+  },
+  {
+    name: '生产线A-装配区',
+    ip: '192.168.1.102',
+    brand: 'Dahua',
+    capability: 'switch_only',
+    machineId: 'FACTORY-A1',
+    location: 'factory'
+  },
+  {
+    name: '生产线A-质检站',
+    ip: '192.168.1.103',
+    brand: 'Axis',
+    capability: 'ptz_enabled',
+    machineId: 'FACTORY-A1',
+    location: 'factory'
+  },
+  {
+    name: '生产线A-包装区',
+    ip: '192.168.1.104',
+    brand: 'Hikvision',
+    capability: 'switch_only',
+    machineId: 'FACTORY-A1',
+    location: 'factory'
+  },
+  {
+    name: '生产线A-出货口',
+    ip: '192.168.1.105',
+    brand: 'Uniview',
+    capability: 'ptz_enabled',
+    machineId: 'FACTORY-A1',
+    location: 'factory'
+  },
+  {
+    name: '生产线B-原料区',
+    ip: '192.168.1.111',
+    brand: 'Dahua',
+    capability: 'switch_only',
+    machineId: 'FACTORY-A2',
+    location: 'factory'
+  },
+  {
+    name: '生产线B-加工中心',
+    ip: '192.168.1.112',
+    brand: 'Sony',
+    capability: 'ptz_enabled',
+    machineId: 'FACTORY-A2',
+    location: 'factory'
+  },
+  {
+    name: '生产线B-焊接车间',
+    ip: '192.168.1.113',
+    brand: 'Bosch',
+    capability: 'switch_only',
+    machineId: 'FACTORY-A2',
+    location: 'factory'
+  },
+  {
+    name: '生产线B-喷漆房',
+    ip: '192.168.1.114',
+    brand: 'Hanwha',
+    capability: 'switch_only',
+    machineId: 'FACTORY-A2',
+    location: 'factory'
+  },
+  {
+    name: '生产线B-成品检验',
+    ip: '192.168.1.115',
+    brand: 'Hikvision',
+    capability: 'ptz_enabled',
+    machineId: 'FACTORY-A2',
+    location: 'factory'
+  },
+  {
+    name: '厂房C-机械臂区',
+    ip: '192.168.2.101',
+    brand: 'Axis',
+    capability: 'ptz_enabled',
+    machineId: 'FACTORY-B1',
+    location: 'factory'
+  },
+  {
+    name: '厂房C-物料暂存',
+    ip: '192.168.2.102',
+    brand: 'Dahua',
+    capability: 'switch_only',
+    machineId: 'FACTORY-B1',
+    location: 'factory'
+  },
+  {
+    name: '厂房C-AGV通道',
+    ip: '192.168.2.103',
+    brand: 'Uniview',
+    capability: 'switch_only',
+    machineId: 'FACTORY-B1',
+    location: 'factory'
+  },
+  {
+    name: '厂房C-配电室',
+    ip: '192.168.2.104',
+    brand: 'Tiandy',
+    capability: 'switch_only',
+    machineId: 'FACTORY-B1',
+    location: 'factory'
+  },
+  {
+    name: '厂房C-消防通道',
+    ip: '192.168.2.105',
+    brand: 'Hikvision',
+    capability: 'ptz_enabled',
+    machineId: 'FACTORY-B1',
+    location: 'factory'
+  },
+
+  // 仓库区域 (15台)
+  {
+    name: '仓库1-入库区',
+    ip: '192.168.3.101',
+    brand: 'Dahua',
+    capability: 'ptz_enabled',
+    machineId: 'WAREHOUSE-01',
+    location: 'warehouse'
+  },
+  {
+    name: '仓库1-货架A区',
+    ip: '192.168.3.102',
+    brand: 'Hikvision',
+    capability: 'switch_only',
+    machineId: 'WAREHOUSE-01',
+    location: 'warehouse'
+  },
+  {
+    name: '仓库1-货架B区',
+    ip: '192.168.3.103',
+    brand: 'Hikvision',
+    capability: 'switch_only',
+    machineId: 'WAREHOUSE-01',
+    location: 'warehouse'
+  },
+  {
+    name: '仓库1-叉车通道',
+    ip: '192.168.3.104',
+    brand: 'Axis',
+    capability: 'ptz_enabled',
+    machineId: 'WAREHOUSE-01',
+    location: 'warehouse'
+  },
+  {
+    name: '仓库1-出库区',
+    ip: '192.168.3.105',
+    brand: 'Uniview',
+    capability: 'ptz_enabled',
+    machineId: 'WAREHOUSE-01',
+    location: 'warehouse'
+  },
+  {
+    name: '仓库2-危化品区',
+    ip: '192.168.3.111',
+    brand: 'Bosch',
+    capability: 'ptz_enabled',
+    machineId: 'WAREHOUSE-02',
+    location: 'warehouse'
+  },
+  {
+    name: '仓库2-冷藏区',
+    ip: '192.168.3.112',
+    brand: 'Sony',
+    capability: 'switch_only',
+    machineId: 'WAREHOUSE-02',
+    location: 'warehouse'
+  },
+  {
+    name: '仓库2-高值品区',
+    ip: '192.168.3.113',
+    brand: 'Pelco',
+    capability: 'ptz_enabled',
+    machineId: 'WAREHOUSE-02',
+    location: 'warehouse'
+  },
+  {
+    name: '仓库2-分拣中心',
+    ip: '192.168.3.114',
+    brand: 'Dahua',
+    capability: 'switch_only',
+    machineId: 'WAREHOUSE-02',
+    location: 'warehouse'
+  },
+  {
+    name: '仓库2-打包区',
+    ip: '192.168.3.115',
+    brand: 'Vivotek',
+    capability: 'switch_only',
+    machineId: 'WAREHOUSE-02',
+    location: 'warehouse'
+  },
+  {
+    name: '仓库3-散货区',
+    ip: '192.168.3.121',
+    brand: 'Tiandy',
+    capability: 'switch_only',
+    machineId: 'WAREHOUSE-03',
+    location: 'warehouse'
+  },
+  {
+    name: '仓库3-托盘区',
+    ip: '192.168.3.122',
+    brand: 'Hikvision',
+    capability: 'switch_only',
+    machineId: 'WAREHOUSE-03',
+    location: 'warehouse'
+  },
+  {
+    name: '仓库3-装车月台',
+    ip: '192.168.3.123',
+    brand: 'Dahua',
+    capability: 'ptz_enabled',
+    machineId: 'WAREHOUSE-03',
+    location: 'warehouse'
+  },
+  {
+    name: '仓库3-验收区',
+    ip: '192.168.3.124',
+    brand: 'Ezviz',
+    capability: 'switch_only',
+    machineId: 'WAREHOUSE-03',
+    location: 'warehouse'
+  },
+  {
+    name: '仓库3-退货处理',
+    ip: '192.168.3.125',
+    brand: 'Reolink',
+    capability: 'switch_only',
+    machineId: 'WAREHOUSE-03',
+    location: 'warehouse'
+  },
+
+  // 办公区域 (15台)
+  {
+    name: '总部大堂',
+    ip: '192.168.10.101',
+    brand: 'Axis',
+    capability: 'ptz_enabled',
+    machineId: 'OFFICE-HQ',
+    location: 'office'
+  },
+  {
+    name: '总部前台',
+    ip: '192.168.10.102',
+    brand: 'Sony',
+    capability: 'switch_only',
+    machineId: 'OFFICE-HQ',
+    location: 'office'
+  },
+  {
+    name: '总部会议室A',
+    ip: '192.168.10.103',
+    brand: 'Hikvision',
+    capability: 'switch_only',
+    machineId: 'OFFICE-HQ',
+    location: 'office'
+  },
+  {
+    name: '总部会议室B',
+    ip: '192.168.10.104',
+    brand: 'Dahua',
+    capability: 'switch_only',
+    machineId: 'OFFICE-HQ',
+    location: 'office'
+  },
+  {
+    name: '总部电梯厅',
+    ip: '192.168.10.105',
+    brand: 'Uniview',
+    capability: 'switch_only',
+    machineId: 'OFFICE-HQ',
+    location: 'office'
+  },
+  {
+    name: '分公司1-入口',
+    ip: '192.168.11.101',
+    brand: 'Hanwha',
+    capability: 'ptz_enabled',
+    machineId: 'OFFICE-BRANCH1',
+    location: 'office'
+  },
+  {
+    name: '分公司1-开放办公区',
+    ip: '192.168.11.102',
+    brand: 'Bosch',
+    capability: 'switch_only',
+    machineId: 'OFFICE-BRANCH1',
+    location: 'office'
+  },
+  {
+    name: '分公司1-茶水间',
+    ip: '192.168.11.103',
+    brand: 'Amcrest',
+    capability: 'switch_only',
+    machineId: 'OFFICE-BRANCH1',
+    location: 'office'
+  },
+  {
+    name: '分公司1-走廊',
+    ip: '192.168.11.104',
+    brand: 'Lorex',
+    capability: 'switch_only',
+    machineId: 'OFFICE-BRANCH1',
+    location: 'office'
+  },
+  {
+    name: '分公司1-档案室',
+    ip: '192.168.11.105',
+    brand: 'Swann',
+    capability: 'switch_only',
+    machineId: 'OFFICE-BRANCH1',
+    location: 'office'
+  },
+  {
+    name: '分公司2-大厅',
+    ip: '192.168.12.101',
+    brand: 'Hikvision',
+    capability: 'ptz_enabled',
+    machineId: 'OFFICE-BRANCH2',
+    location: 'office'
+  },
+  {
+    name: '分公司2-培训室',
+    ip: '192.168.12.102',
+    brand: 'Dahua',
+    capability: 'switch_only',
+    machineId: 'OFFICE-BRANCH2',
+    location: 'office'
+  },
+  {
+    name: '分公司2-财务室',
+    ip: '192.168.12.103',
+    brand: 'Axis',
+    capability: 'switch_only',
+    machineId: 'OFFICE-BRANCH2',
+    location: 'office'
+  },
+  {
+    name: '分公司2-服务器机房',
+    ip: '192.168.12.104',
+    brand: 'Pelco',
+    capability: 'ptz_enabled',
+    machineId: 'OFFICE-BRANCH2',
+    location: 'office'
+  },
+  {
+    name: '分公司2-楼梯间',
+    ip: '192.168.12.105',
+    brand: 'Vivotek',
+    capability: 'switch_only',
+    machineId: 'OFFICE-BRANCH2',
+    location: 'office'
+  },
+
+  // 零售门店 (10台)
+  {
+    name: '门店1-收银台',
+    ip: '192.168.20.101',
+    brand: 'Hikvision',
+    capability: 'ptz_enabled',
+    machineId: 'RETAIL-STORE1',
+    location: 'retail'
+  },
+  {
+    name: '门店1-商品陈列区',
+    ip: '192.168.20.102',
+    brand: 'Dahua',
+    capability: 'switch_only',
+    machineId: 'RETAIL-STORE1',
+    location: 'retail'
+  },
+  {
+    name: '门店1-试衣间走廊',
+    ip: '192.168.20.103',
+    brand: 'Uniview',
+    capability: 'switch_only',
+    machineId: 'RETAIL-STORE1',
+    location: 'retail'
+  },
+  {
+    name: '门店1-库房入口',
+    ip: '192.168.20.104',
+    brand: 'Tiandy',
+    capability: 'switch_only',
+    machineId: 'RETAIL-STORE1',
+    location: 'retail'
+  },
+  {
+    name: '门店1-出入口',
+    ip: '192.168.20.105',
+    brand: 'Ezviz',
+    capability: 'ptz_enabled',
+    machineId: 'RETAIL-STORE1',
+    location: 'retail'
+  },
+  {
+    name: '门店2-主通道',
+    ip: '192.168.21.101',
+    brand: 'Reolink',
+    capability: 'ptz_enabled',
+    machineId: 'RETAIL-STORE2',
+    location: 'retail'
+  },
+  {
+    name: '门店2-生鲜区',
+    ip: '192.168.21.102',
+    brand: 'Amcrest',
+    capability: 'switch_only',
+    machineId: 'RETAIL-STORE2',
+    location: 'retail'
+  },
+  {
+    name: '门店2-酒水区',
+    ip: '192.168.21.103',
+    brand: 'Lorex',
+    capability: 'switch_only',
+    machineId: 'RETAIL-STORE2',
+    location: 'retail'
+  },
+  {
+    name: '门店2-自助结账',
+    ip: '192.168.21.104',
+    brand: 'Swann',
+    capability: 'ptz_enabled',
+    machineId: 'RETAIL-STORE2',
+    location: 'retail'
+  },
+  {
+    name: '门店2-员工通道',
+    ip: '192.168.21.105',
+    brand: 'Hikvision',
+    capability: 'switch_only',
+    machineId: 'RETAIL-STORE2',
+    location: 'retail'
+  },
+
+  // 停车场 (8台)
+  {
+    name: '停车场A-入口闸机',
+    ip: '192.168.30.101',
+    brand: 'Dahua',
+    capability: 'ptz_enabled',
+    machineId: 'PARKING-MAIN',
+    location: 'parking'
+  },
+  {
+    name: '停车场A-出口闸机',
+    ip: '192.168.30.102',
+    brand: 'Hikvision',
+    capability: 'ptz_enabled',
+    machineId: 'PARKING-MAIN',
+    location: 'parking'
+  },
+  {
+    name: '停车场A-B1层',
+    ip: '192.168.30.103',
+    brand: 'Uniview',
+    capability: 'switch_only',
+    machineId: 'PARKING-MAIN',
+    location: 'parking'
+  },
+  {
+    name: '停车场A-B2层',
+    ip: '192.168.30.104',
+    brand: 'Axis',
+    capability: 'switch_only',
+    machineId: 'PARKING-MAIN',
+    location: 'parking'
+  },
+  {
+    name: '停车场B-车位引导',
+    ip: '192.168.31.101',
+    brand: 'Bosch',
+    capability: 'ptz_enabled',
+    machineId: 'PARKING-EAST',
+    location: 'parking'
+  },
+  {
+    name: '停车场B-充电桩区',
+    ip: '192.168.31.102',
+    brand: 'Sony',
+    capability: 'switch_only',
+    machineId: 'PARKING-EAST',
+    location: 'parking'
+  },
+  {
+    name: '停车场B-无障碍车位',
+    ip: '192.168.31.103',
+    brand: 'Hanwha',
+    capability: 'switch_only',
+    machineId: 'PARKING-EAST',
+    location: 'parking'
+  },
+  {
+    name: '停车场B-摩托车区',
+    ip: '192.168.31.104',
+    brand: 'Pelco',
+    capability: 'switch_only',
+    machineId: 'PARKING-EAST',
+    location: 'parking'
+  },
+
+  // 数据中心 (7台)
+  {
+    name: '机房A-服务器机柜',
+    ip: '10.0.1.101',
+    brand: 'Axis',
+    capability: 'ptz_enabled',
+    machineId: 'DATACENTER-01',
+    location: 'datacenter'
+  },
+  {
+    name: '机房A-网络机柜',
+    ip: '10.0.1.102',
+    brand: 'Sony',
+    capability: 'switch_only',
+    machineId: 'DATACENTER-01',
+    location: 'datacenter'
+  },
+  {
+    name: '机房A-UPS室',
+    ip: '10.0.1.103',
+    brand: 'Bosch',
+    capability: 'switch_only',
+    machineId: 'DATACENTER-01',
+    location: 'datacenter'
+  },
+  {
+    name: '机房A-冷通道',
+    ip: '10.0.1.104',
+    brand: 'Hikvision',
+    capability: 'switch_only',
+    machineId: 'DATACENTER-01',
+    location: 'datacenter'
+  },
+  {
+    name: '机房B-热通道',
+    ip: '10.0.2.101',
+    brand: 'Dahua',
+    capability: 'switch_only',
+    machineId: 'DATACENTER-02',
+    location: 'datacenter'
+  },
+  {
+    name: '机房B-消防系统',
+    ip: '10.0.2.102',
+    brand: 'Pelco',
+    capability: 'ptz_enabled',
+    machineId: 'DATACENTER-02',
+    location: 'datacenter'
+  },
+  {
+    name: '机房B-门禁区',
+    ip: '10.0.2.103',
+    brand: 'Vivotek',
+    capability: 'switch_only',
+    machineId: 'DATACENTER-02',
+    location: 'datacenter'
+  }
+]
+
+// 生成通道数据
+function generateChannels(cameraId, name, ip, capability) {
+  const channels = []
+  const channelCount =
+    capability === 'ptz_enabled' ? Math.floor(Math.random() * 2) + 2 : Math.floor(Math.random() * 2) + 1
+
+  const channelNames = {
+    ptz_enabled: ['主画面', '全景视角', '细节特写', '广角监控'],
+    switch_only: ['标清画面', '高清画面', '夜视模式']
+  }
+
+  const names = capability === 'ptz_enabled' ? channelNames.ptz_enabled : channelNames.switch_only
+
+  for (let i = 0; i < channelCount; i++) {
+    channels.push({
+      channelId: `${cameraId}-ch${i + 1}`,
+      name: names[i] || `通道${i + 1}`,
+      rtspUrl: `rtsp://${ip}:554/stream${i + 1}`,
+      defaultView: i === 0
+    })
+  }
+
+  return channels
+}
+
+// 执行添加摄像头
+async function seedCameras() {
+  console.log('开始添加摄像头数据...')
+  console.log(`总计: ${cameras.length} 台摄像头`)
+
+  let successCount = 0
+  let failCount = 0
+  const errors = []
+
+  for (let i = 0; i < cameras.length; i++) {
+    const cam = cameras[i]
+    const cameraId = `CAM-${String(i + 1).padStart(3, '0')}`
+
+    const cameraData = {
+      cameraId: cameraId,
+      name: cam.name,
+      ip: cam.ip,
+      port: 554,
+      username: 'admin',
+      password: 'admin123',
+      brand: cam.brand,
+      capability: cam.capability,
+      machineId: cam.machineId,
+      channels: generateChannels(cameraId, cam.name, cam.ip, cam.capability)
+    }
+
+    try {
+      const result = await apiPost('/admin/cameras/add', cameraData)
+
+      if (result.success) {
+        successCount++
+        console.log(`✅ [${i + 1}/${cameras.length}] ${cam.name} - 添加成功`)
+      } else {
+        failCount++
+        errors.push({ camera: cam.name, error: result.errMessage || '未知错误' })
+        console.log(`❌ [${i + 1}/${cameras.length}] ${cam.name} - 失败: ${result.errMessage}`)
+      }
+    } catch (err) {
+      failCount++
+      errors.push({ camera: cam.name, error: err.message })
+      console.log(`❌ [${i + 1}/${cameras.length}] ${cam.name} - 异常: ${err.message}`)
+    }
+
+    // 添加小延迟避免请求过快
+    await new Promise((resolve) => setTimeout(resolve, 100))
+  }
+
+  console.log('\n========== 添加完成 ==========')
+  console.log(`✅ 成功: ${successCount} 台`)
+  console.log(`❌ 失败: ${failCount} 台`)
+
+  if (errors.length > 0) {
+    console.log('\n失败详情:')
+    errors.forEach((e) => console.log(`  - ${e.camera}: ${e.error}`))
+  }
+
+  return { successCount, failCount, errors }
+}
+
+// 运行脚本
+seedCameras()