Back to blog

RTMP Streaming: What is it & How to Set it Up?

RTMP Streaming: What is it & How to Set it Up?

Let’s first start with a formal definition: RTMP, or Real-time Messaging Protocol, is a method for streaming video and audio over the internet. RTMP uses a persistent (continuous) TCP connection to stream audio and video fragments from a source to a single destination.

It was created with the aim of maintaining constant, low-latency connections between a video player and a server. RTMP has been the standard for streaming video over the internet ever since Adobe's Flash Player added support for it back in the early 2000s.

But over the years, newer standards like HTTPS Live Streaming (HLS) and adaptive bitrate streaming (ABS) have been introduced that have been eating into the use of RTMP.

That said, RTMP still holds value in the world of live streaming, albeit in a reduced scope. With RTMP, you can stream content at low latency and with minimal buffering, a major plus for broadcasters streaming large-scale events in real time.

RTMP is here to stay. And if you're streaming content to a large audience, you should embed it in your product. Read this blog to understand how you can do it.

RTMP Uses

There are two places where RTMP is used. First: Using it to transmit video data between an encoder and server, also known as first-mile delivery.

The second use case for RTMP is between a server and a viewer's device using Flash Player, aka last-mile delivery. Last-mile delivery with RTMP works best for streaming to a small audience from a dedicated media server. However, since Adobe is deprecating flash – the use of RTMP in live streaming (on mobile devices is on a downward trend).

How Does RTMP Work?

If you've wondered how your favorite streamers can go live on platforms like Twitch and YouTube, the answer is RTMP ingest.

Unlike WebRTC or HLS - RTMP uses a three-way handshake when transporting data - the client contacts the server, the server accepts and responds, and the client acknowledges the response. At this point, a session opens, and RTMP can start streaming video.

Here's a step-by-step breakdown of how RTMP ingest works:

Step 1: The Handshake

Before an RTMP stream can begin, the encoder and server must complete a "handshake." This process starts with the encoder sending a message to the server asking if it's available to receive an RTMP stream. The server then responds with a message indicating that it is available. Once the encoder gets this message, it can start sending data to the server.

Step 2: The Connection

0:00
/0:01

After the handshake is complete, the encoder and server establish a connection. This connection allows them to start exchanging data. The encoder will typically send a "command" to the server telling it what type of data it will send (e.g., video, audio, etc.).

Step 3: The Stream

0:00
/0:02

Finally, the encoder will send its stream to the server once the connection is established. The server will then make this stream available to viewers via platforms like Twitch or YouTube. That's it! That's how RTMP ingest works.

RTMP Protocol Variations

The RTMP protocol has been around for over a decade and is still widely used today for streaming audio, video, and data over the internet. RTMP is the foundation of many popular streaming platforms like Adobe Flash Media Server, Wowza Streaming Engine, and Amazon CloudFront.

Although the RTMP protocol is stable and efficient, a few variations have been developed to improve the original design.

1. RTMP

RTMP (Real-Time Messaging Protocol) is the original protocol designed for real-time audio, video, and data streaming over the internet. It is a TCP-based protocol that uses a persistent connection between a client and a server. This means that once a connection is established, it can be used for multiple streams without having to be re-established each time.

2. RTMPS

RTMPS (Secure Real-Time Messaging Protocol) uses SSL/TLS encryption to secure data in transit. This added security measure makes it ideal for use cases where sensitive data needs to be streamed, such as financial data or medical information.

3. RTMPE

RTMPE (Encrypted Real-Time Messaging Protocol) is very similar to RTMPS in that it uses encryption to secure data in transit. However, unlike RTMPS which uses SSL/TLS encryption, RTMPE uses Adobe's proprietary encryption algorithm. This makes it less secure than RTMPS but more efficient since it doesn't require as much processing power.

4. RTMPT

RTMPT (Tunneled Real-Time Messaging Protocol) is designed for use cases where a firewall is blocking access to port 1935 (the default port for RTMP). It works by encapsulating RTMP traffic in HTTP requests which are then tunneled through the firewall to reach their destination.

5. RTMFP

RTMFP (Real-Time Media Flow Protocol) is a UDP-based protocol that was designed specifically for flash applications. It offers several advantages over TCP-based protocols like RTMP, including lower latency and better error correction. However, because it uses UDP instead of TCP, it's not as reliable which can make it less suitable for some use cases.

Livestream on Various Platforms Using Dyte

With Dyte, you can livestream your meeting to any platform that supports RTMP, such as YouTube, Twitch, and more. In order to start the recording, you simply need to pass that RTMP endpoint.

For example, to stream it to restream.io simply do the following:


curl --request POST \
  --url https://api.dyte.in/v1/organizations/orgid/meetings/meetingid/recording \
  --header 'Authorization: APIKEY yourapi-key' \
  --header 'Content-Type: application/json' \
  --data '{
    "liveStreamingConfig": {
        "rtmpUrl": "rtmp://live.restream.io/live/your-stream-key"
    }
}'
    

Read through this doc to understand it in detail.

Crater.Club a live streaming and auctions platform uses Dyte to live stream meetings to YouTube and LinkedIn. Read this blog to get a glimpse of how Crater uses Dyte.

Livestream Any RTMP Input Using Dyte

If you want to share a Livestream with the world but don't know how to go about it? Luckily, Dyte makes it easy to Livestream any RTMP input (YouTube, Zoom, etc.) with just a few clicks.

1. Create a Live Stream

Request


curl --location --request POST 'https://api.dyte.in/v2/livestreams' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic ORGID:APIKEY' \
--data-raw '{
    "name": "some name"
}'
    

Response


{
  "success": true,
  "data": {
    "id": "STREAMID",
    "title": "STREAMNAME",
    "input_rtmp_url": "rtmp://URL/LiveApp/STREAMID?token=TOKENID",
    "token_id": "TOKENID",
    "stream_key": "STREAMID?token=TOKENID",
    "player_url": "https://URL/LiveApp/play.html?name=STREAMID",
    "status": "OFFLINE",
    "hls_play_url": "https://URL/LiveApp/streams/STREAMID.m3u8"
  }
}
    

As seen in the response

1. You can use data.input_rtmp_url to feed any RTMP-compatible app or API (including YouTube, OBS, Twitch, etc.).

Adding it to OBS would look like this:

2. Get a Livestream Instance Information

Response


{
  "success": true,
  "data": {
    "id": "STREAMID",
    "title": "STREAMNAME",
    "input_rtmp_url": "rtmp://URL/LiveApp/STREAMID?token=TOKENID",
    "token_id": "TOKENID",
    "stream_key": "STREAMID?token=TOKENID",
    "player_url": "https://URL/LiveApp/play.html?name=STREAMID",
    "status": "OFFLINE",
    "hls_play_url": "https://URL/LiveApp/streams/STREAMID.m3u8"
  }
}
    

View docs for a quickstart guide.

Conclusion

RTMP has quickly become the industry standard for providing high-quality, low-latency communication between clients and servers. In order to deliver video content over the web in real-time, it's essential to use a streaming protocol like RTMP. Hopefully, this blog helped you understand the basics of RTMP and the understanding to put it into practice.

Only a powerful SDK can provide you with a seamless experience of using RTMP effectively. With Dyte, you can rest assured that your live video streams will reach their destination with no interruptions or delays. Sign up now and see the difference that RTMP can make for your broadcasts.

Great! Next, complete checkout for full access to Dyte.
Welcome back! You've successfully signed in.
You've successfully subscribed to Dyte.
Success! Your account is fully activated, you now have access to all content.
Success! Your billing info has been updated.
Your billing was not updated.