DEV Community

Cover image for RTMP to HLS With One FFmpeg Command, and Where Your 10 Seconds of Delay Come From
Mohammad Owais K.
Mohammad Owais K.

Posted on

RTMP to HLS With One FFmpeg Command, and Where Your 10 Seconds of Delay Come From

OBS speaks RTMP. Browsers don't. Converting RTMP to HLS is the most common job in live video, and you can do it with nothing but FFmpeg. The more interesting part is understanding where HLS's 8–12 seconds of delay come from, because once you know, you can shrink it.

Where the HLS delay comes from

1.Segment duration. Each segment has to be complete before it's published. With 2-second segments, you wait at least 2 seconds.
2.Player buffer. Most players hold about three segments before they start. That's another 6 seconds.
3.Keyframe alignment. A segment can only start on a keyframe. If OBS sends one every 4 seconds, your 2-second segments quietly become 4-second ones. Match OBS's keyframe interval to hls_time.
4.Playlist polling and CDN caching add the rest.

Add it up and 8–12 seconds is normal for standard HLS.

How you cut the delay

  1. Low-latency HLS publishes partial segments and gets you to roughly 3–5 seconds.
  2. WebRTC output skips segments entirely and lands around half a second, but you need a media server, not just FFmpeg.

When one command stops being enough

The FFmpeg version has no stream authentication, no adaptive bitrate ladder, no recording management and no dashboard. Anyone who finds your RTMP port can stream to it. When you need those things, a media server packages them. Here's a walkthrough on running a free RTMP server with a web panel in seven steps.

Run a real RTMP server

The step-by-step free RTMP server guide covers install, OBS settings and Windows via WSL2.

When 8 seconds is too slow, start a 14-day free trial of Ant Media Server Enterprise and compare HLS and WebRTC playback on the same RTMP stream. No credit card required.

RTMP to HLS FAQ

How do I convert RTMP to HLS?

Use FFmpeg with -c copy -f hls, or a media server that converts automatically. Both rewrap the stream without re-encoding.

Why is my HLS stream 10 seconds behind?

Segment duration plus a player buffer of several segments. Shorter segments, matched keyframes or low-latency HLS reduce it.

Does RTMP to HLS conversion need a lot of CPU?

Not if you only rewrap. Building multiple quality levels means re-encoding, which is CPU-heavy.

Top comments (0)