CGJU
CGJU
June 25, 2026 · 7 min read
💡 Quick Guide: Choose RTMP for general-purpose live streaming, SRT for low-latency high-quality delivery, and WebRTC for browser-based real-time interaction.

1. Overview of Three Major Live Streaming Protocols

1.1 RTMP Protocol

RTMP (Real-Time Messaging Protocol) is a real-time messaging protocol developed by Macromedia (later acquired by Adobe), originally designed for audio and video transmission between Flash Player and servers.

  • Initial Release: 2002
  • Developer: Adobe / Macromedia
  • Transport Layer: TCP
  • Default Port: 1935

Although Flash has been retired, RTMP remains the most widely used protocol for live streaming ingestion. Nearly all live streaming platforms (such as Douyin, Bilibili, and Twitch) support RTMP ingestion.

1.2 SRT Protocol

SRT (Secure Reliable Transport) is an open-source video transport protocol developed by Haivision. It operates over UDP while providing TCP-like reliability.

  • Open-Source Release: 2017
  • Developer: Haivision
  • Transport Layer: UDP
  • Default Port: Custom (commonly 9000)

SRT's core advantage is maintaining low latency and high-quality transmission even under unstable network conditions, making it ideal for remote production, outdoor live streaming, and similar scenarios.

1.3 WebRTC Protocol

WebRTC (Web Real-Time Communication) is a web-based real-time communication technology that enables direct audio and video communication between browsers without requiring any plugin installation.

  • Initial Release: 2011
  • Developer: Google, later became a W3C standard
  • Transport Layer: UDP
  • Default Port: Random (commonly 3478/19302)

WebRTC's greatest advantage is its extremely low latency (typically under 500ms) and native browser support, making it perfect for real-time interactive live streaming, video conferencing, and similar use cases.

2. Latency Comparison

Latency is one of the most critical metrics for live streaming protocols, and different use cases have varying latency requirements.

Protocol Typical Latency Latency Category
RTMP 1–3 seconds Low latency
SRT 0.5–2 seconds Very low latency
WebRTC 100–500 ms Ultra-low latency
⚠️ Note: The values above represent latency from the ingestion source to the server. If the stream is distributed to viewers via protocols like HLS or DASH, total end-to-end latency increases to 10–30 seconds. To achieve true end-to-end low latency, low-latency protocols must be used throughout the entire delivery chain.

3. Compatibility Comparison

Ingestion Side Compatibility

  • RTMP: Supported by virtually all streaming software (OBS, FFmpeg, Wirecast, etc.) and live streaming platforms — the best compatibility
  • SRT: Supported by OBS 25.0+, FFmpeg 4.0+, Haivision hardware, and more — support is growing rapidly
  • WebRTC: Natively supported by browsers; limited support in desktop software like OBS, requiring dedicated SDKs

Playback Side Compatibility

  • RTMP: Browsers require Flash (deprecated) or libraries like flv.js for HTTP-FLV playback — poor native support
  • SRT: Not supported by browsers; requires dedicated players or hardware
  • WebRTC: Natively supported by all major browsers (Chrome, Firefox, Safari, Edge)

CDN Support

  • RTMP: Supported by all CDN providers — the standard protocol for live streaming CDNs
  • SRT: Supported by select CDNs (such as Cloudflare Stream, Akamai) — adoption is increasing
  • WebRTC: Fewer CDNs offer WebRTC distribution, and costs tend to be higher

4. Network Resilience Comparison

Live streaming ingestion frequently encounters unstable network conditions, making protocol network resilience critically important.

Feature RTMP SRT WebRTC
Transport Protocol TCP UDP + ARQ UDP
Packet Loss Retransmission ✓ TCP retransmission ✓ Selective retransmission △ Partial support
Impact of Packet Loss High (buffering accumulates) Low Low (video quality degrades)
Bandwidth Fluctuation Poor Good Excellent (adaptive)
Encryption △ RTMPS ✓ AES-128/256 ✓ DTLS-SRTP

5. OBS Setup Tutorial

OBS Studio is the most popular live streaming software. Below is how to configure streaming with different protocols.

5.1 RTMP Streaming Settings

  1. Open OBS, click FileSettingsStream
  2. For Service, select Custom...
  3. Server: Enter rtmp://your-server-address/live
  4. Stream Key: Enter your live stream key
  5. Click OK to save settings
  6. Click Start Streaming to begin broadcasting

5.2 SRT Streaming Settings

  1. Open OBS, click FileSettingsStream
  2. For Service, select Custom...
  3. Server: Enter srt://your-server-address:9000?streamid=your-stream-name
  4. Leave Stream Key empty
  5. Click OK to save settings
  6. Click Start Streaming to begin broadcasting

5.3 Recommended Video Encoding Settings

  • Encoder: x264 (good compatibility) or NVENC (hardware acceleration, low CPU usage)
  • Resolution: 1920×1080 (1080p) or 1280×720 (720p)
  • Framerate: 30fps or 60fps
  • Bitrate: 3000–6000 kbps (adjust based on upload bandwidth)
  • Keyframe Interval: 2 seconds (60 frames @ 30fps)
  • Preset: veryfast or faster (balance between speed and quality)

6. Nginx-RTMP Server Setup

Nginx-RTMP is the most popular solution for self-hosted live streaming servers. Below is a quick setup guide.

6.1 Ubuntu/Debian Installation

# Install dependencies
sudo apt update
sudo apt install -y build-essential libpcre3 libpcre3-dev libssl-dev zlib1g-dev

# Download nginx and nginx-rtmp-module
wget http://nginx.org/download/nginx-1.24.0.tar.gz
wget https://github.com/arut/nginx-rtmp-module/archive/refs/heads/master.zip -O nginx-rtmp-module.zip

# Extract
tar zxf nginx-1.24.0.tar.gz
unzip nginx-rtmp-module.zip

# Compile and install
cd nginx-1.24.0
./configure --add-module=../nginx-rtmp-module-master
make
sudo make install

6.2 Configuring Nginx-RTMP

Edit /usr/local/nginx/conf/nginx.conf and add the RTMP configuration before the http block:

rtmp {
    server {
        listen 1935;
        chunk_size 4096;

        application live {
            live on;
            record off;
            
            # HLS configuration
            hls on;
            hls_path /tmp/hls;
            hls_fragment 3s;
            hls_playlist_length 10s;
        }
    }
}

Then add the HLS access configuration inside the http block:

location /hls {
    types {
        application/vnd.apple.mpegurl m3u8;
        video/mp2t ts;
    }
    root /tmp;
    add_header Cache-Control no-cache;
    add_header Access-Control-Allow-Origin *;
}

6.3 Starting the Service

# Start nginx
sudo /usr/local/nginx/sbin/nginx

# Reload configuration
sudo /usr/local/nginx/sbin/nginx -s reload

# Stop
sudo /usr/local/nginx/sbin/nginx -s stop

6.4 Testing the Stream

Test streaming with FFmpeg:

ffmpeg -re -i input.mp4 -c copy -f flv rtmp://localhost/live/stream1

You can then watch the stream at the following addresses:

  • RTMP URL: rtmp://your-server-ip/live/stream1
  • HLS URL: http://your-server-ip/hls/stream1.m3u8

7. FFmpeg Streaming Commands

7.1 RTMP Streaming

Streaming a local file (at real-time speed):

ffmpeg -re -i input.mp4 -c:v libx264 -b:v 2500k -g 60 \
  -c:a aac -b:a 128k -f flv rtmp://server/live/stream

The -re parameter reads input at native frame rate, simulating a real-time live stream.

7.2 Camera/Microphone Real-Time Streaming

# Linux
ffmpeg -f v4l2 -i /dev/video0 -f alsa -i default \
  -c:v libx264 -b:v 2000k -g 60 \
  -c:a aac -b:a 128k \
  -f flv rtmp://server/live/stream

# Windows
ffmpeg -f dshow -i video="CameraName":audio="MicrophoneName" \
  -c:v libx264 -b:v 2000k -g 60 \
  -c:a aac -b:a 128k \
  -f flv rtmp://server/live/stream

7.3 SRT Streaming

# Sender
ffmpeg -re -i input.mp4 -c:v libx264 -b:v 2500k -g 30 \
  -c:a aac -b:a 128k -f mpegts srt://0.0.0.0:9000?mode=listener

# Receiver (or relay)
ffplay srt://sender-ip:9000?mode=caller

7.4 Screen Capture Streaming

# X11 (Linux)
ffmpeg -f x11grab -s 1920x1080 -r 30 -i :0.0 \
  -c:v libx264 -b:v 3000k -g 60 \
  -c:a aac -b:a 128k \
  -f flv rtmp://server/live/stream

# gdigrab (Windows)
ffmpeg -f gdigrab -s 1920x1080 -r 30 -i desktop \
  -c:v libx264 -b:v 3000k -g 60 \
  -c:a aac -b:a 128k \
  -f flv rtmp://server/live/stream

8. Live Streaming Best Practices

8.1 Recommended Streaming Parameters

Quality Level Resolution Framerate Video Bitrate Audio Bitrate
SD 854×480 30 800–1500k 96–128k
HD 1280×720 30 1500–3000k 128k
Full HD 1920×1080 30 3000–6000k 128–192k
Full HD High Frame Rate 1920×1080 60 4500–8000k 128–192k

8.2 Network Reliability Recommendations

  • Use a wired connection: WiFi is unreliable; use a direct Ethernet cable for important live streams
  • Reserve bandwidth: Your upload speed should be at least 1.5–2 times the streaming bitrate
  • Test your network: Use speedtest.net to check upload speed before going live
  • Have a backup: Prepare a 4G/5G backup network in case the primary connection fails

8.3 Streaming Security

  • Use stream keys: Never share your streaming URL or stream key
  • Enable authentication: Configure stream authentication on the server to prevent unauthorized streaming
  • Use RTMPS: On platforms that support it, use RTMPS (RTMP over TLS) for encrypted streaming

Summary

Choosing the right live streaming protocol depends on your specific use case:

  • RTMP: The most mature ecosystem and best compatibility — suitable for most live streaming scenarios
  • SRT: Excellent resistance to network jitter — ideal for outdoor live streaming and remote production
  • WebRTC: The lowest latency with native browser support — perfect for real-time interactive live streaming

For most users, RTMP ingestion + HLS/HTTP-FLV distribution is the most reliable approach. If you need low-latency interaction, consider WebRTC.

Want to test whether your live stream is working properly? Use our FLV/RTMP Online Player to quickly verify stream availability.

Related Recommendations

More great articles and useful tools

Need to Test Your Live Stream?

Use our FLV/RTMP Online Player to quickly verify whether your live stream is working properly

Try It Now ➡