Skip to content

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.

PropertyValue
Default Port1935
Transport LayerTCP
Publish✅ Supported
Subscribe✅ Supported
Latency1-3 seconds
Feature Flagrtmp
Cargo.toml
[features]
rtmp = ["dep:plugin-rtmp"]
rtmp:
enable: true
tcp:
listen_addr: ":1935"
chunk_size: 4096
OptionTypeDefaultDescription
enablebooltrueWhether to enable the RTMP plugin
tcp.listen_addrstring":1935"Listen address
chunk_sizeu324096RTMP Chunk size (1-65536)
Terminal window
# Publish a local file
ffmpeg -re -i input.mp4 -c copy -f flv rtmp://localhost:1935/live/test
# Publish camera feed
ffmpeg -f v4l2 -i /dev/video0 -c:v libx264 -f flv rtmp://localhost:1935/live/camera
# Publish with specific encoding parameters
ffmpeg -re -i input.mp4 \
-c:v libx264 -preset veryfast -b:v 2000k \
-c:a aac -b:a 128k \
-f flv rtmp://localhost:1935/live/test
  1. Open OBS, go to SettingsStream
  2. Select Custom for the service
  3. Fill in:
    • Server: rtmp://your-server-ip:1935/live
    • Stream Key: test (i.e., the stream name)
  4. Click Start Streaming

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
Terminal window
ffplay rtmp://localhost:1935/live/test
  1. Open VLC, select MediaOpen Network Stream
  2. Enter URL: rtmp://localhost:1935/live/test
  3. Click Play
Terminal window
# Subscribe and save as MP4
ffmpeg -i rtmp://localhost:1935/live/test -c copy output.mp4
# Subscribe and re-publish to another server
ffmpeg -i rtmp://localhost:1935/live/test -c copy -f flv rtmp://other-server/live/test

After publishing via RTMP, you can subscribe to the same stream using other protocols:

Terminal window
# RTMP publish
ffmpeg -re -i input.mp4 -c copy -f flv rtmp://localhost:1935/live/test
# HTTP-FLV subscribe
ffplay http://localhost:8080/flv/live/test.flv
# HLS subscribe
ffplay http://localhost:8080/hls/live/test/index.m3u8

If port 1935 is already in use, you can change the listen address:

rtmp:
tcp:
listen_addr: ":1936"

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.