Converting RTMP to HLS: Advantages and How-To (Update)
2020 marked the long-awaited death of Adobe Flash, and with that came the phase-out of the Real-Time Messaging Protocol (RTMP) for video playback. While RTMP is still a reliable mechanism for transporting video between encoders and servers, the same cannot be said for delivery to end users. Fewer devices and browsers support this protocol than ever before. And in Adobe’s own words, broadcasters are encouraged “to migrate any existing Flash content to… new open formats.”
It also so happens that Apple’s HTTP Live Streaming (HLS) protocol leads the way for last-mile delivery. It’s the most widely supported streaming protocol out there, can quickly scale to reach audiences of any size, and ensures high-quality viewing with adaptive bitrate streaming. For these reasons, the majority of live video streaming workflows involve compressing live streams with an RTMP encoder and then converting the RTMP stream to HLS once it reaches the media server.
Referred to as transmuxing, this conversion process is critical when streaming to a variety of devices. It allows content distributors to deliver video streams using various protocols without having to manipulate the actual file. Think of transmuxing like converting a word doc into a pdf and vice versa. A streaming server software or cloud streaming service can be employed to accomplish this and more.
In this blog, we’ll take a look at what RTMP and HLS are, the benefits of architecting a workflow that uses both protocols, and steps for converting RTMP to HLS with either Wowza Streaming Engine or Wowza Video.
Table of Contents
What Is RTMP?
The RTMP specification is a streaming protocol initially designed to transmit audio, video, and other data between a dedicated streaming server and the Adobe Flash Player. RTMP maintains a constant connection between the player client and server, allowing it to act as a pipe and rapidly move video data through to the viewer.
Because RTMP sits on top of the Transmission Control Protocol (TCP), it uses a three-way handshake when transporting data. The initiator (client) asks the accepter (server) to start a connection; the accepter responds; then, the initiator acknowledges the response and maintains a session between either end. For this reason, RTMP is quite reliable.
Flash Player and RTMP were the dominant delivery mechanisms for live streaming up until the early 2010s. When used together, these technologies support lightning-fast video delivery with around five seconds of latency. But HTML5 video streaming, open standards, and adaptive bitrate delivery eventually edged RTMP streaming out when it came to last-mile delivery.
What Is HLS?
HLS is an adaptive HTTP-based protocol used for transporting video and audio data from media servers to viewers’ screens. It also happens to be the most common streaming protocol for delivery. The popularity of HLS over its alternatives can be chalked up to playback compatibility and quality of experience. All Mac, Android, Microsoft, and Linux devices can play streams delivered using HLS.
Video streams delivered via HLS are broken up into segments of data (also called chunks or packets) at the media server rather than being delivered as a continuous flow of information. Segmented delivery allows the player to shift between different renditions depending on available resources. Called adaptive bitrate streaming, this allows broadcasters to deliver high-quality streams to users with outstanding bandwidth and processing power, while also accommodating those lacking in the speed and power departments.
Advantages of Converting RTMP to HLS
A different protocol is often used for ingest and delivery to speed up the journey from the camera screen to the end-user device — while also optimizing the viewing experience. That’s why content distributors use a media server software or service to convert the live feed from one protocol to another.
RTMP is great for efficient video contribution, but it no longer makes sense on the publishing end of a workflow. Conversely, we’d highly recommend HLS for last-mile delivery, but it isn’t ideal as an ingest format.
Using a combination of RTMP and HLS helps maximize compatibility without pushing latency too high. This architecture also allows broadcasters to use well-supported protocols on either end of the live video delivery chain. Almost all software and hardware encoders support RTMP, and the same can be said for HLS on the playback side.
Converting RTMP to HTTP
Is it possible to convert from RTMP to HTTP outright? You may be under the impression this is necessary to be compatible with HTML5 players, but this isn’t true. There is no method to transport an RTMP package over plain HTTP or transcode it. A server would return an HTTP response to a client’s HTTP request, resulting in the client consuming the package (it’s possible to unpack said HTTP package but would require further and roundabout work).
The confusion is understandable: HLS is HTTP-based. However, they are still different formats, so converting from RTMP to HLS is more practical and efficient.
Why Do You Need a Live Streaming Server Solution?
Because today’s HTML5 players require HTTP-based protocols like HLS, a streaming platform can be used to ingest an RTMP stream and transcode it into a more playback-friendly alternative. Whether the RTMP stream is coming from an IP camera, mobile app, or broadcast-grade encoder, Wowza’s live streaming platform makes the conversion and delivery process seamless.
“A media server is an absolute necessity if you want to leverage RTMP for live streaming. Wowza Streaming Engine, for example, is a widely used streaming software for live and on-demand video that can be installed on any server.”
How to Convert RTMP to HLS
- Set Up an RTMP Source: To deliver an RTMP stream across the internet, you’ll need to start with an RTMP-compatible camera or encoder. You may be using an IP camera, software encoder, or hardware encoder. We recommend the free OBS software.
- Choose a Live Streaming Solution for Conversion: Once you’ve chosen the source encoder for your RTMP stream, you’ll want to select a software or service for video transcoding and delivery. We offer Wowza Video as an out-of-the-box solution or the Wowza Streaming Engine software for anyone requiring additional customization. These platforms do the heavy lifting for you, automatically transcoding from one protocol to another so you can take advantage of both RTMP and HLS’s broad compatibility.
- Configure the Live Streaming Server: Below, you can watch a simple tutorial for configuring OBS and Wowza Video to reduce HLS latency. This tutorial demonstrates the process when using OBS studio as your encoding software, but it’s possible to employ other encoding solutions.
If you prefer an on-premises solution instead of cloud-based, you can also watch the tutorial for sending an RTMP stream to Wowza Streaming Engine with OBS Studio here.
Reasons to Consider Alternative Protocols
Wowza supports plenty of other live streaming protocols, meaning that it’s ultimately up to you to select the best ones for your use case. We’d suggest asking the following questions before taking the standard RTMP-to-HLS route.
Do you require simple, browser-based publishing?
When simplicity is the name of the game, and you’re hoping to skip using an encoder altogether, WebRTC is a better option than RTMP for ingest. The protocol allows you to start streaming in seconds with Wowza Video. Find out how in this video tutorial.
Do you need to transport broadcast-quality content across the public internet?
As an open-source alternative to RTMP, Secure Reliable Transport (SRT) was designed to address remote video contribution challenges. The cutting-edge technology also achieves that elusive combination of high quality and low latency that every live producer seems to be chasing.
Is real-time interactivity required for your use case?
If you need true interactivity — we’re talking sub-one-second video delivery for scenarios like emergency response and remote monitoring — then using WebRTC end to end is the only way to go. It’s the fastest technology of the bunch and also can be used for ingest and delivery. Low-Latency HLS and low-latency CMAF for DASH are also good low-latency options, but full-blown implementations of these emerging technologies haven’t yet been deployed.
Start With Wowza
No matter what type of streaming architecture you’re trying to build, Wowza makes it happen. Our full-service platform can power any workflow with reliability to boot.
About Traci Ruether
Traci Ruether is a Colorado-based B2B tech writer with a background in streaming and network infrastructure. Aside from writing, Traci enjoys cooking, gardening, and spending quality time with her kith and kin. Follow her on LinkedIn at https://www.linkedin.com/in/traci-ruether/ or learn more at https://traci-writes.com/.