Skip to content

Stream Management API

Stream management is the core API of Monibuca, providing complete control over audio/video streams, including stream querying, pull stream creation, stopping, pause/resume, and subscriber management.

GET /api/streams

Returns summary information for all active streams in the current engine.

Response example:

{
"code": 0,
"message": "success",
"data": {
"total": 3,
"streams": [
{
"path": "live/camera01",
"state": "publishing",
"publisher": {
"type": "rtmp",
"remote_addr": "192.168.1.100:54321",
"start_time": "2026-03-18T14:00:00Z"
},
"subscribers": 5,
"video_codec": "H264",
"audio_codec": "AAC",
"video_bitrate": 2500,
"audio_bitrate": 128,
"duration": 1800
},
{
"path": "live/camera02",
"state": "publishing",
"publisher": {
"type": "rtsp",
"remote_addr": "192.168.1.101:554",
"start_time": "2026-03-18T13:30:00Z"
},
"subscribers": 2,
"video_codec": "H265",
"audio_codec": "AAC",
"video_bitrate": 4000,
"audio_bitrate": 128,
"duration": 3600
}
]
}
}
GET /api/stream/{stream_path}

Returns detailed information for a specific stream, including track details and subscriber list.

Request example:

Terminal window
curl http://localhost:8080/api/stream/live/camera01

Response example:

{
"code": 0,
"message": "success",
"data": {
"path": "live/camera01",
"state": "publishing",
"publisher": {
"type": "rtmp",
"remote_addr": "192.168.1.100:54321",
"start_time": "2026-03-18T14:00:00Z"
},
"tracks": {
"video": {
"codec": "H264",
"width": 1920,
"height": 1080,
"fps": 30,
"bitrate": 2500,
"gop_size": 60,
"bps": 312500
},
"audio": {
"codec": "AAC",
"sample_rate": 44100,
"channels": 2,
"bitrate": 128,
"bps": 16000
}
},
"subscribers": [
{
"id": "sub_001",
"type": "flv",
"remote_addr": "192.168.1.200:12345",
"start_time": "2026-03-18T14:05:00Z",
"duration": 1500
},
{
"id": "sub_002",
"type": "hls",
"remote_addr": "192.168.1.201:23456",
"start_time": "2026-03-18T14:10:00Z",
"duration": 1200
}
],
"subscriber_count": 2,
"duration": 1800,
"bytes_in": 562500000,
"bytes_out": 1125000000
}
}
POST /api/stream/pull
Content-Type: application/json
{
"stream_path": "live/remote_camera",
"url": "rtsp://192.168.1.50:554/stream1",
"proxy": false
}

Pull a stream from a remote URL and publish it locally. Supports RTMP, RTSP, HTTP-FLV, and other protocol sources.

Response example:

{
"code": 0,
"message": "success",
"data": {
"stream_path": "live/remote_camera",
"source_url": "rtsp://192.168.1.50:554/stream1",
"status": "pulling"
}
}
POST /api/stream/stop
Content-Type: application/json
{
"stream_path": "live/camera01"
}

Forcefully stop a specific stream. This disconnects the publisher and notifies all subscribers.

Response example:

{
"code": 0,
"message": "success",
"data": {
"stream_path": "live/camera01",
"status": "stopped"
}
}
POST /api/stream/pause
Content-Type: application/json
{
"stream_path": "live/camera01"
}

Pause stream distribution. The publisher continues to push, but subscribers no longer receive new data.

POST /api/stream/resume
Content-Type: application/json
{
"stream_path": "live/camera01"
}

Resume distribution of a paused stream.

GET /api/stream/{stream_path}/subscribers

Returns all subscriber information for a specific stream.

Response example:

{
"code": 0,
"message": "success",
"data": {
"stream_path": "live/camera01",
"total": 5,
"subscribers": [
{
"id": "sub_001",
"type": "flv",
"remote_addr": "192.168.1.200:12345",
"start_time": "2026-03-18T14:05:00Z",
"duration": 1500,
"bytes_out": 37500000
}
]
}
}
POST /api/stream/{stream_path}/subscriber/kick
Content-Type: application/json
{
"subscriber_id": "sub_001"
}

Forcefully disconnect a specific subscriber.

GET /api/stream/{stream_path}/tracks

Get a snapshot of the stream’s track information, including real-time encoding parameters and statistics.

Response example:

{
"code": 0,
"message": "success",
"data": {
"video": {
"codec": "H264",
"profile": "High",
"level": "4.1",
"width": 1920,
"height": 1080,
"fps": 30.0,
"bitrate_kbps": 2500,
"keyframe_interval": 2.0,
"total_frames": 54000,
"total_keyframes": 900,
"ring_buffer_size": 256,
"ring_buffer_used": 128
},
"audio": {
"codec": "AAC",
"profile": "LC",
"sample_rate": 44100,
"channels": 2,
"bitrate_kbps": 128,
"total_frames": 84375
}
}
}
GET /api/sysinfo

Returns engine runtime status and system resource usage.

Response example:

{
"code": 0,
"data": {
"version": "6.0.0",
"uptime": 86400,
"os": "linux",
"arch": "x86_64",
"cpu_usage": 15.5,
"memory_usage": 256000000,
"total_streams": 10,
"total_subscribers": 45,
"total_bytes_in": 5000000000,
"total_bytes_out": 25000000000
}
}
GET /api/plugins

Returns status information for all loaded plugins.

Response example:

{
"code": 0,
"data": {
"plugins": [
{
"name": "rtmp",
"version": "6.0.0",
"state": "running",
"description": "RTMP protocol plugin"
},
{
"name": "flv",
"version": "6.0.0",
"state": "running",
"description": "HTTP-FLV protocol plugin"
}
]
}
}