Both RTMP and RTSP have a long-established foothold in media delivery technology. They helped develop the internet into the transformative information sharing platform that it is today. However, there are a variety of uses when it comes to RTMP vs. RTSP. What is RTMP? RTMP (Real-Time Messaging Protocol) is an application-level video streaming protocol… Continue reading 5 Ways To Decide Between RTMP vs RTSP
Both RTMP and RTSP have a long-established foothold in media delivery technology. They helped develop the internet into the transformative information sharing platform that it is today.
However, there are a variety of uses when it comes to RTMP vs. RTSP.
What is RTMP?
RTMP (Real-Time Messaging Protocol) is an application-level video streaming protocol with a long history in the media streaming marketplace. Developed by Macromedia and now owned by Adobe, RTMP was designed for the delivery of on-demand and live media between a Flash player and a Media Server over the Internet. While the Flash player is quickly being phased out, the RTMP protocol is still a widely used format across many use cases.
RTMP establishes a connection between the RTMP server and the client player. It will then transmit the media as a constant flow of bytes until either the server or the player finishes the session. RTMP also runs on top of TCP, which means that it is concerned with the order in which it receives data packets. Unlike RTSP, RTMP cannot be delivered over UDP which is designed to prioritize latency over quality.
What is RTSP?
The Real-Time Streaming Protocol (RTSP) is a network control protocol designed to send low latency streams. Developed by experts from RealNetworks, Netscape and Columbia University around 1996, the protocol defines how the data in the stream should be packaged for delivery. It also defines how both ends of the connection should behave to prepare a pathway for transportation. It then uses the Real-Time Transport Protocol (RTP) in conjunction with Real-time Control Protocol (RTCP) for actually delivering the media stream.
RTSP uses the efficient RTP protocol which breaks down the streaming data into smaller chunks for faster delivery. When paired with UDP packet delivery, RTSP achieves a very low latency: under 500 milliseconds (when used with Red5 Pro).
A more detailed breakdown of the RTSP protocol can be found in this blog post.
Now that we have an idea of what each protocol is, let’s examine when each protocol would be useful. It should be noted that the selection of RTMP vs RTSP will often be determined by the specific devices used to conduct the live streaming rather than which protocol is “best”. RTMP and RTSP are usually not interchangeable.
IP Cameras – RTSP
A vast majority of IP cameras support the RTSP protocol so it’s a pretty easy selection for that one. IP cameras were around well before the invention of RTMP, and since RTSP was (and is) a very effective solution, there was no need to change it. Thus the earlier development of RTSP encouraged the adoption of RTSP for IP cameras.
There are various uses for IP cameras. Crowd surveillance or traffic monitoring for law enforcement agencies, home monitoring systems, even just for fun weather cameras in remote locations.
Due to the way that IP cameras work, the camera itself acts as an RTSP server. This means that in order to connect to the IP camera server and consume the stream, you have to run an RTSP client. Red5 Pro’s Restreamer plugin does exactly this by providing a way to connect to an RTSP stream as a client and restream it to other Red5 Pro supported endpoints, like a browser running WebRTC. For more details on the restreamer plugin, check out this post.
IoT Devices – RTSP or RTMP
Drones, robots and other devices benefit greatly from sending live video. The video not only allows us to see what the device sees but also assists in the control of the device. RTSP support is often built right into the drone or IoT software and is a common way to access the video feed. However, some manufacturers, such as DJI, use RTMP so this may depend upon the specific device in use.
For example, firefighters can gather information about current fire conditions and use that information to help coordinate their operation. Aerial surveying is also useful for maintaining infrastructure by examining roads and power lines or even conducting geologic surveys. Interestingly, there are telepresence and remote surgery robots which allow doctors to speak and operate on patients from afar.
Controlling drones and robots, would not be possible without low-latency as any delay in the video between what the video sends back and the actual physical location of the device could create a problem.
Red5 Pro Mobile SDK – RTSP
Normally, mobile devices do not accept RTSP as they do not have native support for it.
However, the Red5 Pro mobile SDK uses RTSP to deliver live streams to and from mobile devices on a native app. By creating a single connection per subscriber/publisher client, both Android and iOS devices can use RTSP as a simple way to connect a large number of broadcasters to a large number of subscribers.
For example, a single c5.large instance (2CPU 4GB) running Red5 Pro and streaming a 720p video, can handle 200 WebRTC subscribers or 920 RTSP connections. With a reduction of almost 4 times in bandwidth costs, the additional cost for the Red5 Pro Mobile SDK will be quickly recouped.
YouTube, Twitch, Facebook – RTMP
Even though 2020 marks the end of life for Flash Media Player, the RTMP protocol will still be useful. For example, Red5 Pro’s implementation of RTMP is able to achieve sub-one-second latency. Though RTMP is synonymous with Flash, the protocol will outlive the player.
Due in part to its widespread use in the past, and the flexibility of the protocol, RTMP is still used as an ingest protocol by most third-party streaming applications such as YouTube Live, Twitch and Facebook.
Another interesting third party service that makes use of RTMP is Zoom. Zoom supports an RTMP stream output of your video call which allows for interesting use cases like creating your own Webinar or remote conference. Take a look at Mux’s recent article on leveraging Zoom and RTMP to create a virtual conference.
Of course, if you want to also solve the latency issue Mux introduces via HTTP delivery you can always deliver that RTMP stream to Red5 Pro and have your customers view it in the browser over WebRTC.
Older Hardware Encoder – RTMP
Some hardware encoders (especially older ones) will only accept RTMP streams. That makes it pretty obvious which one to use.
However, it should be noted that many hardware encoders are switching to SRT based encoders due to the fact that it is open-source and optimizes live stream delivery through firewalls and across unreliable networks.
For more on the future of RTMP, please take a look at our What’s Next for RTMP Servers? blog article.
RTMP vs. RTSP
As the above examples show, the decision to use RTMP or RTSP is determined heavily by the use case and the devices being used to stream live video.
RTSP works with IP cameras and devices that run IP cameras such as drones. With Red5 Pro specifically native apps can run RTSP as well for low latency and full scalability.
RTMP works for major third party streaming applications and older hardware encoders.
Want to try out Red5 Pro’s RTMP and RTSP solutions yourself? Check out our real-time latency demo and sign-up for a free trial.
Have a few questions before jumping in? Send a message to info@red5.net or schedule a call. We’d love to show you what Red5 Pro can do!