RTMP (Real Time Messaging Protocol) is a TCP-based protocol that is used for low latency streaming of audio, video and data over the internet. It allows live streams to be broadcast to multiple viewers through streaming servers.
To broadcast a live stream using RTMP, you need an RTMP URL from a streaming service provider. This URL acts as the destination that your encoder software sends the video stream to. Viewers can then access the live stream using a media player that supports RTMP.
So what exactly is an RTMP URL and what does it look like? Here is a quick overview of RTMP URLs for live streaming:
What is an RTMP URL?
An RTMP URL is a web address that points to a live streaming server. It provides the connection details that encoders need to push streams to the server and that viewers need to play the live stream.
The RTMP URL contains:
- The RTMP protocol – rtmp://
- The server IP address or domain name
- The application name
- The stream name
Here is an example RTMP URL:
rtmp://live.example.com/live/stream123
Let’s break this URL down:
- rtmp:// – Indicates this is an RTMP URL using the RTMP protocol
- live.example.com – The IP address or domain name of the streaming server
- /live/ – The application name on the server (live in this case)
- stream123 – The unique stream name
The application name and stream name on the server are defined when setting up the live stream. The service provider will provide the full RTMP URL to use for broadcasting and watching the stream.
Where do I get an RTMP URL?
RTMP URLs are provided by streaming service providers that offer RTMP ingest and playback. Some popular options include:
- Wowza Streaming Engine
- Adobe Media Server
- Nimble Streamer
- DaCast Streaming Platform
- Ant Media Server
- StreamShark
- Lightcast
These providers will give you an RTMP URL to use when setting up your live stream through their dashboard or control panel. The URL already contains the server address and stream name configured on their streaming server.
You can also build your own RTMP streaming server using software like Nginx RTMP Module, Node-Media-Server and more. In this case, you configure the RTMP URL and stream names yourself on your own server.
Streaming to an RTMP URL
To broadcast to an RTMP URL, you need an encoder software or hardware device. This encoder pushes the video stream to the ingest URL. Some common encoder options include:
- Open Broadcaster Software (OBS) – Free open source software encoder
- Wirecast – Paid software encoder from Telestream
- vMix – Paid software encoder and switcher
- Teradek encoders like the Vidiu or Slice – Hardware encoders
- Blackmagic encoders – Such as the ATEM Mini Pro ISO
- Smartphone apps like Larix Broadcaster – For mobile streaming
You enter the full RTMP URL provided by your streaming provider into your encoder settings. This enables the encoder to push the live stream to that destination URL.
Some encoders may also require you to enter a stream key. This is appended to the end of the RTMP URL as &streamkey=somekey. The stream key authenticates your stream and may be required by your streaming provider.
Types of RTMP URLs
There are a few different variations of RTMP URLs based on how authentication is handled:
Simple RTMP URL
A simple RTMP URL only contains the protocol, server address, app name and stream name:
rtmp://live.example.com/live/stream123
This does not contain any authentication parameters and could be used for a public stream.
RTMP URL with Stream Key
Many providers use stream keys to authenticate the stream to their server:
rtmp://live.example.com/live/stream123?streamkey=12345abcde
The stream key is appended as a parameter to authenticate pushing the stream. Viewers will use the URL without the key.
RTMPS URL (RTMP over SSL)
RTMPS transmits streams over a secure SSL connection:
rtmps://live.example.com/live/stream123
RTMPS uses port 443 by default. Encoders and players that support RTMPS can connect over SSL.
RTMPT URL (RTMP Tunneled)
RTMPT tunnels RTMP within HTTP requests to bypass firewalls:
rtmpt://live.example.com/live/stream123
RTMPT uses port 80 and masquerades as normal HTTP traffic. Useful when RTMP ports are blocked.
Setting Up RTMP Ingest
To receive an RTMP stream on your own server, you need to install RTMP server software and configure an ingest point. Here are some key steps:
1. Install RTMP Server Software
Install an RTMP server like Nginx RTMP Module, Wowza, Ant Media Server, etc. on a hosted server. This provides the RTMP endpoint.
2. Configure Ingest in Server Software
In the server’s control panel, define an application (e.g. “live”) and input stream name (e.g. “stream1”). This sets up the ingest point.
3. Create RTMP URL for Ingest
Construct your RTMP URL using the server’s IP/domain, application and stream name. This is the URL your encoder will push to.
For example:
rtmp://12.34.56.78/live/stream1
4. Enter URL into Encoder
Add the above RTMP URL to your streaming encoder’s configuration. The encoder will connect to this URL and begin pushing the stream.
5. Configure Streaming Formats
Make sure RTMP streaming formats like H.264 video and AAC audio are selected in your encoder and server settings. The formats must match on both ends.
6. Test and Troubleshoot
Try a test stream and confirm you can view it through the server. Troubleshoot any connection or configuration issues.
7. Manage Bandwidth and Quality
Optimizing video bitrates and resolutions can provide an optimal viewing experience for your audience across devices and network conditions.
Viewing an RTMP Stream
To watch an RTMP live stream, users will require an RTMP compatible player. Here are some ways viewers can play an RTMP stream:
Media Players with RTMP Support
Desktop media players like VLC, mpv, MPlayer and more support RTMP. Users can open an RTMP URL directly in these players. The stream will play back live in the application.
Media Servers with HTTP Delivery
In addition to ingest, media servers can also deliver the RTMP stream to end viewers. They will transcode the stream to formats like HLS or DASH. Users can then access the streams over HTTP.
Wowza, Ant Media Server and others have modules to enable HTTP-based delivery. Streams get delivered to mobile, smart TV and other playback devices.
Video Platforms with RTMP Support
Many video platforms like YouTube, Twitch, Facebook and others allow broadcasters to ingest RTMP streams which are then delivered to viewers through that platform’s CDN and player. Users watch on the platform’s site or apps.
Flash Players
Flash-based players can directly connect to an RTMP URL. However Flash support is being phased out on most browsers and devices. It still works for some desktop sites.
Custom RTMP Players
Developers can build their own RTMP capable players using tools like Flash, Flowplayer, JW Player, Video.js and other frameworks with RTMP plugins. These support direct playback from an RTMP URL.
Benefits of Streaming with RTMP
RTMP offers some key advantages for live streaming:
Low latency delivery
RTMP provides sub 10 second latency, essential for livestreams. This minimizes delay from broadcast to viewer.
Adaptive bitrate support
RTMP supports adaptive bitrate streaming which automatically adjusts quality based on the viewer’s network conditions and device capabilities. This ensures the best experience.
Works across CDNs
RTMP can be delivered across any CDN that supports the protocol. This gives flexibility across providers.
Cost effective and scalable
RTMP streaming servers and services are very affordable and can scale to large audiences with low overhead costs.
Flexible integration options
RTMP integrates with encoders, third-party services, and custom workflows through its open API and simple protocol.
Optimized streaming formats
RTMP uses codecs like H.264 video and AAC audio which provide an optimized viewing experience and compatibility across devices.
Easy to deploy and manage
Open source RTMP servers and cloud services require minimal configuration and management overhead to get streaming up and running.
Limitations of RTMP
However, there are some drawbacks to consider with RTMP streaming:
Security issues
By default RTMP does not encrypt stream data or user credentials. Additional measures like RTMPS are needed to add security.
Firewall blocking
Corporate and institutional firewalls often block default RTMP ports 1935 and 443. RTMPT tunneling is required to bypass blocks.
No native support on most players
Aside from desktop media players, most streaming devices do not natively support RTMP playback. Additional protocols like HLS are needed for delivery.
Not scalable for large sites
A single RTMP server can only support a limited number of concurrent streams and viewers. A CDN is required to scale up for larger audiences.
Limited analytics
RTMP provides only basic metadata on streams. More advanced analytics platforms and capabilities often have to be layered on top.
No built-in DRM
Unlike HLS and DASH, RTMP has no built-in DRM support. Enabling encryption and access control requires adding custom DRM integration.
RTMP Alternatives
If RTMP streaming does not meet your specific needs, some alternative protocols include:
HTTP Live Streaming (HLS)
HLS delivers streams over basic HTTP connections. It uses short segmented files in MPEG2-TS format. Supported by most players and CDNs.
Dynamic Adaptive Streaming over HTTP (DASH)
DASH streams use HTTP just like HLS but with different media segmentation methods. Adopted by many large providers.
WebRTC
WebRTC enables real-time streaming directly between browsers without plug-ins. More limited support and scalability than RTMP.
MPEG-TS over UDP
Some CDNs support raw transport stream delivery over UDP. Provides low latency but less adaptive delivery.
Zixi
Zixi utilizes UDP for broadcast-grade live streaming. Provides enhanced reliability and bonding of multiple internet connections.
SRT
SRT is an open source video transport protocol that promises better performance and security over standard RTMP.
Conclusion
RTMP remains one of the most ubiquitous protocols for low latency live streaming. The simple and flexible RTMP URL scheme allows broadcasting software to target any compliant media server. Both open source and commercial solutions enable building highly scalable and affordable streaming infrastructure using RTMP.
Despite some limitations around player support, security and analytics, RTMP can deliver high quality streams with sub 10 second latency across a wide range of use cases and platforms. When evaluating live streaming protocols, RTMP is still very much relevant technology to consider.