Add sources
1. API Description
This API is used to add sources.
Request mode: POST [ip]/api/source/add
Administrator Rights |
Logged-in |
No |
Yes |
Reference source configuration; the following are explanations and examples for each protocol.
Source Settings
The content of the data field vary according to the value of the type field. When type is url, the data field is the URL source; otherwise, there is an ext field describing its data structure. When type is d_ndi, the data field is the auto-discovered source; when type is ndi, the data field is the custom-added NDI source.
The protocol field represents the protocol type and supports the following types: "ndi", "rtmp", "ts-srt", "ts-udp", "ts-rtp", "rtsp", "http".
Name |
Required |
Type |
Description |
name |
Yes |
String |
Source name. |
protocol |
Yes |
String |
Protocol type. |
type |
Yes |
String |
Type includes url, d_ndi, ndi |
data |
Yes |
Struct |
When type is 'url', specify the URL source; when type is 'd_ndi', specify the auto-discovered source; when type is 'ndi', specify the manual-added NDI source. |
URL Source Settings
Name |
Required |
Type |
Description |
url |
Yes |
String |
URL address, containing only standard stream information (e.g., IP, port). |
buffer-ms |
Yes |
Integer |
Buffer time in milliseconds (ms). |
ptz_en |
Yes |
Boolean |
PTZ Control Enable: On the Web UI, the PTZ settings page is collapsed by default. When this parameter is set to true, the PTZ settings section will be not collapsed. |
ptz |
No |
Struct |
When the data source is a camera and supports PTZ control, this parameter can be set, referring to the PTZ settings. |
PTZ Settings
Name |
Required |
Type |
Description |
protocol |
Yes |
String |
PTZ control protocol, value values: "VISCA over UDP", other protocols can be extended later. |
ip |
Yes |
String |
PTZ IP address |
port |
Yes |
Integer |
PTZ port |
device_id |
Yes |
Integer |
PTZ ID |
message_header |
No |
Boolean |
Whether to add VISCA UDP message header |
invert_pan |
No |
Boolean |
Whether to invert the horizontal control direction |
invert_tilt |
No |
Boolean |
Whether to invert the vertical control direction |
Automate NDI Discovery Sources
Name |
Required |
Type |
Description |
name |
Yes |
String |
NDI stream name |
url |
Yes |
String |
NDI address |
Manual-added NDI Sources
Name |
Required |
Type |
Description |
name |
Yes |
String |
NDI stream name |
url |
Yes |
String |
NDI address |
low_bw |
No |
Boolean |
Whether to enable low-bandwidth mode, true to enable, false to diable. |
transport |
No |
String |
Transport mode includes "auto", "multicast", "udp", "rudp", "tcp", "multi-tcp". |
pts_mode |
No |
String |
Timestamp mode includes "auto", "timecode", "timestamp" |
buffer_ms |
Yes |
Integer |
Buffer time in milliseconds. |
NDI URL
100.100.10.1:5000
URL |
Description |
100.100.10.1:5000 |
IP address and port of the NDI source. |
HTTP(S) URL
http://100.100.10.1:5000?mw-bitrate=4096&mw-buffer-duration=150
URL |
Description |
http://100.100.10.1:5000 |
A standard http url contains IP address and port number. |
mw-bitrate |
Bitrate |
mw-buffer-duration |
Buffer time in milliseconds, 150ms at least for HTTP/HLS. |
RTSP URL
rtsp://127.0.0.1?mw-tcp-first=true&mw-buffer-duration=60
URL |
Description |
rtsp://127.0.0.1 |
A standard rtsp url. |
mw-tcp-first |
TCP first, value values: true/false |
mw-buffer-duration |
Buffer time in milliseconds. |
RTMP URL
rtmp://127.0.0.1/live/[key]?mw-buffer-duration=60
URL |
Description |
rtmp://127.0.0.1 |
A standard rtmp url |
key |
Key, must be the last part of the url, slash (/) is not supported. |
mw-buffer-duration |
Buffer time in milliseconds. |
MPEG-TS over UDP URL
// Multicast
udp://@ip:port?mw-audio-track=1&mw-buffer-duration=60
// Unicast
udp://@0.0.0.0:port?mw-audio-track=1&mw-buffer-duration=60
URL |
Description |
ip |
Unicast: 0.0.0.0 multicast: 224.0.0.0 ~ 239.255.255.255 |
port |
Port number, range: 1 ~ 65535. |
mw-audio-track |
Audio track, 1 ~ 8. |
mw-buffer-duration |
Buffer time in milliseconds. |
MPEG-TS over SRT URL
// Caller
srt://ip:port?mode=caller&streamid=12323&passphrase=12345678914&latency=123&mw-audio-track=1&mw-buffer-duration=60
// Listener
srt://0.0.0.0:port?mode=listener&streamid=12323&passphrase=12345678914&latency=123&mw-audio-track=1&mw-buffer-duration=60
URL |
Description |
ip |
Listener: 0.0.0.0 caller: legal ip address (can't be 0.0.0.0) |
port |
Port number, value range: 1 ~ 65535 |
mode |
Mode, value values: caller/listener |
streamid |
Streamid |
latency |
Delay time, value range: 20 ~ 8000 |
encryption |
Whether encryption, value values: true/false |
passphrase |
Encryption password, optional, set when encryption is needed, length: 10 ~ 79 |
mw-audio-track |
Audio-track, value range: 1 ~ 8 |
mw-buffer-duration |
Buffer time in milliseconds. |
MPEG-TS over RTP URL
// Multicast
rtp://ip:port?mw-ts-progid=123&mw-audio-track=1&mw-buffer-duration=60
// Unicast
rtp://0.0.0.0:port?mw-ts-progid=123&mw-audio-track=1&mw-buffer-duration=60
URL |
Description |
ip |
Unicast: 0.0.0.0 Multicast: IP range 224.0.0.0 ~ 239.255.255.255 |
port |
port number, value range: 1 ~ 65535 |
mw-audio-track |
audio-track, value range: 1 ~ 8 |
mw-ts-progid |
progid, optional. |
mw-buffer-duration |
Buffer time in milliseconds. |
3. Output Parameters
Name |
Type |
Description |
status |
Int |
Status code |
code |
String |
Status description |
4. Example
Adding NDI sources.
{
"name": "name1",
"protocol": "ndi",
"type": "ndi",
"data": {
"name": "ULTRA ENCODE (C315230423002-2)",
"url": "100.100.330.21:5000",
"low_bw": false,
"transport": "tcp",
"pts_mode": "auto",
"buffer_ms": 60
}
}
Output Example
{
"status": 0,
"code" : "Success"
}
5. Error Code
No error code related to the API business logic. For other error codes, see Common Error Codes.