A Comprehensive Overview of RTSP vs RTMP

In this article, we will dive deeper into the two most used streaming protocols - RTSP vs RTMP.

Feature image
A Comprehensive Overview of RTSP vs RTMP

Smooth, hassle-less streaming has become important for all businesses around the globe that deal with video content. If your audience faces all kinds of difficulty in accessing your streams, or if the video streaming process is a bit too complex - the content you’re putting out for your audience is going to end up being useless. Then, you will have to fight an uphill battle to get your video streams to your target audience. However, this can be taken care of if you’re aware of different streaming protocols and which ones to use in what scenario.

RTSP is commonly used for streaming media, such as video or audio streams, and is best for media that needs to be broadcasted in real-time. Meanwhile, RTMP is commonly used for streaming media over the web and is best for media that can be stored and delivered when needed. But, to decide which one will perfectly cater to your needs, you will need to understand each of these and the differences between them in detail.

That said, in this article, we’ll dive deeper into the two most used streaming protocols - RTSP and RTMP. But before that, let’s get some idea of what exactly streaming protocols are.

Schedule a Demo with Our Video Expert!

Discover how Gumlet can help you build a cutting-edge video streaming infrastructure.

What are streaming protocols?

Streaming protocols help in defining the procedure that will be taken to break down your large video file into small chunks or data packets, using which they can be transmitted over the internet more easily. In simple terms, these protocols are just a written set of rules that govern how multimedia sharing or transmission will take place between two communication systems.

Overview on RTSP

What is RTSP

Short for Real-Time Streaming Protocol, RTSP is a comparatively lesser-known streaming protocol for online video streaming. The basic idea behind the inception of this protocol was to control the streaming servers that were used in both communications as well as entertainment systems. RTSP servers would sit in the middle of the viewer and the live stream and issue the “pause”, “play”, and “record” commands as and when needed.

In order to maintain the smoothness and consistency of video streaming, RTSP also incorporates two more network communication protocols. These include TCP - for receiving and issuing control commands - and UDP - for delivering video, audio, and other forms of data. Because of these protocols, users are able to easily play RTSP streams while even downloading videos.

Although, in theory, RTSP finds usage in both on-demand videos as well as live broadcasts, the technique is now used in the last lap in order to transfer a video stream from wherever it is stored in the cloud to the user’s player. RTSP is also a popular option for situations where you are required to transmit video signals over IP from cameras - for example, CCTV cameras and such.

How does it work for Streaming?

let’s look at exactly how the RTSP protocol works for video streaming. When a user wants to transmit video signals from any source, the user’s device sends RTSP requests to the dedicated server. This is done to find out the available options from play, record, rewind, and pause. The server then returns a signal to the user’s device with a list of requests that it is capable of receiving via RTSP.

Once the user’s device has got the list of the commands and the process for requesting the server, it sends a request to the streaming server for the description of the video content. Once the server receives this, it responds with a relevant description of this video content. Then, the user’s device sends a download request, and the server responds with all the information pertaining to the transport mechanism. That is when the video streaming process initiates on the user’s device through the specified mechanism.

Because RTSP by default relies and depends on a dedicated server, this protocol does not support retransmitting lost packets or encrypting video content. Further, this protocol is also not HTTP compatible, hence your users may not be able to play it directly on their web browser. To achieve this, you will first need to convert the original video stream by making use of an intermediate server.

Benefits of RTSP

One of the most clear-cut benefits of the RTSP method of streaming is that it supports reliable segmented streaming. What this essentially means is that your users will be able to watch a stream easily, even when it is being downloaded. Further, RTSP also provides intense customization features in order for you to build personalized streaming applications by adding novel and relevant features.

Drawbacks of RTSP

One of the most striking drawbacks of this method is that it isn’t used that widely for multimedia broadcasting using the internet as the medium of transfer. As a result of that, this streaming protocol is not that widely supported by various video hosting platforms as well as multimedia players. In essence, if you wish to use RTSP for your streaming platform, you should be ready to use additional software support to get your work done.

Overview on RTMP

What is RTMP

RTMP, or the Real-Time Messaging Protocol, is the go-to protocol when it comes to video-on-demand as well as live video streaming. It was originally developed by Macromedia and is now under the ownership of Adobe. This protocol was initially designed to establish stability between media servers and flash players. For that, it uses TCP to transmit data packets from the server to the user’s device.

RTMP is the most used and standard protocol when it comes to transferring visual and multimedia data over the internet. The protocol was originally created to act as a bridge between the server and the Flash player, but with time, it has grown to become the best protocol for achieving low latency while video-on-demand or live video streams. That is the major reason why this protocol remains relevant and powerful, despite the emergence of many more streaming protocols.

RTMP works on top of the TCP (Transmission Control Protocol). As a result, it sends the smaller bits of data in a static order till they reach the final receiving point. With Flash Player’s decreasing prominence and utility, the RTMP protocol has been widely used for ingesting the data in order to perform streaming and then transcoding that data into HLS in order to provide multi-device support. Many of the streaming platforms and video giants, like YouTube, Periscope, Facebook, and more, are leveraging RTMP for low-latency streaming while ensuring the stability of the connection.

How does it work for Streaming?

In general, live video streaming works in the following manner:

  • A camera records a video (or a video card records the screen).
  • This recording is then sent to the video platform server, or the host server, using an encoder. In common parlance, this step is known as the “first mile.”
  • Once this has happened, the host server processes this stream and sends it further using CDNs (content delivery networks) in order to distribute this video stream to the users’ devices. This step is called the “last mile.”

Till the time Flash was active and running, both the first and the last mile steps went through RTMP. However, with Flash becoming outdated, RTMP doesn’t work on the last mile. So, from this point onwards, the stream must communicate with other protocols like WebRTC, MPEG-DASH, HLS, etc.

On the first mile, however, RTMP still works as it used to do earlier and provides smooth and stable video streams between the RTMP server and the video source - by breaking down large volumes of video data into small blocks and then transferring those blocks via different virtual circuits. RTMP also opens up an ongoing connection between the stream source and the server, which further allows the protocol to truly act as the carrier for all the required video packets.

RTMP packets take a few seconds and follow these three stages:

  • TCP/IP Handshake - This is when the server and the client exchange information with one another and “negotiate” the stream transfer.
  • Connection establishing - Once the handshake is successfully accomplished, both the server and the client agree on all given parameters and connections using a list of messages.
  • Stream transmitting - Finally, the client sends a “create stream” call aimed at the host server, followed by a ping message and a replay.
RTMP: Stream Encoding

Benefits of RTMP

Now that we have understood what RTMP is and how it works, let’s look at the basic benefits or advantages of this streaming protocol:

  • Low latency - This essentially means that a connection won’t drop even if the channel between the viewer and the host server becomes slightly unstable. This is important when it comes to improving video quality and engagement metrics. RTMP offers stability of connection because of the fact that it uses TCP as its underlying protocol. For low latency, the trick is that RTMP uses the exclusive 1935 port, which removes the need for buffering the entire video stream.
  • Adaptability - In the context of broadcasts, adaptability is all about being able to connect or disconnect from a video stream whenever the users require or want. Further, they can also skip backward and forward, as is their need. RTMP provides these sorts of adaptability features, which come in extremely handy during conferencing, video game streaming, and even simple video calling.
  • Flexibility - This streaming technology supports the integration of different types of multimedia content into a single, comprehensive package. That way, it seamlessly mixes video, audio, and text modalities to give a complete whole. In addition to this, RTMP also supports audio streaming in MP3 and AAC formats, while FLV, MP4, and F4V formats can be used for transmitting video streams.

Drawbacks of RTMP

Here are some of the drawbacks of the RTMP streaming protocol that you must keep in mind:

  • No HTML5 support.
  • Some low-bandwidth vulnerabilities and issues.
  • Incompatibility with HTTP. So, to publish RTMP streams on a website, you will need to either use a CDN or implement a dedicated server such as Flash Media Server to get things going.

RTSP and RTMP - Performance comparison

Both streaming protocols have been developed and designed for seamless low-latency video streaming. In terms of performance, RTMP is more widely used by broadcasters, whereas RTSP is mostly used for localized video streaming from CCTV or IP cameras. The performance of these two streaming protocols differs based on your requirements and your understanding. With that said, check out the following specifications comparison to get a technical overview of how both these streaming protocols differ from one another.

RTSP vs RTMP - Specification comparison

Streaming Protocol RTMP RTSP
Delay 3-30 seconds 2-5 seconds
Audio Codecs AAC, AAC-LC, HE-AAC + v1 and v2, MP3, Speex, Opus, Vorbis. AAC, AAC-LC, HE-AAC + v1 and v2, MP3, Speex, Opus, Vorbis.
Video Codecs H.264, VP6, VP8, Sorenson Spark, Screen Video V1 and V2. H.265 (preview), H.264, VP9, VP8.
Playback Compatibility Flash Player, Adobe AIR, RTMP-compatible players. Quicktime Player, RTSP/RTP-compatible players, VLC media player, 3Gpp compatible handheld devices, etc.
Pros Low Latency

Low Buffering

High Stability
Low latency

Supported by most IP cameras

Segmented streaming

Much more customization options
Cons Incompatible with HTML5

Incompatible with HTTP

Possible problems with scaling

Bandwidth vulnerability
Incompatible with HTTP

Not that popular with the majority.

In Conclusion

The choice between RTSP and RTMP streaming protocols depends entirely on your use case and your users’ streaming devices. While RTMP offers all sorts of compatibility and low-latency streaming, you still need Flash Media Server or CDNs to successfully distribute your video content. This tends to be a limitation for many in today’s day and age. However, with RTSP, you can expect the best results in the case of IP cameras as well as localized streams. This real-time protocol has stayed relevant and useful despite the emergence of all sorts of new and advanced protocols.

In the end, both of these protocols come with their strengths, weaknesses, pros, cons, and specific use cases. In this article, we fleshed out each and every detail that you’d need to know before making a choice between these two streaming protocols.

FAQs

1. Is RTMP better than RTSP?

RTMP is generally better than RTSP, as it offers compatibility and low-latency streaming. Additionally, RTMP offers better performance, as it is optimized for streaming over the internet, while RTSP is designed for streaming over a local network.

2. Does YouTube use RTMP or RTSP?

YouTube does not use RTMP or RTSP. It uses HTML5 and MPEG-DASH for video streaming.

3. Is RTSP still being used?

Yes, RTSP is still being used and is a popular protocol for streaming media. It is still actively used in video surveillance today to capture the feed from IP or CCTV cameras.

4. Which protocol is best for streaming?

HLS is the best protocol for streaming.

Similar readings

Share this Article: