Compare commits

..

6 Commits

Author SHA1 Message Date
e80164f5be docs: enhance README with detailed explanation of SIP and SDP architecture
Some checks failed
CodeQL / Analyze Go Code (go) (push) Has been cancelled
2026-01-13 15:06:52 +08:00
ff4ddfacba refactor: rename zoom commands to use camelCase in API and PTZ control 2026-01-13 14:50:26 +08:00
ffb3fc423e feat: add zoom_in and zoom_out commands to PTZ command map
note: the `API.md` said it's `zoom_in` and `zoom_out` with underscore, while the go ptzCmdMap said it's `zoomin` and `zoomout` with underscore; I choose to support both (or unify them?)
2026-01-13 14:46:57 +08:00
b4474a160d feat: add zoom controls to PtzControlPanel with zoom in and zoom out functionality 2026-01-13 14:34:47 +08:00
6fbbfb698a Add configuration files for SRS SIP and update README with Docker commands 2026-01-13 11:45:32 +08:00
42d018b854 Add Docker support and configuration for SRS SIP
- Created a new README_cross.md file with Docker build instructions.
- Updated srs.conf to include logging configuration options.
- Added docker-compose.yml to define the SRS SIP service with necessary ports and volume mappings.
- Introduced config.yaml for general and GB28181-specific configurations.
- Added initial srs.conf with settings for RTMP, HTTP API, and WebRTC support.
2026-01-13 11:41:07 +08:00
8 changed files with 152 additions and 85 deletions

2
.gitignore vendored
View File

@ -23,3 +23,5 @@
hs_err_pid*
objs
.idea
run

View File

@ -1,4 +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.

View File

@ -277,8 +277,8 @@ SRS-SIP 是一个基于 GB28181 协议的视频监控系统,提供设备管理
- `down`: 向下
- `left`: 向左
- `right`: 向右
- `zoom_in`: 放大
- `zoom_out`: 缩小
- `zoomin`: 放大
- `zoomout`: 缩小
- `stop`: 停止
- `speed`: 控制速度1-9

View File

@ -575,11 +575,16 @@ SIP消息应支持基于UDP和TCP的传输。
## 4.3.5媒体回放控制协议
历史视音频的回放控制命令应采用MANSRTSP协议描述应符合附录B的规定实现设备在端到 端之间对视音频流的正常、快速、暂停、停止、随机拖动播放等远程控制。历史媒体的回放控制命令采用 SIP消息INFO的消息体携带传输。
历史视音频的回放控制命令应采用MANSRTSP协议描述应符合附录B的规定实现设备在端到
端之间对视音频流的正常、快速、暂停、停止、随机拖动播放等远程控制。历史媒体的回放控制命令采用 SIP消息INFO的消息体携带传输。
## 4.3.6媒体传输和媒体编解码协议
值功能。RTP的负载应采用如下两种格式之一基于PS封装的视音频数据或视音频基本流数据应符 间戳信息及各数据流的同步同一帧视音频数据包封装成的所有RTP数据包的RTP时间戳相同且与 议,为按序传输数据包提供可靠保证,提供流量控制和拥塞控制。
媒体流在联网系统 IP 网络上传输时应支持
RTP传输媒体流发送源端应支持控制媒体流发送峰值功能。RTP的负载应采用如下两种格式之一基于PS封装的视音频数据或视音频基本流数据应符合附录C的规定。媒体流的传输应采用
IETF RFC 3550规定的RTP 协议,提供实时数据传输中的时间戳信息及各数据流的同步,同一帧视音频数据包封装成的所有 RTP数据包的RTP
时间戳相同且与不同帧视音频数据包的RTP数据包的RTP 时间戳不同;宣采用 IETF RFC 3550规定的 RTCP
协议,为按序传输数据包提供可靠保证,提供流量控制和拥塞控制。
## 5传输要求

View File

@ -14,7 +14,10 @@ services:
- ./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"

View File

@ -1,6 +1,6 @@
<script setup lang="ts">
import { ref, computed } from 'vue'
import { ArrowRight, VideoCamera } from '@element-plus/icons-vue'
import { ArrowRight, VideoCamera, ZoomIn, ZoomOut } from '@element-plus/icons-vue'
import {
ArrowUp,
ArrowDown,
@ -158,6 +158,27 @@ const isDisabled = computed(() => !props.activeWindow)
<div class="direction-center"></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-value">{{ speed }}</div>
<el-slider
@ -346,6 +367,48 @@ const isDisabled = computed(() => !props.activeWindow)
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-group {
display: none;

View File

@ -1,20 +0,0 @@
# 通用配置
common:
# [debug, info, warn, error]
log-level: "info"
log-file: "logs/srs-sip.log"
# GB28181配置
gb28181:
serial: "34020000002000000001"
realm: "3402000000"
host: "0.0.0.0"
port: 5060
auth:
enable: false
password: "123456"
# HTTP服务配置
http:
listen: 8025
dir: ./html

View File

@ -1,60 +0,0 @@
listen 1935;
max_connections 1000;
# For docker, please use docker logs to manage the logs of SRS.
# See https://docs.docker.com/config/containers/logging/
srs_log_tank console;
daemon off;
disable_daemon_for_docker off;
http_api {
enabled on;
listen 1985;
raw_api {
enabled on;
allow_reload on;
}
}
http_server {
enabled on;
listen 8080;
dir ./objs/nginx/html;
}
stream_caster {
enabled on;
caster gb28181;
output rtmp://127.0.0.1/live/[stream];
listen 9000;
sip {
enabled off;
}
}
rtc_server {
enabled on;
listen 8000; # UDP port
# @see https://github.com/ossrs/srs/wiki/v4_CN_WebRTC#config-candidate
candidate $CANDIDATE;
# Disable for Oryx.
use_auto_detect_network_ip off;
api_as_candidates off;
}
vhost __defaultVhost__ {
http_remux {
enabled on;
mount [vhost]/[app]/[stream].flv;
}
rtc {
enabled on;
nack on;
twcc on;
stun_timeout 30;
dtls_role passive;
# @see https://github.com/ossrs/srs/wiki/v4_CN_WebRTC#rtmp-to-rtc
rtmp_to_rtc on;
keep_bframe off;
# @see https://github.com/ossrs/srs/wiki/v4_CN_WebRTC#rtc-to-rtmp
rtc_to_rtmp on;
pli_for_rtmp 6.0;
}
}