RTSPtoWeb中文API文档
RTSPtoWeb API
视频流#
视频流列表#
请求#
GET /streams
curl http://demo:demo@127.0.0.1:8083/streams
响应#
{
"status": 1,
"payload": {
"demo1": {
"name": "test video",
"channels": {
"0": {
"name": "ch1",
"url": "rtsp://admin:admin@{YOUR_CAMERA_IP}/uri",
"on_demand": true,
"debug": false,
"status": 0
},
"1": {
"name": "ch2",
"url": "rtsp://admin:admin@{YOUR_CAMERA_IP}/uri",
"on_demand": true,
"debug": false,
"status": 0
}
}
},
"demo2": {
"name": "test video",
"channels": {
"0": {
"name": "ch1",
"url": "rtsp://admin:admin@{YOUR_CAMERA_IP}/uri",
"on_demand": true,
"debug": false,
"status": 0
},
"1": {
"name": "ch2",
"url": "rtsp://admin:admin@{YOUR_CAMERA_IP}/uri",
"on_demand": true,
"debug": false,
"status": 0
}
}
}
}
}
添加视频流#
请求#
POST /stream/{STREAM_ID}/add
curl \
--header "Content-Type: application/json" \
--request POST \
--data '{
"name": "test video",
"channels": {
"0": {
"name": "ch1",
"url": "rtsp://admin:admin@{YOUR_CAMERA_IP}/uri",
"on_demand": true,
"debug": false,
"status": 0
},
"1": {
"name": "ch2",
"url": "rtsp://admin:admin@{YOUR_CAMERA_IP}/uri",
"on_demand": true,
"debug": false,
"status": 0
}
}
}' \
http://demo:demo@127.0.0.1:8083/stream/{STREAM_ID}/add
响应#
{
"status": 1,
"payload": "success"
}
更新视频流#
请求#
POST /stream/{STREAM_ID}/edit
curl \
--header "Content-Type: application/json" \
--request POST \
--data '{
"name": "test video",
"channels": {
"0": {
"name": "ch1",
"url": "rtsp://admin:admin@{YOUR_CAMERA_IP}/uri",
"on_demand": true,
"debug": false,
"status": 0
},
"1": {
"name": "ch2",
"url": "rtsp://admin:admin@{YOUR_CAMERA_IP}/uri",
"on_demand": true,
"debug": false,
"status": 0
}
}
}' \
http://demo:demo@127.0.0.1:8083/stream/{STREAM_ID}/edit
响应#
{
"status": 1,
"payload": "success"
}
重载视频流#
请求#
GET /stream/{STREAM_ID}/reload
curl http://demo:demo@127.0.0.1:8083/stream/{STREAM_ID}/reload
响应#
{
"status": 1,
"payload": "success"
}
获取视频流信息#
请求#
GET /stream/{STREAM_ID}/info
curl http://demo:demo@127.0.0.1:8083/stream/{STREAM_ID}/info
响应#
{
"status": 1,
"payload": {
"name": "test video",
"channels": {
"0": {
"name": "ch1",
"url": "rtsp://admin:admin@{YOUR_CAMERA_IP}/uri",
"on_demand": true,
"debug": false,
"status": 0
},
"1": {
"name": "ch2",
"url": "rtsp://admin:admin@{YOUR_CAMERA_IP}/uri",
"on_demand": true,
"debug": false,
"status": 0
}
}
}
}
删除视频流#
请求#
GET /stream/{STREAM_ID}/delete
curl http://demo:demo@127.0.0.1:8083/stream/{STREAM_ID}/delete
响应#
{
"status": 1,
"payload": "success"
}
通道#
添加通道到视频流#
请求#
POST /stream/{STREAM_ID}/channel/{CHANNEL_ID}/add
curl \
--header "Content-Type: application/json" \
--request POST \
--data '{
"name": "ch4",
"url": "rtsp://admin:admin@{YOUR_CAMERA_IP}/uri",
"on_demand": false,
"debug": false,
"status": 0
}' \
http://demo:demo@127.0.0.1:8083/stream/{STREAM_ID}/channel/{CHANNEL_ID}/add
响应#
{
"status": 1,
"payload": "success"
}
更新通道视频流#
请求#
POST /stream/{STREAM_ID}/channel/{CHANNEL_ID}/edit
curl \
--header "Content-Type: application/json" \
--request POST \
--data '{
"name": "ch4",
"url": "rtsp://admin:admin@{YOUR_CAMERA_IP}/uri",
"on_demand": true,
"debug": false,
"status": 0
}' \
http://demo:demo@127.0.0.1:8083/stream/{STREAM_ID}/channel/{CHANNEL_ID}/edit
响应#
{
"status": 1,
"payload": "success"
}
重载通道视频流#
请求#
GET /stream/{STREAM_ID}/channel/{CHANNEL_ID}/reload
curl http://demo:demo@127.0.0.1:8083/stream/{STREAM_ID}/channel/{CHANNEL_ID}/reload
响应#
{
"status": 1,
"payload": "success"
}
获取通道视频流信息#
请求#
GET /stream/{STREAM_ID}/channel/{CHANNEL_ID}/info
curl http://demo:demo@127.0.0.1:8083/stream/{STREAM_ID}/channel/{CHANNEL_ID}/info
响应#
{
"status": 1,
"payload": {
"name": "ch4",
"url": "rtsp://admin:admin@{YOUR_CAMERA_IP}/uri",
"on_demand": false,
"debug": false,
"status": 1
}
}
获取通道视频流编码信息#
请求#
GET /stream/{STREAM_ID}/{CHANNEL_ID}/codec
curl http://demo:demo@127.0.0.1:8083/stream/{STREAM_ID}/{CHANNEL_ID}/codec
响应#
{
"status": 1,
"payload": [
{
"Record": "AU0AFP/hABRnTQAUlahQfoQAAAMABAAAAwCiEAEABGjuPIA=",
"RecordInfo": {
"AVCProfileIndication": 77,
"ProfileCompatibility": 0,
"AVCLevelIndication": 20,
"LengthSizeMinusOne": 3,
"SPS": [
"Z00AFJWoUH6EAAADAAQAAAMAohA="
],
"PPS": [
"aO48gA=="
]
},
"SPSInfo": {
"ProfileIdc": 77,
"LevelIdc": 20,
"MbWidth": 20,
"MbHeight": 15,
"CropLeft": 0,
"CropRight": 0,
"CropTop": 0,
"CropBottom": 0,
"Width": 320,
"Height": 240
}
}
]
}
删除通道视频流#
请求#
GET /stream/{STREAM_ID}/channel/{CHANNEL_ID}/delete
curl http://demo:demo@127.0.0.1:8083/stream/{STREAM_ID}/channel/{CHANNEL_ID}/delete
响应#
{
"status": 1,
"payload": "success"
}
视频端点#
HLS#
GET /stream/{STREAM_ID}/channel/{CHANNEL_ID}/hls/live/index.m3u8
curl http://127.0.0.1:8083/stream/{STREAM_ID}/channel/{CHANNEL_ID}/hls/live/index.m3u8
ffplay http://127.0.0.1:8083/stream/{STREAM_ID}/channel/{CHANNEL_ID}/hls/live/index.m3u8
HLS-LL#
GET /stream/{STREAM_ID}/channel/{CHANNEL_ID}/hlsll/live/index.m3u8
curl http://127.0.0.1:8083/stream/{STREAM_ID}/channel/{CHANNEL_ID}/hlsll/live/index.m3u8
ffplay http://127.0.0.1:8083/stream/{STREAM_ID}/channel/{CHANNEL_ID}/hlsll/live/index.m3u8
MSE#
/stream/{STREAM_ID}/channel/{CHANNEL_ID}/mse?uuid={STREAM_ID}&channel={CHANNEL_ID}
ws://127.0.0.1:8083/stream/{STREAM_ID}/channel/{CHANNEL_ID}/mse?uuid={STREAM_ID}&channel={CHANNEL_ID}
注意⚠️: 安全连接使用 wss
.
WebRTC#
/stream/{STREAM_ID}/channel/{CHANNEL_ID}/webrtc
http://127.0.0.1:8083/stream/{STREAM_ID}/channel/{CHANNEL_ID}/webrtc
请求#
The request is an HTTP POST
with a parameter data
that is a base64 encoded SDP offer (e.g. v=0...
) from a WebRTC client.
响应#
The response is a base64 encoded SDP Answer.
RTSP#
/{STREAM_ID}/{CHANNEL_ID}
rtsp://127.0.0.1:{RTSP_PORT}/{STREAM_ID}/{CHANNEL_ID}
ffplay -rtsp_transport tcp rtsp://127.0.0.1/{STREAM_ID}/{CHANNEL_ID}
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?