Skip to main content
← Back to Protocols

RTMP Protocol Deep Dive

Real-Time Messaging Protocol for legacy and platform streaming

Legacy Standard
Universal Support
TCP-Based

Protocol Specifications & History

Technical details and evolution of RTMP

Protocol Evolution

2002
RTMP Launch - Macromedia introduces RTMP for Flash Media Server
2005
Adobe Acquisition - Adobe acquires Macromedia, continues RTMP development
2012
RTMP Specification Published - Adobe releases partial specification publicly
2017
Flash Deprecation - Adobe announces Flash end-of-life, but RTMP persists for ingest
2025
Modern Usage - RTMP remains standard for streaming ingest despite newer protocols

Transport Layer

  • Protocol: TCP-based (Port 1935 by default)
  • Variants: RTMP, RTMPS (SSL/TLS), RTMPT (HTTP tunneling)
  • Handshake: Three-way C0/C1/C2 handshake protocol
  • Chunk Size: Configurable (default 128 bytes, typically 4096)

Message Structure

  • Message Types: Control, Data, Audio, Video, Metadata
  • Timestamps: 32-bit millisecond resolution (extended 32-bit available)
  • Stream ID: Multiple logical streams per connection
  • AMF Encoding: Action Message Format for metadata

Codec Support

  • Video: H.264/AVC, H.265/HEVC (limited), VP6, Sorenson Spark
  • Audio: AAC, MP3, Speex, Nellymoser
  • Preferred: H.264 video + AAC audio (universal compatibility)

Performance Characteristics

  • Latency: 5-15 seconds typical (platform-dependent)
  • Overhead: ~5-8% for protocol headers and metadata
  • TCP Overhead: Additional ~3-5% for retransmissions

Use Cases & Platform Requirements

When to use RTMP and platform-specific considerations

Ideal Use Cases

Social Platform Streaming
YouTube, Facebook, Twitch, LinkedIn all require RTMP ingest
Legacy System Integration
Existing infrastructure built around RTMP servers
Maximum Encoder Compatibility
Every streaming encoder supports RTMP natively
Reliable Network Conditions
TCP ensures delivery on stable connections

When NOT to Use RTMP

Ultra-Low Latency Required
Use WebRTC or OMT for <2 second latency
Unreliable Networks
Use SRT for packet loss recovery on unstable connections

Platform-Specific Settings

PlatformServer URLKeyframeMax BitrateRecommended
YouTube Livertmp://a.rtmp.youtube.com/live22s9,000 Kbps1080p60
Facebook Livertmps://live-api-s.facebook.com:443/rtmp/2s8,000 Kbps1080p30
Twitchrtmp://live.twitch.tv/app/2s6,000 Kbps1080p60
LinkedIn Livertmps://fa.linkedin.com:443/rtmp/2s5,000 Kbps720p30
WAVE Platformrtmp://ingest.wave.inc/live/2sUnlimited1080p60

Bandwidth Requirements & Network Analysis

Bitrate Configuration Table

ResolutionVideo BitrateAudio BitrateTotal BandwidthKeyframe
480p30500 - 1,000 Kbps64 Kbps600 - 1,100 Kbps2s
720p301,500 - 3,000 Kbps128 Kbps1,700 - 3,200 Kbps2s
720p602,500 - 5,000 Kbps128 Kbps2,700 - 5,200 Kbps2s
1080p303,000 - 6,000 Kbps160 Kbps3,200 - 6,200 Kbps2s
1080p604,500 - 9,000 Kbps160 Kbps4,700 - 9,200 Kbps2s

Complete OBS Studio Setup (8 Steps)

Detailed configuration guide for professional RTMP streaming

1

Stream Settings Configuration

Navigate to Settings → Stream and configure your RTMP endpoint:

  1. Open OBS Studio → Click "Settings" button (bottom right)
  2. Select "Stream" from left sidebar
  3. Service: Select "Custom"
  4. Server: Enter your RTMP server URL (e.g., rtmp://ingest.wave.inc/live/)
  5. Stream Key: Enter your unique stream key from WAVE dashboard
  6. Click "Apply" to save settings
2

Output Mode Selection

Configure advanced output settings for professional quality:

Settings → Output → Output Mode: "Advanced"

Streaming Tab:
  - Audio Track: 1
  - Encoder: Select based on your hardware (see Step 3)
  - Rescale Output: Unchecked (unless downscaling needed)
  - Rate Control: CBR (Constant Bitrate)
  - Bitrate: 6000 Kbps (adjust based on resolution)
  - Keyframe Interval: 2 (2 seconds, required by most platforms)
  - CPU Usage Preset: veryfast (CPU) or Quality (GPU)
  - Profile: high
  - Tune: none
  - x264 Options: (leave blank unless advanced user)
3

Encoder Selection (Hardware vs Software)

Choose the best encoder for your system:

Hardware Encoders (Recommended)
  • NVIDIA NVENC: GPU encoding (RTX/GTX series) - excellent quality, low CPU usage
  • AMD VCE/VCN: AMD GPU encoding - good quality, low CPU usage
  • Intel Quick Sync: Intel integrated GPU - good for streaming + gaming
  • Apple VT H264: Mac hardware encoding - excellent efficiency
Software Encoder (x264)
  • Best Quality: Superior image quality at same bitrate
  • CPU Intensive: Requires powerful CPU (6+ cores recommended)
  • Presets: ultrafast, superfast, veryfast, faster, fast, medium (slower = better quality)
  • Use When: Dedicated streaming PC or very powerful CPU
4

Video Settings Configuration

Configure resolution and frame rate settings:

Settings → Video

Base (Canvas) Resolution: 1920x1080
  - This is your source resolution (match your display or capture)

Output (Scaled) Resolution: 1920x1080
  - This is the resolution sent to the stream
  - Can downscale if needed (e.g., 1280x720 for lower bitrate)

Downscale Filter: Lanczos (Sharpened scaling, 36 samples)
  - Best quality for downscaling
  - Use Bilinear if CPU constrained

Common FPS Values: 60 or 30
  - 60 FPS: Gaming, fast motion (requires higher bitrate)
  - 30 FPS: Presentations, interviews (lower bitrate)
5

Audio Configuration

Optimize audio settings for professional quality:

Settings → Audio

Sample Rate: 48 kHz (professional standard)
  - Do NOT use 44.1 kHz (may cause sync issues)

Channels: Stereo

Global Audio Devices:
  - Desktop Audio: Select your system audio output
  - Mic/Auxiliary Audio: Select your microphone

Advanced Settings (Settings → Output → Audio Tab):
  - Audio Bitrate: 160 Kbps (Track 1)
  - Encoder: AAC

Audio Mixer (Main OBS Window):
  - Set levels to peak around -6dB to -12dB
  - Avoid red (clipping)
  - Use filters for noise suppression, gain, compression
6

Advanced Settings & Network Tuning

Fine-tune advanced settings for optimal performance:

Settings → Advanced

Process Priority: High (if dedicated streaming PC) or Above Normal
  - Gives OBS higher priority for CPU resources

Renderer: Direct3D 11 (Windows) / Metal (Mac) / OpenGL (Linux)

Color Format: NV12 (best for H.264 encoding)
Color Space: 709 (HD standard)
Color Range: Limited (required for proper color on most platforms)

Network Settings:
  - Bind to IP: (leave as Default unless multiple network adapters)
  - Enable Dynamic Bitrate: Unchecked (for RTMP)
  - Network Buffering: Unchecked

Recording Settings:
  - Filename Formatting: Keep default or customize
  - Automatic File Splitting: Can enable if recording long streams
7

Scene and Source Setup

Create scenes and add sources for your stream:

  1. Create Scene: Click "+" under Scenes panel, name it (e.g., "Main Camera")
  2. Add Video Source: Click "+" under Sources, select source type:
    • Video Capture Device: Webcam or capture card
    • Display Capture: Capture entire screen
    • Window Capture: Capture specific application
    • Game Capture: Capture games with best performance
  3. Add Audio Sources: Sources with audio automatically appear in audio mixer
  4. Add Overlays: Image, text, browser sources for branding
  5. Arrange Layers: Drag sources to reorder (top = front layer)
  6. Transform Sources: Right-click source → Transform for positioning
8

Test Stream and Monitor Performance

Start streaming and monitor performance metrics:

  1. Click "Start Streaming" button (bottom right)
  2. Monitor status bar (bottom of OBS window):
    • CPU Usage: Should stay below 80% (if using x264)
    • FPS: Should match your configured FPS (no dropped frames)
    • Dropped Frames: Should be 0.0% (network stable)
    • Bitrate: Should match configured bitrate (Kbps)
  3. View → Stats: Opens detailed statistics window
  4. Check your stream on WAVE dashboard to verify it's live
  5. Use View → Multiview for monitoring multiple scenes simultaneously

Advanced OBS Configuration

Bitrate ladders, GOP settings, and professional optimizations

Custom Bitrate Ladder for ABR

While RTMP itself doesn't support adaptive bitrate (ABR), you can configure OBS to output multiple streams at different bitrates for server-side transcoding:

# Bitrate Ladder Configuration (for multi-stream setups)

Source Stream (1080p60):
  - Resolution: 1920x1080
  - Bitrate: 6,000 Kbps
  - Keyframe: 2s

High Quality (720p60):
  - Resolution: 1280x720
  - Bitrate: 4,500 Kbps
  - Keyframe: 2s (must match source)

Medium Quality (720p30):
  - Resolution: 1280x720
  - Bitrate: 2,500 Kbps
  - Keyframe: 2s (must match source)

Low Quality (480p30):
  - Resolution: 854x480
  - Bitrate: 1,000 Kbps
  - Keyframe: 2s (must match source)

# All streams MUST have identical keyframe intervals for seamless ABR switching

GOP (Group of Pictures) Settings

Keyframe Interval (GOP Size)
  • 2 seconds: Required by YouTube, Facebook, Twitch (most compatible)
  • 1 second: Better seek accuracy, larger file size
  • 4 seconds: More efficient encoding, but may violate platform requirements
  • Never auto: Platforms require fixed GOP
B-frames Configuration
  • 0 B-frames: Lowest latency, required for low-latency streaming
  • 2 B-frames: Good balance (default for x264)
  • 3-4 B-frames: Better compression, higher latency
  • Recommended: 2 B-frames for most use cases

x264 Advanced Options

# OBS Settings → Output → Streaming → x264 Options field

# Low latency streaming (sacrifice some quality for speed):
tune=zerolatency bframes=0

# High quality streaming (dedicated streaming PC):
tune=film crf=18 preset=slow

# Gaming with good motion (fast movement games):
tune=film ref=3 bframes=2

# Screen sharing / presentation (static content):
tune=stillimage crf=20

# Disable x264 CPU optimizations (troubleshooting):
threads=4 no-mbtree=1

# Note: Only add these if you understand the impact on encoding

Encoder Compatibility Matrix

RTMP support across professional encoding software

EncoderRTMP SupportLatencyQualityCPU UsageDifficulty
OBS Studio
Native
5-10sExcellentMedium
Easy
Streamlabs Desktop
Native
6-12sGoodMedium
Easy
vMix
Native
5-8sExcellentLow
Medium
Wirecast
Native
5-9sExcellentLow
Medium
XSplit
Native
6-10sGoodMedium
Easy
FFmpeg
Native
4-8sExcellentVariable
Advanced

Performance Benchmarks

Real-world RTMP streaming performance metrics

5-15s
Glass-to-Glass Latency
Platform-dependent (typical range)
92%+
Bandwidth Efficiency
After TCP/RTMP overhead
20-50%
CPU Usage (x264)
Veryfast preset, 1080p60

CPU Usage by Encoder

x264 Software Encoding (1080p60)
  • ultrafast: 15-25% CPU (lower quality)
  • veryfast: 25-40% CPU (good quality)
  • medium: 50-70% CPU (excellent quality)
  • slow: 80-95% CPU (best quality)
Hardware Encoding (1080p60)
  • NVENC (NVIDIA): 3-8% CPU, ~10% GPU
  • AMD VCE: 5-10% CPU, ~12% GPU
  • Quick Sync: 5-12% CPU, iGPU encoder
  • Apple VT: 3-7% CPU, hardware encoder

Network Utilization Benchmarks

ScenarioVideo BitrateActual Network UsageOverhead
720p30 Stream2,500 Kbps2,820 Kbps12.8%
1080p60 Stream6,000 Kbps6,720 Kbps12.0%
4K30 Stream13,000 Kbps14,560 Kbps12.0%

Troubleshooting Common Issues

Connection Failed / Cannot Connect to Server

Cause: Firewall blocking TCP port 1935, incorrect server URL, or invalid stream key

Solution: Verify server URL format (rtmp://domain/app/), check stream key, open TCP port 1935 in firewall, try RTMPS (port 443) if standard RTMP is blocked.

High Latency (15+ seconds)

Cause: Platform buffer settings, network congestion, or encoder buffering

Solution: RTMP latency is platform-controlled. Use lower-latency protocols (SRT, WebRTC, OMT) if <5s latency required. Reduce encoder buffer size. Enable low-latency mode on platform if available.

Dropped Frames / Skipped Frames

Cause: Insufficient CPU (encoding dropped frames) or network bandwidth (network dropped frames)

Solution: Encoding dropped: Switch to hardware encoder (NVENC/QuickSync), lower output resolution, or use faster x264 preset. Network dropped: Reduce video bitrate, check for bandwidth congestion, use wired connection instead of WiFi.

Stream Stuttering / Buffering for Viewers

Cause: Variable bitrate (VBR), keyframe interval issues, or network instability

Solution: Use CBR (Constant Bitrate) rate control. Set keyframe interval to exactly 2 seconds. Increase bitrate slightly for headroom. Check for ISP throttling or upload speed limitations.

Keyframe Interval Rejection

Cause: Platform requires 2-second keyframe interval, but OBS is configured differently

Solution: Set keyframe interval to exactly 2 in OBS Settings → Output → Streaming. This is required by YouTube, Facebook, Twitch. Never use "auto" or 0.

Audio Desync / Audio Drift

Cause: Incorrect sample rate (44.1 kHz instead of 48 kHz), audio buffer issues

Solution: Set audio sample rate to 48 kHz in Settings → Audio. Restart OBS after changing. Add audio delay offset if needed (Settings → Advanced → Audio → Sync Offset). Check for variable framerate sources (use CBR video sources).

RTMP vs Modern Protocols

Comparison with SRT, WebRTC, and OMT

FeatureRTMPSRTWebRTCOMT
Latency5-15s2-4s<500ms<16ms
TransportTCPUDPUDPUDP
Packet Loss Recovery
Automatic (TCP)
Up to 15%
Limited
Minimal
EncryptionRTMPS (optional)
AES-128/256
DTLS/SRTP
TLS 1.3
Encoder Support
Universal
Excellent
Growing
Limited
Best Use CasePlatform streamingUnreliable networksInteractive streamingUltra-low latency
Firewall Friendliness
Excellent
Good
Excellent
Good

API Integration Examples

Production-ready code for RTMP streaming

import { WaveClient } from '@wave/api-client';

import { DesignTokens, getContainer, getSection } from '@/lib/design-tokens';
const wave = new WaveClient({ apiKey: 'wave_live_xxxxx' });

// Create RTMP stream with custom configuration
const stream = await wave.streams.create({
  title: 'Professional RTMP Broadcast',
  protocol: 'rtmp',
  rtmp: {
    // Encoder will connect to this URL
    chunkSize: 4096,           // Larger chunks for better performance

    // Platform-specific settings
    platform: 'custom',        // 'youtube' | 'facebook' | 'twitch' | 'custom'

    // Recording options
    recording: {
      enabled: true,
      format: 'mp4',
      quality: 'source'        // Record at source quality
    },

    // Transcoding options (server-side ABR)
    transcoding: {
      enabled: true,
      profiles: [
        { resolution: '1080p', bitrate: 6000, fps: 60 },
        { resolution: '720p', bitrate: 4500, fps: 60 },
        { resolution: '720p', bitrate: 2500, fps: 30 },
        { resolution: '480p', bitrate: 1000, fps: 30 }
      ]
    }
  }
});

console.log('RTMP URL:', stream.ingest.rtmp.url);
console.log('Stream Key:', stream.ingest.rtmp.streamKey);
console.log('Full URL for OBS:', `${stream.ingest.rtmp.url}${stream.ingest.rtmp.streamKey}`);

// Monitor stream health
const health = await wave.streams.getHealth(stream.id);
console.log('Stream Status:', health.status);           // 'live' | 'idle' | 'error'
console.log('Current Bitrate:', health.rtmp.bitrate);   // Kbps
console.log('Dropped Frames:', health.rtmp.droppedFrames);
console.log('FPS:', health.rtmp.fps);
console.log('Resolution:', health.rtmp.resolution);
console.log('Codec:', health.rtmp.codec);               // 'h264' | 'hevc'

// Get stream analytics
const analytics = await wave.streams.getAnalytics(stream.id, {
  period: '1h',
  metrics: ['bitrate', 'fps', 'viewers', 'dropped_frames']
});

console.log('Average Bitrate:', analytics.bitrate.avg);
console.log('Peak Viewers:', analytics.viewers.max);
console.log('Total Dropped Frames:', analytics.dropped_frames.total);

// Multi-platform simulcast
const simulcast = await wave.streams.createSimulcast({
  sourceStream: stream.id,
  destinations: [
    {
      platform: 'youtube',
      rtmpUrl: 'rtmp://a.rtmp.youtube.com/live2',
      streamKey: 'your-youtube-key'
    },
    {
      platform: 'facebook',
      rtmpUrl: 'rtmps://live-api-s.facebook.com:443/rtmp/',
      streamKey: 'your-facebook-key'
    },
    {
      platform: 'twitch',
      rtmpUrl: 'rtmp://live.twitch.tv/app/',
      streamKey: 'your-twitch-key'
    }
  ]
});

console.log('Simulcast Active:', simulcast.destinations.map(d => d.platform));

// Handle stream events via webhook
wave.webhooks.on('stream.started', (event) => {
  console.log('Stream started:', event.stream.id);
  console.log('Encoder:', event.stream.rtmp.encoder);
  console.log('Resolution:', event.stream.rtmp.resolution);
});

wave.webhooks.on('stream.health.warning', (event) => {
  console.warn('Stream health warning:', event.message);
  console.warn('Dropped frames:', event.rtmp.droppedFrames);
  // Send alert to streamer
});

wave.webhooks.on('stream.ended', (event) => {
  console.log('Stream ended:', event.stream.id);
  console.log('Duration:', event.duration);
  console.log('Recording URL:', event.recording.url);
});

Production Best Practices

Backup streams, failover, and professional workflows

Redundant Streaming Setup

  • Primary + Backup Encoder: Run two encoders (e.g., OBS on PC + hardware encoder) streaming to WAVE with automatic failover if primary fails
  • Dual Network Paths: Use wired + cellular backup connection for critical events
  • Redundant RTMP Ingest: WAVE automatically routes backup stream if primary encoder disconnects

Pre-Event Checklist

  • Test RTMP connection 24 hours before event
  • Verify stream key and server URL are correct
  • Run bandwidth test (minimum 1.5x your target bitrate)
  • Configure backup encoder with same settings
  • Test audio levels (peak at -6dB to -12dB)
  • Verify recording is enabled and working
  • Confirm keyframe interval is set to 2 seconds
  • Check firewall allows TCP port 1935 outbound
  • Monitor CPU usage during test stream (<80%)
  • Verify viewer playback on multiple devices

Live Event Monitoring

✅ Healthy Stream Indicators
  • • Dropped frames: 0.0%
  • • CPU usage: <80%
  • • FPS: Matches configured FPS (no variance)
  • • Bitrate: Stable at configured rate
  • • Network indicator: Green
⚠️ Warning Signs
  • • Dropped frames: >0.5%
  • • CPU usage: >90%
  • • FPS: Fluctuating or <configured FPS
  • • Bitrate: Varying ±20%
  • • Network indicator: Yellow or red

Emergency Procedures

  • Stream Disconnection: Automatic reconnection in OBS (Settings → Advanced → Automatic Reconnect). Backup encoder should activate automatically.
  • High Dropped Frames: Immediately reduce bitrate by 20-30% in OBS. Apply changes live (no need to restart stream).
  • Encoder Crash: Have backup encoder ready with same settings. Switch stream key to backup encoder immediately.
  • Network Failure: Failover to cellular backup connection. Have mobile hotspot configured and tested beforehand.
RTMP Protocol Deep Dive | WAVE Documentation | WAVE