HLS vs MP4: How to Choose Website Video Delivery
Published
Use a single MP4 when one tested version serves your viewers well and you want a simple player and upload workflow. Consider HLS when playback needs to switch between quality levels as connections change. The decision depends on the viewing experience and the delivery work you can maintain; duration alone is a poor cutoff.
What changes between MP4 delivery and HLS?
Here, “MP4 delivery” means serving one video file directly to a player. It can play before the full download finishes. With suitable file layout and server support, the browser can fetch the parts it needs. It still receives the same encoded version as other viewers using that URL.
HLS is a delivery protocol. The player reads playlists and requests the media they reference. A multivariant playlist can offer several encodes of the same program so the player can change quality during playback. HLS can use fragmented MP4 media, so MP4 files can also be part of an HLS package. RFC 8216 describes the playlists, media segments, and variant streams.
Packaging a single encode as HLS does not create lower-quality alternatives. You need those encodes as well. For the separate decision about codecs and containers, see WebM vs MP4.
Choose for the viewing task
| Need | Starting point | Reason |
|---|---|---|
| A small click-to-play demonstration | Single MP4 | One acceptable encode may be enough. |
| A tutorial watched on changing connections | Compare adaptive HLS | A lower-bitrate version gives the player another option when bandwidth falls. |
| A direct download for viewers | Keep an MP4 download | A playlist URL is not a standalone video file. |
| A live broadcast | A live-streaming workflow | HLS supports live delivery; a completed MP4 does not provide a continuing broadcast. |
Apple’s HLS overview covers both live and on-demand delivery using ordinary web servers and CDNs. HLS is useful for recorded lessons too. You can also offer HLS playback and a separate MP4 download of the same lesson.
Try a single-file player first when it meets the task
For a recorded lesson, this is a simple starting point. Replace the paths and dimensions with your video, preview image, and reviewed caption file:
<video controls playsinline preload="none"
poster="/media/lesson-poster.webp"
width="1280" height="720"
style="display:block;width:100%;height:auto">
<source src="/media/lesson.mp4" type="video/mp4" />
<track kind="captions" src="/media/lesson.en.vtt"
srclang="en" label="English" />
</video>
<p><a href="/media/lesson.mp4">Download the lesson</a></p>
Check startup and seeking on the public URL. MP4 faststart puts the playback index near the beginning; HTTP range requests let a server return part of a file. MDN’s range-request guide explains the latter. The playback troubleshooting guide shows how to inspect both. HLS will not repair an incorrect media URL or an HTML response returned in place of video.
Account for the extra HLS work
Prepare and host the complete package
For adaptive delivery, your encoder or streaming service must produce compatible quality variants and their playlists. Publish every referenced resource, including initialization data and separate audio or subtitle files where used. Uploading only the top-level .m3u8 file leaves the player with missing media.
Include encoding, stored variants, delivery, and player maintenance when comparing costs. A managed service can handle packaging and hosting; check which work it actually includes. Adaptive delivery does not guarantee lower transfer costs or eliminate buffering.
Choose a player for your supported browsers
Safari supports native HLS playback. For other environments, check native support and the requirements of your chosen player. HLS.js provides playback through supported media-source APIs. Changing an MP4 source URL to a playlist is not a complete cross-browser implementation.
When using HLS.js with media on another origin, configure CORS for all requested resources. A playlist that loads successfully can still reference blocked segments. Test captions in the chosen player as well; use the caption guide to review the text and timing before packaging.
Compare the deployed versions under the same conditions
- Start and seek: test both versions with the cache disabled. Record startup delays and any stalls after jumping forward.
- Change the connection: throttle bandwidth during playback. For HLS, inspect player diagnostics to confirm that another variant is selected when appropriate. Multiple segment requests alone do not prove quality switching.
- Check the lower-quality version: read labels in screen recordings and check faces and motion. An available variant is only useful if viewers can follow it.
- Test the controls: use a phone and keyboard to check play, pause, seeking, captions, and the download link.
- Keep the observations: note the device, connection settings, selected quality, and cache state. Use those results to decide whether HLS improves this video enough to justify maintaining it.