文章目录
source module
Video source management module, decoder core module, users need to add coding source first before decoding playback/streaming services and other functions.
Include: interface to gain video source list, add, modify and delete
Gain video source list
API instruction
Gain video source list。
Request
- Method: GET/POST
- URL:
source/get.json
- Headers:
- submet parameters: no
Response
- Body:
{
"result": "ok",
"data": [
{
"manual_url": "rtmp://103.229.149.171/myapp/GoProCut",
"name_position": "left_top",
"audio_port": 0,
"id": "MANUAL.6",
"audio_codec": "",
"password": "",
"video_codec": "",
"bitrate": 1856,
"resolution": "[email protected]",
"time_position": "left_top",
"status": "off",
"trans_mode": "tcp",
"src": "103.229.149.171",
"bind_net": "*",
"user": "",
"type": "rtmp",
"buffer": "live:200:200:500:0:0",
"name": "rtmp-gopro",
"video_port": 0
},
{
"manual_url": "rtsp://192.168.3.102/ch01",
"name_position": "left_top",
"audio_port": 0,
"id": "MANUAL.1",
"audio_codec": "",
"password": "",
"video_codec": "",
"bitrate": 2992,
"resolution": "[email protected]",
"time_position": "left_top",
"status": "view_pull",
"trans_mode": "tcp",
"src": "192.168.3.102",
"bind_net": "*",
"user": "",
"type": "rtsp",
"buffer": "live:200:200:500:0:0",
"name": "102",
"video_port": 0
}
]
}
- Return instructions:
field | type | instructions |
---|---|---|
id | alphabetic string | decoder source ID,add the source manually and take MANUAL as a start, for example:MANUAL.1 |
name | alphabetic string | encoding source name,user defined |
resolution | alphabetic string | resolution@frame rate,for example:[email protected] |
manual_url | alphabetic string | video source address,for example:rtsp://192.168.3.102/ch01 |
src | alphabetic string | video source address,for example :192.168.3.102 |
status | alphabetic string | The current working state of the decoder source: view_pull, pull,view,on,off reconnecting , connecting ,error |
buffer | alphabetic string | connect buffer parameter information,for examplelive:200:200:500:0:0 |
audio_codec | alphabetic string | audio encoding |
video_codec | alphabetic string | video encoding |
bitrate | numerical value | stream rate,Unit K,for example:2992 |
trans_mode | alphabetic string | trans-mode,TCP or UDP |
type | alphabetic string | decoding source type:value:rtmp,rtsp,rtmps,rtp,udp,http,srt |
video_port | numerical value | video port |
audio_port | numerical value | audio port |
user | alphabetic string | connect the user name |
password | alphabetic string | connect the needed password |
test calling :
http://192.168.2.123/api/source/get.json
2.2 add video source
API instructions
Add the video source and configure the address, buffer parameters, connection parameters and so on.
Request
- Method: GET/POST
- URL:
source/add.json
- Headers:
- submit parameters:
field | type | instructions |
---|---|---|
name | alphabetic string | decoding source name(required parameter) |
manual_url | alphabetic string | decoding source address(required parameter),for example:rtsp://192.168.3.101/ch01 |
buffer | alphabetic string | Buffer configuration parameter(required parameter),data range: 0ms :live:0:0:0:0:0 50ms :live:50:50:200:0:0 120ms:live:120:120:300:0:0 200ms:live:200:200:500:0:0 500ms:live:500:500:800:0:0 1s :live:1000:1000:1500:0:0 |
trans_mode | alphabetic string | connect parameters(required parameter),TCP or UDP |
user | alphabetic string | connect decoding source with user name、 Configure based on whether the video source has authenticated user or not |
password | alphabetic string | connect decoding source with password、Configure based on whether the video source has authenticated user or not |
bindNetwork | alphabetic string | setup network,default “auto” |
video_port | alphabetic string | Network receiving port,1-65535 |
audio_port | alphabetic string | Network receiving port,1-65535 |
video_codec | alphabetic string | format [PT,]CODER[/timestamp unit],for example 96,H264/90000 |
audio_codec | alphabetic string | format [PT,]CODER[/timestamp unit/sound channel],for example 96,MPEG4-GENERIC/48000/2 |
Response
- Body:
{ result: "ok"}
test calling :
http://192.168.2.123/api/source/add.json?name=test&manual_url=rtsp%3a%2f%2f192.168.3.101%2fch01&buffer=live%3a200%3a200%3a500%3a0%3a0&trans_mode=TCP
Modify video source parameters
API intructions
Modify video source parameters
Request
- Method: GET/POST
- URL:
source/modify.json
- Headers:
- Submit parameters:
field | type | instructions |
---|---|---|
name | alphabetic string | decoding source name(necessary parameter) |
manual_url | alphabetic string | decoding source address(necessary parameter),for example:rtsp://192.168.3.101/ch01 |
buffer | alphabetic string | buffer confuguration parameter(necessary parameter),state range: 0ms :live:0:0:0:0:0 50ms :live:50:50:200:0:0 120ms:live:120:120:300:0:0 200ms:live:200:200:500:0:0 500ms:live:500:500:800:0:0 1s :live:1000:1000:1500:0:0 |
trans_mode | alphabetic string | connect parameter(necessary parameter),TCP or UDP |
user | alphabetic string | connect decoding source name、Configure based on whether the video source has authorized user or not |
password | alphabetic string | connect decoding source password、 Configure based on whether the video source has authorized user or not |
bindNetwork | alphabetic string | Binding network,default “auto” |
video_port | alphabetic string | network receving port ,range 1-65535 |
audio_port | alphabetic string | network receving port,range 1-65535 |
video_codec | alphabetic string | format is [PT,]CODER[/timestamp unit],如 96,H264/90000 |
audio_codec | alphabetic string | format is [PT,]CODER[/timestamp unit/audio channel ],for example 96,MPEG4-GENERIC/48000/2 |
Response
- Body
{
"result": "ok"
}
test calling :
http://192.168.2.123/api/source/modify.json?id=MANUAL.11&name=test&manual_url=rtsp%3a%2f%2f192.168.3.102%2fch01&buffer=live%3a200%3a200%3a500%3a0%3a0&trans_mode=TCP
Delete video source
API instructions
Delete video source
If the playback or streaming service is configured, then the corresponding playback window and streaming service will be unbound.
Request
- Method: GET/POST
- URL:
source/remove.json
- Headers:
- submit parameters:
field | type | instructions |
---|---|---|
id | alphabetic string | decoding source ID(necessary parameters), for example:“MANUAL.6”,Can be obtained from the encoding source information interface |
Response
- Body
{
"result": "ok"
}
calling test:
http://192.168.2.123/api/source/remove.json?id=MANUAL.11