Add Source
1. API Description
This API is used to add a source.
Request mode: POST [ip]/api/source/add
| Administrator Rights | Login Authentication |
|---|---|
| No | Yes |
2. Input Parameters
Refer to Source Configuration. The following are descriptions and examples of various protocols:
RTSP
Supports standard RTSP addresses
rtsp://192.168.1.58:899/stream
RTMP
Supports standard RTMP addresses
rtmp://192.168.1.58/live/key
HTTP
Supports standard HTTP file playback
http://192.168.1.58/samples/SampleVideo.mp4
MPEG-TS over UDP
Supports standard UDP addresses
// Multicast
udp://ip:port
// Unicast
udp://0.0.0.0:port
MPEG-TS over SRT
Since SRT has no standard URL definition, the SRT URL definition in FFmpeg is used
// Caller mode
srt://ip:port?mode=caller&latency=125&streamid=test&passphrase=1234567890
// Listener mode
srt://0.0.0.0:port?mode=listener&latency=125&streamid=test
| URL Component | Description |
|---|---|
| ip | Listener: 0.0.0.0 Caller: Valid IP address (cannot be: 0.0.0.0) |
| port | Port number, valid range: 1 ~ 65535 |
| mode | Mode, valid values: caller/listener |
| latency | Latency time, unit: milliseconds, valid range: 20 ~ 8000 |
| passphrase | Encryption password, optional, set only when encryption is needed |
| streamid | Stream ID, character length: 0 ~ 256 |
MPEG-TS over RTP
Supports standard RTP addresses
// Multicast
rtp://ip:port
// Unicast
rtp://0.0.0.0:port
ZIXI PULL
The address format of ZIXI PULL protocol is:
zixi://ip:port/stream?latency=200&encryption=128&key=xxx&password=xxx&minimize_latency=true&ignore_dtls_cert_error=true
| URL Component | Description |
|---|---|
| latency | Latency time, unit: milliseconds, valid range: 20~5000 |
| encryption | Encryption type, values: 128, 192, 256, corresponding to AES-128, AES-192, AES-256 respectively |
| password | Password, optional, cannot contain & or ? |
| key | Encryption key |
| minimize_latency | Whether to minimize latency, true/false |
| ignore_dtls_cert_error | Whether to ignore DTLS certificate errors, true/false |
Other URL Parameters
| URL Component | Supported Protocols | Description |
|---|---|---|
| mw-tcp-first | rtsp | Set RTSP protocol to prefer TCP transmission |
| mw-audio-track | ts over srt/udp/rtp | Select audio track |
| mw-ts-progid | ts over srt/udp/rtp | Select MPEG TS program ID |
| mw-buffer-duration | All | Buffer duration, for HTTP/HLS, need to set at least 1000ms |
Custom NDI Source
| Parameter | Type | Description |
|---|---|---|
| name | String | Name |
| type | Int | Configuration type, value is 3 |
| ndi | Struct | NDI Source Configuration |
Example:
{
"name": "ndi encoder test",
"ndi": {
"name": "ULTRA ENCODE Test (C315230423002-2)",
"url": "10.10.15.43:5961",
"low-bw": false,
"pts-mode": "timestamp",
"transport": "rudp"
},
"type": 3
}
3. Output Parameters
| Parameter | Type | Description |
|---|---|---|
| status | Int | Status code |
4. Example
Add an SRT source
Input Example
{
"name": "srt test",
"config": {
"type": 1,
"url": "srt://10.10.11.117:9000?mode=caller"
}
}
Output Example
{
"status": 0
}