Add RTMP stream
1. API Description
This API is used to add an RTMP stream.
Request mode:
- V2.6.0 and above: POST [ip]/mwapi/V2.0/stream/add-rtmp
- V2.5.0 and below: POST [ip]/mwapi/add-rtmp
Administrator Rights | Logged-in |
---|---|
No | Yes |
2. Input Parameters
Name | Required | Type | Description |
---|---|---|---|
type | Yes | Int | Streaming type 1: RTMP |
name | Yes | String | Streaming server name |
url | Yes | String | Streaming address |
streamKey | Yes | String | Streaming key |
authentication | Yes | Boolean | Whether authentication is required true: Yes; false: No |
userName | No | String | Username, effective only when authentication is required |
password | No | String | Password, effective only when authentication is required |
autoSwitch | Yes | Boolean | Whether it is configured for automatic streaming, and can start live streaming by pressing a button true: Yes; false: No |
encoder | Yes | EncoderData | Encoding configuration parameters |
EncoderData
Name | Required | Type | Description |
---|---|---|---|
codeType | Yes | Int | Encoding type 0: H.264 |
encodingMode | Yes | Int | Bitrate mode 0: VBR; 1: CBR |
videoBitrate | Yes | Int | Video encoding bitrate, in Kbps |
profile | Yes | Int | Encoding profile 0: Baseline; 1: Main Profile; 2: High Profile |
audioBitrate | Yes | Int | Audio encoding parameters 48: 48Khz, aac, 48kbps 64: 48Khz, aac, 64kbps 96: 48Khz, aac, 96kbps 128: 48Khz, aac, 128kbps 192: 48Khz, aac, 192kbps 256: 48Khz, aac, 256kbps |
keyframeInterval | Yes | Int | Keyframe interval, in seconds |
duration | Yes | Int | Video frame rate 166666: 60 FPS; 333333: 30 FPS |
resolution | Yes | Int | Video resolution 1920x1080: 1080p; 1280x720: 720p |
3. Output Parameters
Name | Type | Description |
---|---|---|
status | Int | Status code |
message | String | Status description |
4. Example
Adding an RTMP stream.
Input Example
{
"type": 1,
"name": "RTMP Server (2)",
"url": "10.10.4.7/live",
"streamKey": "123",
"authentication": true,
"userName": "user",
"password": "123",
"autoSwitch": true,
"encoder": {
"codeType": 0,
"encodingMode": 1,
"videoBitrate": 2048,
"profile": 0,
"audioBitrate": 128,
"keyframeInterval": 2,
"duration": 166666,
"resolution": "1920x1080"
}
}
Output Example
{
"message": "success",
"status": 0
}
5. Error Code
The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.
Status | Definition | Description |
---|---|---|
7 | MW_STATUS_INVALID_ARG | Missing required parameters |
1001 | MW_STATUS_SAME_NAME | A configuration with the same name already exists |
1002 | MW_STATUS_AUTO_LIMIT | The number of automatic streaming tasks exceeds the limit |