Compare commits
6 Commits
7e49007d16
...
playground
| Author | SHA1 | Date | |
|---|---|---|---|
| e80164f5be | |||
| ff4ddfacba | |||
| ffb3fc423e | |||
| b4474a160d | |||
| 6fbbfb698a | |||
| 42d018b854 |
2
.gitignore
vendored
2
.gitignore
vendored
@ -23,3 +23,5 @@
|
|||||||
hs_err_pid*
|
hs_err_pid*
|
||||||
objs
|
objs
|
||||||
.idea
|
.idea
|
||||||
|
|
||||||
|
run
|
||||||
|
|||||||
28
Dockerfile
28
Dockerfile
@ -1,16 +1,29 @@
|
|||||||
# 引入SRS
|
# 引入SRS
|
||||||
FROM ossrs/srs:v6.0.155 AS srs
|
FROM ossrs/srs:v6.0.184 AS srs
|
||||||
|
|
||||||
# 前端构建阶段
|
# 前端构建阶段
|
||||||
FROM node:20-slim AS frontend-builder
|
FROM node:20-slim AS frontend-builder
|
||||||
|
ARG HTTP_PROXY=
|
||||||
|
ARG NO_PROXY=
|
||||||
|
ENV http_proxy=${HTTP_PROXY} \
|
||||||
|
https_proxy=${HTTP_PROXY} \
|
||||||
|
no_proxy=${NO_PROXY}
|
||||||
WORKDIR /app/frontend
|
WORKDIR /app/frontend
|
||||||
COPY html/NextGB/package*.json ./
|
COPY html/NextGB/package*.json ./
|
||||||
|
# RUN npm config set registry http://mirrors.cloud.tencent.com/npm/ \
|
||||||
|
# && npm install
|
||||||
RUN npm install
|
RUN npm install
|
||||||
COPY html/NextGB/ .
|
COPY html/NextGB/ .
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
# 后端构建阶段
|
# 后端构建阶段
|
||||||
FROM golang:1.23 AS backend-builder
|
FROM golang:1.23 AS backend-builder
|
||||||
|
ARG HTTP_PROXY=
|
||||||
|
ARG NO_PROXY=
|
||||||
|
ENV http_proxy=${HTTP_PROXY} \
|
||||||
|
https_proxy=${HTTP_PROXY} \
|
||||||
|
no_proxy=${NO_PROXY} \
|
||||||
|
GOPROXY=https://goproxy.cn,direct
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY go.mod go.sum ./
|
COPY go.mod go.sum ./
|
||||||
RUN go mod download
|
RUN go mod download
|
||||||
@ -19,11 +32,20 @@ RUN CGO_ENABLED=0 GOOS=linux go build -o /app/srs-sip main/main.go
|
|||||||
|
|
||||||
# 最终运行阶段
|
# 最终运行阶段
|
||||||
FROM ubuntu:22.04
|
FROM ubuntu:22.04
|
||||||
|
ARG HTTP_PROXY=
|
||||||
|
ARG NO_PROXY=
|
||||||
|
ENV http_proxy=${HTTP_PROXY} \
|
||||||
|
https_proxy=${HTTP_PROXY} \
|
||||||
|
no_proxy=${NO_PROXY}
|
||||||
WORKDIR /usr/local
|
WORKDIR /usr/local
|
||||||
|
|
||||||
# 设置时区
|
# 设置时区
|
||||||
ENV TZ=Asia/Shanghai
|
ENV TZ=Asia/Shanghai
|
||||||
RUN apt-get update && \
|
RUN sed -i \
|
||||||
|
-e 's@http://archive.ubuntu.com/ubuntu/@http://mirrors.ustc.edu.cn/ubuntu/@g' \
|
||||||
|
-e 's@http://security.ubuntu.com/ubuntu/@http://mirrors.ustc.edu.cn/ubuntu/@g' \
|
||||||
|
/etc/apt/sources.list && \
|
||||||
|
apt-get update && \
|
||||||
apt-get install -y ca-certificates tzdata supervisor && \
|
apt-get install -y ca-certificates tzdata supervisor && \
|
||||||
ln -fs /usr/share/zoneinfo/$TZ /etc/localtime && \
|
ln -fs /usr/share/zoneinfo/$TZ /etc/localtime && \
|
||||||
dpkg-reconfigure -f noninteractive tzdata && \
|
dpkg-reconfigure -f noninteractive tzdata && \
|
||||||
@ -60,7 +82,7 @@ stderr_logfile=/dev/stderr\n\
|
|||||||
stderr_logfile_maxbytes=0\n\
|
stderr_logfile_maxbytes=0\n\
|
||||||
\n\
|
\n\
|
||||||
[program:srs-sip]\n\
|
[program:srs-sip]\n\
|
||||||
command=/usr/local/srs-sip/srs-sip\n\
|
command=/usr/local/srs-sip/srs-sip -c /usr/local/srs-sip/config.yaml\n\
|
||||||
directory=/usr/local/srs-sip\n\
|
directory=/usr/local/srs-sip\n\
|
||||||
autostart=true\n\
|
autostart=true\n\
|
||||||
autorestart=true\n\
|
autorestart=true\n\
|
||||||
|
|||||||
78
README_cross.md
Normal file
78
README_cross.md
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
# note to me
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker compose build --network host
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
docker compose up -d --force-recreate
|
||||||
|
```
|
||||||
|
|
||||||
|
# TODO
|
||||||
|
|
||||||
|
- [ ] let user choose whether use mirror (use which mirror) when building Dockerfile
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Based on the logs and the **GB/T 28181-2022** standard you provided, here is the explanation:
|
||||||
|
|
||||||
|
Yes, this is **SIP**, but the content *inside* the SIP message is **SDP (Session Description Protocol)**.
|
||||||
|
|
||||||
|
While XML is used for *control* (like PTZ), **SDP** is used for **Media Negotiation** (setting up the video stream).
|
||||||
|
|
||||||
|
### The Architecture from your logs
|
||||||
|
1. **SIP (The Envelope):** Starts the conversation ("I want to watch video").
|
||||||
|
2. **SDP (The Letter inside):** Describes technical details ("Send video to IP X, Port Y, using Format Z").
|
||||||
|
3. **RTP (The result):** After this SIP/SDP handshake finishes, the actual binary video stream (PS/H.264) starts flowing over a separate TCP/UDP connection.
|
||||||
|
|
||||||
|
### Breakdown of your Log
|
||||||
|
This log shows a **Real-time Live View** handshake.
|
||||||
|
|
||||||
|
#### 1. The Request (SRS Server -> Camera)
|
||||||
|
The Server asks the Camera to send video.
|
||||||
|
|
||||||
|
```ini
|
||||||
|
INVITE sip:34020000001320000001@3402000000 SIP/2.0
|
||||||
|
Content-Type: application/sdp
|
||||||
|
|
||||||
|
s=Play # "Play" = Real-time Live View (Standard 9.2.2.1)
|
||||||
|
c=IN IP4 192.168.2.184 # The Media Server IP
|
||||||
|
m=video 9000 TCP/RTP/AVP 96 # "Send video to my Port 9000 via TCP"
|
||||||
|
a=recvonly # "I will only receive, not send"
|
||||||
|
y=0911024252 # **GB/T 28181 Special**: The SSRC (Stream ID)
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 2. The Response (Camera -> SRS Server)
|
||||||
|
The Camera agrees and tells the server its own details.
|
||||||
|
|
||||||
|
```ini
|
||||||
|
SIP/2.0 200 OK
|
||||||
|
Content-Type: application/sdp
|
||||||
|
|
||||||
|
c=IN IP4 192.168.2.64 # The Camera IP
|
||||||
|
m=video 15060 TCP/RTP/AVP 96 # "I am sending from Port 15060"
|
||||||
|
a=sendonly # "I will only send"
|
||||||
|
a=setup:active # "I will initiate the TCP connection to you"
|
||||||
|
y=0911024252 # Matches the SSRC provided
|
||||||
|
f=v/2/2560x1440/25/2/8192a/... # **GB/T 28181 Special**: Media Info
|
||||||
|
```
|
||||||
|
|
||||||
|
### Key Differences from Standard SDP
|
||||||
|
GB/T 28181 modifies standard SDP with two specific fields mandatory for this protocol:
|
||||||
|
|
||||||
|
1. **`y=` (SSRC)**:
|
||||||
|
* **Standard SDP:** Does not have a `y` line.
|
||||||
|
* **GB/T 28181:** Uses `y` to define the **SSRC** (Synchronization Source). This 10-digit number is crucial because it marks every binary video packet sent later. If the binary stream headers don't match this `y` value, the stream is rejected.
|
||||||
|
|
||||||
|
2. **`f=` (Media Info)**:
|
||||||
|
* **Standard SDP:** Does not have an `f` line.
|
||||||
|
* **GB/T 28181:** Uses `f` to describe video parameters. In your log: `v/2/2560x1440/25...` means:
|
||||||
|
* `v`: Video
|
||||||
|
* `2`: Coding format (likely H.264 or H.265 mapped)
|
||||||
|
* `2560x1440`: Resolution
|
||||||
|
* `25`: Frame rate
|
||||||
|
|
||||||
|
### Summary of Cooperation
|
||||||
|
1. **XML (SIP MESSAGE):** Used for "remote control" (PTZ, Query, Keepalive).
|
||||||
|
2. **SDP (SIP INVITE):** Used to *negotiate* the pipeline.
|
||||||
|
3. **Binary (RTP/PS):** The actual heavy video data that flows through the pipe created by the SDP.
|
||||||
@ -3,6 +3,11 @@ max_connections 1000;
|
|||||||
# For docker, please use docker logs to manage the logs of SRS.
|
# For docker, please use docker logs to manage the logs of SRS.
|
||||||
# See https://docs.docker.com/config/containers/logging/
|
# See https://docs.docker.com/config/containers/logging/
|
||||||
srs_log_tank console;
|
srs_log_tank console;
|
||||||
|
|
||||||
|
# srs_log_tank file;
|
||||||
|
# srs_log_file /var/log/srs/srs.log;
|
||||||
|
# ff_log_dir /var/log/srs;
|
||||||
|
|
||||||
daemon off;
|
daemon off;
|
||||||
disable_daemon_for_docker off;
|
disable_daemon_for_docker off;
|
||||||
http_api {
|
http_api {
|
||||||
|
|||||||
@ -277,8 +277,8 @@ SRS-SIP 是一个基于 GB28181 协议的视频监控系统,提供设备管理
|
|||||||
- `down`: 向下
|
- `down`: 向下
|
||||||
- `left`: 向左
|
- `left`: 向左
|
||||||
- `right`: 向右
|
- `right`: 向右
|
||||||
- `zoom_in`: 放大
|
- `zoomin`: 放大
|
||||||
- `zoom_out`: 缩小
|
- `zoomout`: 缩小
|
||||||
- `stop`: 停止
|
- `stop`: 停止
|
||||||
- `speed`: 控制速度(1-9)
|
- `speed`: 控制速度(1-9)
|
||||||
|
|
||||||
|
|||||||
4535
doc/GBT+28181-2022.md
Normal file
4535
doc/GBT+28181-2022.md
Normal file
File diff suppressed because it is too large
Load Diff
33
docker-compose.yml
Normal file
33
docker-compose.yml
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
services:
|
||||||
|
srs-sip:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
network: host
|
||||||
|
args:
|
||||||
|
HTTP_PROXY: ${HTTP_PROXY:-}
|
||||||
|
NO_PROXY: "localhost,127.0.0.1,::1"
|
||||||
|
environment:
|
||||||
|
# CANDIDATE: ${CANDIDATE:-}
|
||||||
|
CANDIDATE: 192.168.2.184
|
||||||
|
TZ: "Asia/Shanghai"
|
||||||
|
volumes:
|
||||||
|
- ./run/conf/config.yaml:/usr/local/srs-sip/config.yaml:ro
|
||||||
|
- ./run/logs:/usr/local/srs-sip/logs
|
||||||
|
- ./run/srs/conf/srs.conf:/usr/local/srs/conf/srs.conf:ro
|
||||||
|
# use docker logs
|
||||||
|
- ./run/srs/logs:/var/log/srs/
|
||||||
|
# for recording
|
||||||
|
- ./run/data:/data
|
||||||
|
ports:
|
||||||
|
# SRS RTMP
|
||||||
|
- "1985:1985"
|
||||||
|
# SRS media ingest (GB28181 RTP/PS 等,取决于你的配置)
|
||||||
|
- "9000:9000"
|
||||||
|
# SRS WebRTC
|
||||||
|
- "8000:8000/udp"
|
||||||
|
# SIP
|
||||||
|
- "5060:5060"
|
||||||
|
- "5060:5060/udp"
|
||||||
|
# WebUI
|
||||||
|
- "8025:8025"
|
||||||
|
restart: unless-stopped
|
||||||
@ -1,6 +1,6 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, computed } from 'vue'
|
import { ref, computed } from 'vue'
|
||||||
import { ArrowRight, VideoCamera } from '@element-plus/icons-vue'
|
import { ArrowRight, VideoCamera, ZoomIn, ZoomOut } from '@element-plus/icons-vue'
|
||||||
import {
|
import {
|
||||||
ArrowUp,
|
ArrowUp,
|
||||||
ArrowDown,
|
ArrowDown,
|
||||||
@ -158,6 +158,27 @@ const isDisabled = computed(() => !props.activeWindow)
|
|||||||
<div class="direction-center"></div>
|
<div class="direction-center"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="zoom-controls">
|
||||||
|
<el-button
|
||||||
|
class="zoom-btn"
|
||||||
|
:disabled="isDisabled"
|
||||||
|
@mousedown="handlePtzStart('zoomin')"
|
||||||
|
@mouseup="handlePtzStop"
|
||||||
|
@mouseleave="handlePtzStop"
|
||||||
|
>
|
||||||
|
<el-icon><ZoomIn /></el-icon>
|
||||||
|
</el-button>
|
||||||
|
<div class="zoom-label">变倍</div>
|
||||||
|
<el-button
|
||||||
|
class="zoom-btn"
|
||||||
|
:disabled="isDisabled"
|
||||||
|
@mousedown="handlePtzStart('zoomout')"
|
||||||
|
@mouseup="handlePtzStop"
|
||||||
|
@mouseleave="handlePtzStop"
|
||||||
|
>
|
||||||
|
<el-icon><ZoomOut /></el-icon>
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
<div class="speed-control">
|
<div class="speed-control">
|
||||||
<div class="speed-value">{{ speed }}</div>
|
<div class="speed-value">{{ speed }}</div>
|
||||||
<el-slider
|
<el-slider
|
||||||
@ -346,6 +367,48 @@ const isDisabled = computed(() => !props.activeWindow)
|
|||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.zoom-controls {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
height: 120px;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.zoom-btn {
|
||||||
|
--el-button-bg-color: var(--el-color-primary-light-8);
|
||||||
|
--el-button-border-color: var(--el-color-primary-light-5);
|
||||||
|
--el-button-hover-bg-color: var(--el-color-primary-light-7);
|
||||||
|
--el-button-hover-border-color: var(--el-color-primary-light-4);
|
||||||
|
--el-button-active-bg-color: var(--el-color-primary-light-5);
|
||||||
|
--el-button-active-border-color: var(--el-color-primary);
|
||||||
|
|
||||||
|
width: 36px;
|
||||||
|
height: 36px;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
border-radius: 4px;
|
||||||
|
|
||||||
|
.el-icon {
|
||||||
|
font-size: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
transform: scale(1.05);
|
||||||
|
}
|
||||||
|
|
||||||
|
&:active {
|
||||||
|
transform: scale(0.95);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.zoom-label {
|
||||||
|
font-size: 12px;
|
||||||
|
color: var(--el-text-color-secondary);
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
.control-groups,
|
.control-groups,
|
||||||
.control-group {
|
.control-group {
|
||||||
display: none;
|
display: none;
|
||||||
|
|||||||
Reference in New Issue
Block a user