RTMP Protocol
RTMP (Real-Time Messaging Protocol) is the most widely used live streaming publishing protocol. Monibuca V6 provides full RTMP publishing and subscribing support, compatible with all major streaming tools.
Basic Information
Section titled “Basic Information”| Property | Value |
|---|---|
| Default Port | 1935 |
| Transport Layer | TCP |
| Publish | ✅ Supported |
| Subscribe | ✅ Supported |
| Latency | 1-3 seconds |
| Feature Flag | rtmp |
Configuration
Section titled “Configuration”Feature Activation
Section titled “Feature Activation”[features]rtmp = ["dep:plugin-rtmp"]Configuration File
Section titled “Configuration File”rtmp: enable: true tcp: listen_addr: ":1935" chunk_size: 4096| Option | Type | Default | Description |
|---|---|---|---|
enable | bool | true | Whether to enable the RTMP plugin |
tcp.listen_addr | string | ":1935" | Listen address |
chunk_size | u32 | 4096 | RTMP Chunk size (1-65536) |
Publishing
Section titled “Publishing”Publishing with FFmpeg
Section titled “Publishing with FFmpeg”# Publish a local fileffmpeg -re -i input.mp4 -c copy -f flv rtmp://localhost:1935/live/test
# Publish camera feedffmpeg -f v4l2 -i /dev/video0 -c:v libx264 -f flv rtmp://localhost:1935/live/camera
# Publish with specific encoding parametersffmpeg -re -i input.mp4 \ -c:v libx264 -preset veryfast -b:v 2000k \ -c:a aac -b:a 128k \ -f flv rtmp://localhost:1935/live/testPublishing with OBS
Section titled “Publishing with OBS”- Open OBS, go to Settings → Stream
- Select Custom for the service
- Fill in:
- Server:
rtmp://your-server-ip:1935/live - Stream Key:
test(i.e., the stream name)
- Server:
- Click Start Streaming
Stream Path Format
Section titled “Stream Path Format”RTMP URL format: rtmp://host:port/{app}/{stream}
app: Application name (e.g.,live)stream: Stream name (e.g.,test)- The full stream path is:
{app}/{stream}, i.e.,live/test
Subscribing
Section titled “Subscribing”Subscribing with FFplay
Section titled “Subscribing with FFplay”ffplay rtmp://localhost:1935/live/testSubscribing with VLC
Section titled “Subscribing with VLC”- Open VLC, select Media → Open Network Stream
- Enter URL:
rtmp://localhost:1935/live/test - Click Play
Recording with FFmpeg
Section titled “Recording with FFmpeg”# Subscribe and save as MP4ffmpeg -i rtmp://localhost:1935/live/test -c copy output.mp4
# Subscribe and re-publish to another serverffmpeg -i rtmp://localhost:1935/live/test -c copy -f flv rtmp://other-server/live/testCross-Protocol Subscribing
Section titled “Cross-Protocol Subscribing”After publishing via RTMP, you can subscribe to the same stream using other protocols:
# RTMP publishffmpeg -re -i input.mp4 -c copy -f flv rtmp://localhost:1935/live/test
# HTTP-FLV subscribeffplay http://localhost:8080/flv/live/test.flv
# HLS subscribeffplay http://localhost:8080/hls/live/test/index.m3u8Port Already in Use
Section titled “Port Already in Use”If port 1935 is already in use, you can change the listen address:
rtmp: tcp: listen_addr: ":1936"Reconnection After Disconnect
Section titled “Reconnection After Disconnect”The RTMP plugin supports reconnection after the publisher disconnects. A new publishing connection automatically replaces the old publisher, and subscribers seamlessly switch to the new stream data.