ما هو M3U8؟

دليل عملي لتنسيق M3U8 playlist وبروتوكول HLS streaming.

مقدمة

M3U8 هو تنسيق UTF-8 playlist يستخدمه HLS (HTTP Live Streaming). غالباً لا يحتوي الفيديو نفسه، بل يشير إلى segments و variants و keys و metadata.

قدمت Apple بروتوكول HLS، وهو مستخدم الآن على نطاق واسع في live streaming و VOD عبر المتصفحات والتطبيقات ومنصات OTT.

كيف يعمل M3U8

1. Server segmentation

The server splits a video into short TS or fMP4 segments and writes an M3U8 index file.

2. M3U8 index

The playlist records segment URLs, playback order, duration, variants, and related metadata.

3. Progressive download

The player downloads segments in order and starts playback before the full video is available.

4. Adaptive bitrate

A master playlist can provide multiple qualities, so the player switches according to network conditions.

بنية ملف M3U8

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:10
#EXT-X-MEDIA-SEQUENCE:0
#EXTINF:9.009,
http://media.example.com/first.ts
#EXTINF:9.009,
http://media.example.com/second.ts
#EXTINF:3.003,
http://media.example.com/third.ts
#EXT-X-ENDLIST

#EXTM3U - file header for an M3U playlist

#EXT-X-VERSION - HLS protocol version

#EXT-X-TARGETDURATION - maximum segment duration

#EXTINF - segment duration and URL

#EXT-X-ENDLIST - marks VOD playlist end

M3U8 vs MP4

مزايا M3U8

  • Supports live streaming.
  • Adapts quality to bandwidth.
  • Starts quickly without downloading the full file.
  • Works well with CDN caching.
  • Supports encryption.

قيود M3U8

  • Not ideal for local file playback without an HTTP server.
  • Many files can be harder to manage.
  • Latency can be higher than direct file playback.
  • Older devices may need a compatible player.
  • Saving offline is less simple than MP4.

الاستخدامات الشائعة

Live video

Sports, news, events, and game streams.

VOD platforms

Video sites, online education, and OTT libraries.

Mobile apps

Video playback in phone and tablet applications.

كيفية استخدام M3U8

Online playback

Open a direct M3U8 URL in an HLS-capable player such as M3U8 Player.

Download and save

Use an M3U8 downloader to fetch segments and merge them when you have permission.

Format conversion

Use FFmpeg or a converter to create MP4 from an allowed M3U8 source.

أدوات ذات صلة