Why is HLS better than MP4?
When streaming, it's important that your viewers don't lose interest in the content.
Therefore, transmission quality is critical.
The appropriate data transfer protocol is necessary to ensure high quality transmission, uninterrupted sound, and no buffering.
The most commonly used formats are HLS and MP4. But which one is better?
To answer this question, let's take a closer look at each.
What is HLS
HTTP Live Streaming (HLS) is a protocol for transmitting video over the Internet, its hallmark being the adaptive bitrate. This protocol was developed by Apple and became available in 2009. It is believed to have replaced Quicktime, which was using non-standard ports, which, in turn, caused many firewalls to block transmission. Because of these issues, Quicktime was not suitable for mass use.
This protocol was made open source, so it can be used for free and modified at your convenience.
How it works
Your video content is cut into short blocks of 10 seconds. These fragments are transmitted over HTTP for compatibility with many devices and firewalls.
What is the value
Thanks to the HTTP Live Streaming protocol, broadcasts are transmitted in the best possible quality. But there’s also a caveat, the latency will be about 15 seconds and sometimes more.
You, as the creator of the broadcast, can assign a different encoding quality of the stream on the server side to make several versions of the stream with different bitrates (ABR - Adaptive Bitrate).
To do this, the player analyzes the throughput of the Internet channel, and switches to a suitable bitrate dynamically. Therefore, with adaptive bitrate, the quality of fragments can be different.
Let's say you're watching a HD video on your smartphone, you are on the move and the signal gets worse. The player reacts to this change and starts transmitting video with a smaller bitrate, adapting to the situation, so that the stream is not interrupted.
When to use HLS for live streaming
This protocol is considered one of the better ones, and it is supported almost anywhere:
desktop computers (Windows, Mac OS and Linux),
browsers (Chrome, Safari, Firefox, Edge),
smart TVs and mobile devices.
Therefore, for continuous broadcasts, when being as close to real-time as possible is not a priority, but the quality is, HLS is a good pick.
Especially if your stream is mostly being watched on mobile devices.
Although the quality may vary, the native HTML5 player and adaptive bitrate provide a good viewing experience regardless.
The downside is that due to the latency of about 15 seconds, it may be not very convenient to interact with chat in your broadcast. But it’s still possible.
Apple addressed this issue and updated the HLS protocol to create "Low Latency HLS".
What is MP4 in streaming
MP4 or MPEG-4 is a type of video container. It has been popular for offline usage for many years. By itself MPEG-4 is not suitable for HTTP data transmission. Therefore, most browsers simply ask the server to read and send the file in H.264/AAC packaged as MP4.
But the support for changing bandwidth conditions or fixing problems with latency that HLS offers is simply not there.
MP4 cannot be used to adjust the throughput in any way, and if you suddenly experience a delay, then you will not be able to do anything.
What is MP4 good for?
MP4 is widely supported and easy to use, but if you're streaming live it will let you down.
But if you like MP4, use it as a starting point for other streaming protocols like MPEG-DASH and MPEG-2/.TS.
So MP4 or MPEG-4 aka ISO/IEC 14496-14:2003 is a media container for video files, where audio, subtitles and other information can also be stored.
And HLS is a protocol for transferring MP4 in short blocks (chunks) over the network.
Therefore, MP4 and HLS are really hard to compare because they serve different purposes in the video delivery ecosystem.
What is the difference between HLS and MP4 video?
HLS is faster than MP4.
HLS: Segmented video is played in sections. Therefore, the launch occurs almost without freezes. Thus, wherever you move along the time axis on the player, this segment will be played immediately.
MP4: Heavy header file, caching data at the time of download, so the speed is significantly reduced. Try to move the time axis to any point in the video to be sure - caching will slow down.
On the flip side, many browser clients can play MP4 videos.
HLS consumes less bandwidth than MP4.
HLS: One segment loads at a time, so it does not consume much bandwidth. But, with a low bandwidth bitrate, it will take a lot of packaging.
MP4: Unlike HLS segmented playback, MP4 will download the entire file before reaching your point on the timeline. But this format is still suitable for short videos.
Why is the DASH format needed?
Our comparison will not be complete if we do not mention one more format. In terms of playback experience, it is similar to HLS and also uses little bandwidth.
It is an open source protocol that uses both HTTP and HTTPS for transmission, so the firewall does not block it. And just like HLS, it adapts to network degradation.
It would be the twin of HLS if not for one thing - not all mobile devices support DASH.
Which protocol to choose for your tasks?
We have prepared a few questions to help you understand what is the best option for you:
How will you distribute content? Inside consumer-facing applications, or among third party distributors?
Who will be watching the stream, how many and on what type of devices?
If you need to encode a live performance, adaptive bitrate is indispensable. Then it's HLS or DASH.
If you don't know how to set up streams or manage these or other protocols, you can take advantage of the Callaba Cloud platform. Callaba Cloud will help you set up live streaming with low latency.
If you want to see our tools in action try a free 5 day trial on AWS.
If you need more information, follow us on social media: