ffmpeg-streaming

v2026.09.24

Complete live streaming and protocol system for FFmpeg 7.1 LTS and 8.0.1 (latest stable, released 2025-11-20). PROACTIVELY activate for: (1) RTMP streaming to Twitch/YouTube/Facebook, (2) HLS output and adaptive bitrate (ABR), (3) DASH streaming setup, (4) Low-latency streaming (LL-HLS, LL-DASH), (5) SRT protocol configuration, (6) WebRTC/WHIP sub-second latency (FFmpeg 8.0+), (7) Protocol conversion (RTMP to HLS), (8) Multi-destination streaming, (9) nginx-rtmp integration, (10) Docker streaming services. Provides: Platform-specific stream commands, ABR ladder examples, encryption setup, latency optimization, WHIP authentication, production patterns. Ensures: Reliable live streaming with optimal quality and latency.

GitHub
Install command
npx skhub add josiahsiegel/ffmpeg-streaming
Markdown
SKILL.md

CRITICAL GUIDELINES

Windows File Path Requirements

MANDATORY: Always Use Backslashes on Windows for File Paths

When using Edit or Write tools on Windows, you MUST use backslashes (\) in file paths, NOT forward slashes (/).


Quick Reference

ProtocolLatencyOutput FormatBest For
RTMP2-5s-f flv rtmp://...Twitch, YouTube ingest
HLS10-30s-f hls output.m3u8Web playback, CDN
LL-HLS2-5s-hls_flags low_latencyLow-latency web
SRT<1s-f mpegts srt://...Reliable contribution
DASH10-30s-f dash output.mpdABR streaming
PlatformIngest URL
Twitchrtmp://live.twitch.tv/app/{key}
YouTubertmp://a.rtmp.youtube.com/live2/{key}
Facebookrtmps://live-api-s.facebook.com:443/rtmp/{key}

When to Use This Skill

Use for live streaming workflows:

  • Broadcasting to Twitch, YouTube, Facebook
  • Setting up HLS/DASH servers for VOD
  • Building ABR encoding ladders
  • Low-latency streaming requirements
  • Multi-destination restreaming

FFmpeg Streaming Guide (2025)

Complete guide to live streaming with FFmpeg covering RTMP, HLS, DASH, SRT, and WebRTC protocols.

Current Latest: FFmpeg 8.0.1 (released 2025-11-20) - Check with ffmpeg -version

Streaming Protocols Overview

Protocol Comparison (2025)

ProtocolLatencyCompatibilitySecurityUse Case
RTMP1-5sLegacy, ingestionTLS (RTMPS)Stream ingestion
HLS6-30sUniversalAES-128CDN delivery
DASH6-30sWideDRM-readyABR streaming
LL-HLS2-4sApple/modernAES-128Low-latency
LL-DASH2-4sModern browsersDRM-readyLow-latency
SRT<1sGrowingAES-128/256Contribution
WebRTC<0.5sBrowsersDTLS/SRTPReal-time
WHIP<1sEmergingTLSWebRTC ingestion

2025 Trends

  • SRT replacing RTMP for contribution/ingest
  • LL-HLS becoming default for Apple ecosystem
  • WHIP standardizing WebRTC ingestion (FFmpeg 8.0+)
  • QUIC/HTTP3 emerging for lower latency delivery

RTMP Streaming

Basic RTMP Stream

# Stream to RTMP server
ffmpeg -re -i input.mp4 \
  -c:v libx264 -preset veryfast -b:v 3000k -maxrate 3000k -bufsize 6000k \
  -c:a aac -b:a 128k \
  -f flv rtmp://server/live/stream_key

Webcam/Screen to RTMP

# Linux webcam
ffmpeg -f v4l2 -i /dev/video0 \
  -f alsa -i default \
  -c:v libx264 -preset ultrafast -tune zerolatency -b:v 2500k \
  -c:a aac -b:a 128k \
  -f flv rtmp://server/live/stream_key

# macOS webcam
ffmpeg -f avfoundation -framerate 30 -i "0:0" \
  -c:v libx264 -preset ultrafast -tune zerolatency -b:v 2500k \
  -c:a aac -b:a 128k \
  -f flv rtmp://server/live/stream_key

# Windows screen capture
ffmpeg -f gdigrab -framerate 30 -i desktop \
  -c:v libx264 -preset ultrafast -tune zerolatency -b:v 3000k \
  -c:a aac -b:a 128k \
  -f flv rtmp://server/live/stream_key

RTMP with GPU Encoding

# NVIDIA NVENC
ffmpeg -re -i input.mp4 \
  -c:v h264_nvenc -preset p3 -tune ll -zerolatency 1 -b:v 6000k \
  -c:a aac -b:a 128k \
  -f flv rtmp://server/live/stream_key

# Intel QSV
ffmpeg -re -init_hw_device qsv=hw -filter_hw_device hw \
  -i input.mp4 \
  -c:v h264_qsv -preset fast -b:v 6000k \
  -c:a aac -b:a 128k \
  -f flv rtmp://server/live/stream_key

RTMPS (Encrypted)

ffmpeg -re -i input.mp4 \
  -c:v libx264 -preset veryfast -b:v 3000k \
  -c:a aac -b:a 128k \
  -f flv rtmps://secure-server/live/stream_key

Twitch/YouTube/Facebook

# Twitch
ffmpeg -re -i input.mp4 \
  -c:v libx264 -preset veryfast -b:v 6000k -maxrate 6000k -bufsize 12000k \
  -g 60 -keyint_min 60 \
  -c:a aac -b:a 160k -ar 44100 \
  -f flv rtmp://live.twitch.tv/app/YOUR_STREAM_KEY

# YouTube
ffmpeg -re -i input.mp4 \
  -c:v libx264 -preset veryfast -b:v 4500k -maxrate 4500k -bufsize 9000k \
  -g 60 -keyint_min 60 \
  -c:a aac -b:a 128k -ar 44100 \
  -f flv rtmp://a.rtmp.youtube.com/live2/YOUR_STREAM_KEY

# Facebook
ffmpeg -re -i input.mp4 \
  -c:v libx264 -preset veryfast -b:v 4000k -maxrate 4000k -bufsize 8000k \
  -g 60 \
  -c:a aac -b:a 128k -ar 44100 \
  -f flv rtmps://live-api-s.facebook.com:443/rtmp/YOUR_STREAM_KEY

HLS Streaming

Basic HLS Output

# Create HLS stream
ffmpeg -i input.mp4 \
  -c:v libx264 -c:a aac \
  -hls_time 6 \
  -hls_list_size 0 \
  -hls_segment_filename "segment_%03d.ts" \
  playlist.m3u8

Live HLS Streaming

# Live HLS with rolling window
ffmpeg -re -i input.mp4 \
  -c:v libx264 -preset veryfast -b:v 3000k \
  -c:a aac -b:a 128k \
  -hls_time 4 \
  -hls_list_size 10 \
  -hls_flags delete_segments \
  -hls_segment_filename "live_%03d.ts" \
  live.m3u8

Adaptive Bitrate HLS (ABR)

# Multi-bitrate HLS
ffmpeg -i input.mp4 \
  -filter_complex "[0:v]split=3[v1][v2][v3]; \
    [v1]scale=1920:1080[v1out]; \
    [v2]scale=1280:720[v2out]; \
    [v3]scale=854:480[v3out]" \
  -map "[v1out]" -c:v:0 libx264 -b:v:0 5000k -maxrate:v:0 5350k -bufsize:v:0 7500k \
  -map "[v2out]" -c:v:1 libx264 -b:v:1 2800k -maxrate:v:1 2996k -bufsize:v:1 4200k \
  -map "[v3out]" -c:v:2 libx264 -b:v:2 1400k -maxrate:v:2 1498k -bufsize:v:2 2100k \
  -map a:0 -c:a:0 aac -b:a:0 192k \
  -map a:0 -c:a:1 aac -b:a:1 128k \
  -map a:0 -c:a:2 aac -b:a:2 96k \
  -f hls \
  -hls_time 6 \
  -hls_list_size 0 \
  -var_stream_map "v:0,a:0 v:1,a:1 v:2,a:2" \
  -master_pl_name master.m3u8 \
  -hls_segment_filename "stream_%v/segment_%03d.ts" \
  stream_%v/playlist.m3u8

HLS with AES Encryption

# Generate encryption key
openssl rand 16 > enc.key
echo "http://example.com/enc.key" > enc.keyinfo
echo "enc.key" >> enc.keyinfo
openssl rand -hex 16 >> enc.keyinfo

# Encrypted HLS
ffmpeg -i input.mp4 \
  -c:v libx264 -c:a aac \
  -hls_time 6 \
  -hls_key_info_file enc.keyinfo \
  -hls_segment_filename "encrypted_%03d.ts" \
  encrypted.m3u8

Low-Latency HLS (LL-HLS)

# LL-HLS with partial segments
ffmpeg -re -i input.mp4 \
  -c:v libx264 -preset veryfast -tune zerolatency \
  -c:a aac \
  -hls_time 4 \
  -hls_list_size 6 \
  -hls_flags independent_segments+delete_segments \
  -hls_segment_type fmp4 \
  -hls_fmp4_init_filename init.mp4 \
  -hls_segment_filename "ll_%03d.m4s" \
  ll_playlist.m3u8

DASH Streaming

Basic DASH Output

ffmpeg -i input.mp4 \
  -c:v libx264 -c:a aac \
  -f dash \
  -seg_duration 4 \
  -use_timeline 1 \
  -use_template 1 \
  output.mpd

Adaptive DASH

ffmpeg -i input.mp4 \
  -map 0:v -map 0:v -map 0:v -map 0:a \
  -c:v libx264 -c:a aac \
  -b:v:0 5M -s:v:0 1920x1080 \
  -b:v:1 3M -s:v:1 1280x720 \
  -b:v:2 1M -s:v:2 640x360 \
  -b:a 128k \
  -f dash \
  -seg_duration 4 \
  -adaptation_sets "id=0,streams=v id=1,streams=a" \
  manifest.mpd

Low-Latency DASH (LL-DASH)

ffmpeg -re -i input.mp4 \
  -c:v libx264 -preset ultrafast -tune zerolatency \
  -c:a aac \
  -f dash \
  -seg_duration 1 \
  -frag_duration 0.1 \
  -streaming 1 \
  -ldash 1 \
  -use_timeline 0 \
  -use_template 1 \
  -remove_at_exit 1 \
  -window_size 5 \
  ll_manifest.mpd

SRT Streaming (FFmpeg 4.0+)

SRT Listener (Server Mode)

# FFmpeg as SRT server
ffmpeg -re -i input.mp4 \
  -c:v libx264 -preset veryfast -b:v 3000k \
  -c:a aac -b:a 128k \
  -f mpegts "srt://0.0.0.0:9000?mode=listener"

SRT Caller (Client Mode)

# Send to SRT server
ffmpeg -re -i input.mp4 \
  -c:v libx264 -preset veryfast -b:v 3000k \
  -c:a aac -b:a 128k \
  -f mpegts "srt://server:9000?mode=caller"

SRT with Encryption

# AES-128 encrypted SRT
ffmpeg -re -i input.mp4 \
  -c:v libx264 -c:a aac \
  -f mpegts "srt://server:9000?passphrase=mySecretKey123&pbkeylen=16"

Receive SRT Stream

# Receive and save
ffmpeg -i "srt://0.0.0.0:9000?mode=listener" \
  -c copy output.mp4

# Receive and transcode
ffmpeg -i "srt://server:9000?mode=caller" \
  -c:v libx264 -c:a aac \
  output.mp4

WebRTC/WHIP (FFmpeg 8.0+)

Overview

FFmpeg 8.0 introduces the WHIP (WebRTC-HTTP Ingestion Protocol) muxer, enabling sub-second latency streaming to WebRTC endpoints. WHIP is becoming the standard for WebRTC ingestion, replacing proprietary solutions.

WHIP Output

# Stream to WHIP endpoint
ffmpeg -re -i input.mp4 \
  -c:v libx264 -preset ultrafast -tune zerolatency \
  -c:a libopus \
  -f whip \
  "https://whip-server.example.com/publish/stream_id"

# Low-latency webcam to WHIP (Linux)
ffmpeg -f v4l2 -i /dev/video0 \
  -f pulse -i default \
  -c:v libx264 -preset ultrafast -tune zerolatency -b:v 2500k \
  -c:a libopus -b:a 64k \
  -f whip \
  "https://whip-server.example.com/publish/stream_id"

# Low-latency webcam to WHIP (macOS)
ffmpeg -f avfoundation -framerate 30 -i "0:0" \
  -c:v libx264 -preset ultrafast -tune zerolatency -b:v 2500k \
  -c:a libopus -b:a 64k \
  -f whip \
  "https://whip-server.example.com/publish/stream_id"

# Low-latency screen capture to WHIP (Windows)
ffmpeg -f gdigrab -framerate 30 -i desktop \
  -c:v libx264 -preset ultrafast -tune zerolatency -b:v 3000k \
  -c:a libopus -b:a 64k \
  -f whip \
  "https://whip-server.example.com/publish/stream_id"

WHIP with Hardware Encoding

# NVIDIA NVENC WHIP streaming
ffmpeg -hwaccel cuda -hwaccel_output_format cuda \
  -i input.mp4 \
  -c:v h264_nvenc -preset p3 -tune ll -zerolatency 1 -b:v 3000k \
  -c:a libopus -b:a 64k \
  -f whip \
  "https://whip-server.example.com/publish/stream_id"

# Intel QSV WHIP streaming
ffmpeg -init_hw_device qsv=hw -filter_hw_device hw \
  -i input.mp4 \
  -c:v h264_qsv -preset fast -b:v 3000k \
  -c:a libopus -b:a 64k \
  -f whip \
  "https://whip-server.example.com/publish/stream_id"

WHIP Authentication

# With bearer token authentication
ffmpeg -re -i input.mp4 \
  -c:v libx264 -preset ultrafast -tune zerolatency \
  -c:a libopus \
  -f whip \
  -headers "Authorization: Bearer YOUR_TOKEN" \
  "https://whip-server.example.com/publish/stream_id"

WHIP Servers/Platforms

  • Cloudflare Stream - WebRTC ingest via WHIP
  • Dolby.io - Interactive streaming
  • Janus - Open-source WebRTC gateway
  • mediasoup - Open-source SFU with WHIP support
  • LiveKit - WebRTC platform with WHIP ingestion

Multicast, Re-streaming, Production Patterns & Troubleshooting

Multicast streaming setup, protocol re-streaming (RTMP/HLS/DASH/SRT inter-conversion), production patterns (encoder profiles, ABR ladders, monitoring), and a streaming troubleshooting catalogue live in references/production-and-troubleshooting.md. Load that reference when bridging protocols, building production ABR pipelines, or diagnosing streaming failures.

Best Practices

  1. Use appropriate keyframe interval - 2 seconds for live streaming
  2. Match bitrate to bandwidth - Leave 20% headroom
  3. Use CBR for streaming - Consistent bandwidth
  4. Enable faststart for VOD - -movflags +faststart
  5. Monitor stream health - Check for drops/errors
  6. Use hardware encoding - NVENC/QSV for GPU offload
  7. Implement ABR - Multiple quality levels
  8. Secure your streams - Use RTMPS/encryption
  9. Test failover - Backup ingest points
  10. Log everything - Use -report for debugging

This guide covers FFmpeg streaming fundamentals. For hardware acceleration, see the hardware acceleration skill.

Discovery
Tags

No tags published for this skill.

Version
Latest version metadata

Version

v2026.09.24

Published

Sep 24, 2026

Category

Uncategorized

License

MIT

Source path

plugins/ffmpeg-platforms/skills/ffmpeg-streaming

Default branch

main

Latest commit

5a1b112

Tree SHA

376c8e0