H.264 vs H.265 vs AV1: Video Codec Deep Comparison
Comprehensive comparison of three mainstream video codecs — compression efficiency, encoding speed, browser support, and patent licensing — to help you choose the best encoding solution.
Read More →In-depth comparison of three major live streaming protocols — build your live streaming system from scratch
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.
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.
SRT (Secure Reliable Transport) is an open-source video transport protocol developed by Haivision. It operates over UDP while providing TCP-like reliability.
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.
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.
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.
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 |
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 |
OBS Studio is the most popular live streaming software. Below is how to configure streaming with different protocols.
rtmp://your-server-address/livesrt://your-server-address:9000?streamid=your-stream-nameNginx-RTMP is the most popular solution for self-hosted live streaming servers. Below is a quick setup guide.
# 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
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 *;
}
# 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
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://your-server-ip/live/stream1http://your-server-ip/hls/stream1.m3u8Streaming 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.
# 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
# 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
# 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
| 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 |
Choosing the right live streaming protocol depends on your specific use case:
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.
More great articles and useful tools
Comprehensive comparison of three mainstream video codecs — compression efficiency, encoding speed, browser support, and patent licensing — to help you choose the best encoding solution.
Read More →Deep dive into video compression principles, I/P/B frames in H.264/H.265, CRF, bitrate, GOP structure, and practical FFmpeg compression commands.
Read More →Detailed explanation of mainstream audio format features, bitrate selection, use cases, and practical FFmpeg commands for audio conversion.
Read More →Use our FLV/RTMP Online Player to quickly verify whether your live stream is working properly
Try It Now ➡