Technical Tutorial

What is m3u8? A Comprehensive Guide to HLS Streaming Technology Used by Video Sites

A comprehensive guide to m3u8 file format and HLS streaming protocol. Learn how video slicing, adaptive bitrate switching, and major video sites like YouTube use HLS for smooth playback.

Dec 31, 2025·9 min read

What is m3u8? A Comprehensive Guide to HLS Streaming Technology Used by Video Sites

What is an m3u8 file?

When you watch a live stream on Bilibili, swipe through TikTok short videos, or watch high-definition movies on YouTube, you are likely using the m3u8 format behind the scenes. Simply put, m3u8 is a video playlist file. It acts like a “menu,” telling the player in what order to download and play specific video segments.

The m3u8 file itself does not contain video content but uses a text format (UTF-8 encoding) to record a series of URLs for video segments. This design is a core component of the HLS (HTTP Live Streaming) protocol proposed by Apple in 2009, which has now become the mainstream solution for video websites.

How does the HLS protocol work? A Vivid Analogy

Imagine you ordered a delivery pizza, but the pizza is too large for the delivery person to bring all at once. What is the smart way to do it? Cut the pizza into small slices and deliver them in batches. As soon as a slice arrives, you can start enjoying it immediately without waiting for the entire pizza to arrive.

The principle of HLS video streaming is similar:

HLS Segmentation Principle: Delivering Video in Batches Like Pizza

1. Video Slicing Process

The server cuts the complete video file into multiple small segments based on time (usually 2-10 seconds per segment), and each segment is saved as an independent file (common formats are .ts or .mp4). It’s like cutting a two-hour movie into 720 small pieces.

2. Generating the Playlist

After slicing is complete, the server generates an .m3u8 playlist file, which lists the download addresses of all video segments in order. This “menu” tells the player: “Download segment 1 first, then segment 2…“

3. Play While Downloading

When you click play, the player first reads the m3u8 file and then downloads video segments in order. The key point is: as long as the first few segments are downloaded, the video can start playing, and subsequent segments will continue to download during playback. This is why you can start watching before the video is fully loaded.

4. Intelligent Bitrate Switching

Even smarter, m3u8 can provide multiple versions of the playlist corresponding to different resolutions (such as 480p, 720p, 1080p). The player automatically selects based on your network speed: playing the HD version when the network is fast, and automatically dropping to SD when the network is slow, ensuring smooth playback without buffering.

Adaptive Bitrate Switching: Automatically Adjusting Video Quality Based on Network Conditions

1. Unbeatable Compatibility

HLS is transmitted based on the standard HTTP protocol, which means:

  • No special ports or server configurations are needed
  • It can penetrate almost all firewalls
  • Easily integrates with various CDNs (Content Delivery Networks) for acceleration

More importantly, iPhone and iPad only natively support HLS. If your video website wants to cover Apple users, m3u8 is almost the only choice.

2. Adaptive Bitrate Streaming

The multi-resolution automatic switching function mentioned earlier is technically called ABR (Adaptive Bitrate Streaming). This allows users to get the best experience in different network environments:

  • Automatically drop to smooth mode when the signal is unstable on a high-speed train
  • Automatically upgrade to Ultra HD after connecting to WiFi at home
  • No manual adjustment required throughout the process, and no playback interruption due to buffering

3. Large-Scale Distribution Capability

Since HLS uses the HTTP protocol, it can fully utilize existing CDN infrastructure. Large platforms like YouTube and Bilibili can cache video segments on server nodes around the world, allowing users to download from the nearest node, significantly improving speed and reducing costs.

4. Flexible Content Protection

m3u8 supports multiple encryption methods:

  • AES-128 Encryption: Encrypts each video segment, requiring a key to play
  • DRM Digital Rights Management: Apple’s FairPlay, Google’s Widevine, etc.
  • URL Signature Authentication: Adds timeliness and user identity verification to playback links

These measures make piracy more difficult and protect the copyright of creators.

5. Suitable for Both Live and On-Demand

HLS is not only suitable for on-demand content like movies and TV shows but is also widely used in live streaming scenarios:

  • On-Demand Mode: m3u8 lists all segments, allowing users to drag the progress bar at will
  • Live Mode: m3u8 is continuously updated, listing only the latest few segments, forming a sliding window

Bilibili’s live streaming and TikTok’s real-time interaction all have HLS technology behind them.

Real World Cases: How do Major Platforms Use HLS?

Streaming Technology Applications of Mainstream Video Platforms

Bilibili’s Dual-Protocol Strategy

Bilibili has adopted a very smart approach:

  • PC Live Streaming: Uses HTTP-FLV protocol to achieve ultra-low latency of 1-3 seconds
  • Mobile Live Streaming: Uses HLS for better compatibility (especially iPhone)
  • On-Demand Video: Provides both DASH and HLS formats, allowing the browser to automatically select the optimal solution

This architecture of coexisting protocols caters to low latency needs while ensuring broad device compatibility.

YouTube’s Global Coverage Scheme

YouTube mainly uses the MPEG-DASH protocol (an open standard similar to HLS), but to support Apple devices, it also provides HLS format:

  • Safari browsers and iOS devices automatically get m3u8 links
  • Other browsers use DASH format for higher flexibility (such as 4K, multi-audio tracks)

Twitch’s Low Latency Live Streaming Optimization

Game streaming platform Twitch has optimized HLS latency to the extreme:

  • Shortened video segments to 2 seconds (instead of the common 6-10 seconds)
  • The player starts playing after buffering only 1 segment
  • Achieved an end-to-end latency of about 5 seconds, allowing viewers to interact with streamers almost in real-time

TikTok’s Instant Play Experience

TikTok, combining HLS with other technologies, has achieved a “zero first frame” experience:

  • Preloads the first few segments of the next video
  • Uses intelligent scheduling algorithms to get data from the nearest node
  • Compresses video startup time to 100-300 milliseconds

m3u8 vs Other Video Formats: Which One to Choose?

Feature m3u8/HLS MP4 Progressive Download
Bitrate Adaptability ✅ Auto-switch multi-resolution ❌ Manual selection or multiple links needed
Implementation Complexity High (requires slicing, player support) Minimal (one file link)
Applicable Scenarios Long videos, live streaming, unstable networks Short videos, stable bandwidth
Anti-Hotlinking ✅ Supports encryption, signatures ⚠️ Harder to protect

Recommendation: Use MP4 for short videos under 15 seconds; HLS is a must for long videos and live streaming.

Compared with RTMP/FLV

Feature m3u8/HLS RTMP/HTTP-FLV
Latency High (10-30s, can be optimized to 2-5s) Very Low (1-3s)
Browser Compatibility ✅ Native on Safari, others need JS lib ⚠️ Requires special player (e.g., flv.js)
Firewall Penetration ✅ Based on HTTP, barrier-free ⚠️ Uses special ports, may be blocked
Applicable Scenarios On-demand, latency-insensitive live streaming Live streaming requiring real-time interaction (mic link, auction)

Recommendation: Use FLV for strong interaction needs; prioritize HLS for other cases.

Frequently Asked Questions (FAQ)

Q1: Why do some videos use m3u8 and others use MP4?

Answer: It depends on the content type and requirements. m3u8 is suitable for content that requires bitrate adaptation, is long in duration, or needs copyright protection; MP4 is suitable for short videos and scenarios requiring extremely high compatibility (no extra player support needed).

Q2: What if HLS live streaming latency is high?

Answer: It can be optimized in the following ways:

  • Shorten video segment duration (e.g., from 10 seconds to 2 seconds)
  • Reduce the number of player buffer segments
  • Adopt Low Latency HLS (LL-HLS) extension
  • For extreme low latency needs (<1s), consider WebRTC or HTTP-FLV

Q3: How to prevent m3u8 videos from being hotlinked and downloaded?

Answer: Common protection measures include:

  • URL Signature: Add timeliness and identity verification parameters to the link
  • AES-128 Encryption: Encrypt video segments, distribute keys via secure channels
  • Referer Check: Restrict playback to specific websites only
  • DRM Solutions: Use commercial-grade protection like FairPlay, Widevine

Q4: Can ordinary users open m3u8 files directly?

Answer: Yes, but a suitable player is required:

  • Mac/iPhone: Safari browser supports it natively, just paste the link to play
  • Windows/Android: Need to use players that support HLS like VLC, PotPlayer
  • Browsers: Chrome/Edge etc. need to use JavaScript libraries like hls.js

Q5: m3u8 produces many small files, does it put a lot of pressure on the server?

Answer: It does produce a large number of small files (a movie may have hundreds or thousands of segments), but it can be optimized by:

  • Using CDN caching to share the load
  • Adopting Byte Range Requests to achieve “pseudo-slicing”
  • Merging multiple small segments into larger blocks
  • Using professional streaming servers (like Wowza, Nginx-RTMP)

Summary: m3u8 is the Cornerstone of Modern Video Streaming

Panorama of Modern Streaming Technology Ecosystem

m3u8 and HLS protocols have become the first choice for video websites because they perfectly balance needs across multiple dimensions:

Compatibility: Covers almost all devices and platforms
User Experience: Adaptive bitrate ensures smooth playback
Scalability: Easily achieve global CDN distribution
Flexibility: Supports both on-demand and live streaming
Security: Provides multi-level content protection mechanisms

Although HLS also has shortcomings such as high latency and fragmentation of small files, with technological evolution (such as Low Latency HLS, CMAF converged format), these problems are gradually being solved.

For content creators and developers, understanding the working principle of m3u8/HLS can help you:

  • Choose the video solution that best suits your business
  • Optimize playback experience and reduce costs
  • Better protect video content copyright

For ordinary users, understanding the technology behind this allows you to know how to troubleshoot when encountering playback problems, and also better appreciate the technical efforts video websites make for a smooth experience.

Next time you smoothly watch Bilibili live streaming or swipe through TikTok videos, you might want to think: behind it, there may be thousands of tiny .ts segments, orderly delivered to your screen under the command of the m3u8 playlist. This is the charm of modern streaming technology!

Author: M3U8Player Team

Related Articles

More articles picked for you about M3U8 streaming