Technical Guides

What Is M3U8? How the HLS Playlist Works, How to Open It and Convert It to MP4

An M3U8 file contains no video at all. It is a short text file that tells the player which pieces of video to download and in what order. This is what is inside, how to play one and how to turn a stream you own into an MP4.

The short answer

An M3U8 file is a plain-text playlist, encoded in UTF-8, that describes an HLS stream (HTTP Live Streaming, the protocol published as RFC 8216). It holds no video. It lists small media segments, usually a few seconds each, and the player downloads them one after another. That is why the file is tiny while the stream behind it can run for hours.

When a TV operator, an OTT app developer or a client asks for "the M3U8 URL of your channel", they want the entry point of your HLS stream: the address their player opens to start pulling segments. It is usually the first technical detail a channel shares when it closes a distribution deal.

One clarification, because the same extension also shows up in IPTV apps as a list of channels. This guide covers the M3U8 that a streaming origin generates from your own signal. XtreamCast does not sell, host or support channel lists: we run the servers that let a rights holder deliver its own feed.

The M3U8 format: what the file looks like inside

Open an M3U8 file in any text editor and you will see something like this, a live media playlist with 6-second segments:

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:6
#EXT-X-MEDIA-SEQUENCE:18422
#EXTINF:6.000,
segment_18422.ts
#EXTINF:6.000,
segment_18423.ts
#EXTINF:6.000,
segment_18424.ts

Every line that starts with #EXT is a tag. The other lines are segment addresses, either relative to the playlist or full URLs. These are the tags you will meet first:

TagWhat it tells the player
#EXTM3UThis is an extended M3U playlist. It must be the first line.
#EXT-X-TARGETDURATIONThe maximum segment length in seconds. No segment, once rounded, may be longer.
#EXT-X-MEDIA-SEQUENCEThe number of the first segment in the list. On a live stream it keeps climbing as the origin adds new segments and drops old ones.
#EXTINFThe duration of the segment on the next line.
#EXT-X-ENDLISTNo more segments will be added, so the playlist is a finished video. If the tag is missing, the player treats the stream as live and keeps reloading the playlist.

The segments themselves are MPEG-TS files (.ts) or fragmented MP4. The specification also allows packed audio and WebVTT subtitles.

As for M3U vs M3U8: M3U is an older playlist format from desktop music players, and M3U8 is the same idea with UTF-8 encoding. RFC 8216 requires every playlist to be recognizable by a path ending in .m3u8 or .m3u, or by the HTTP content type application/vnd.apple.mpegurl (audio/mpegurl is also accepted). If you serve playlists from your own web server, configure that content type so every player recognizes the file.

Master playlist and media playlist: why one stream has several qualities

The example above is a media playlist: it lists the segments of a single quality. Most professional streams add a level on top, the master playlist (Apple's current documentation calls it the multivariant playlist), which lists every quality available:

#EXTM3U
#EXT-X-STREAM-INF:BANDWIDTH=5000000,RESOLUTION=1920x1080
1080p/playlist.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=2500000,RESOLUTION=1280x720
720p/playlist.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=1200000,RESOLUTION=854x480
480p/playlist.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=400000,RESOLUTION=426x240
240p/playlist.m3u8

The player reads that list, picks a quality and moves up or down as the viewer's connection changes, without stopping playback. That is adaptive bitrate streaming (ABR). Every EXT-X-STREAM-INF line must declare its BANDWIDTH; RESOLUTION is optional but recommended for video, and the specification asks for CODECS as well. The values above are an example ladder: in a real playlist, the packager writes the actual bitrate of each quality.

The URL you hand to an app or a smart TV should be the master playlist, so every screen gets the quality its connection can sustain. On XtreamCast, XtreamTranscoder, our adaptive bitrate add-on (USD 20/month), passes your original quality through untouched and adds 720p, 480p and 240p with aligned keyframes: four qualities when your source is 1080p.

Where an M3U8 comes from: your encoder and the origin

Nobody writes an M3U8 by hand. A streaming origin generates it from the signal your encoder sends and rewrites it every few seconds while you are live. On an XtreamCast streaming server the path looks like this:

  1. Contribution. Your encoder (OBS, vMix, Wirecast, LiveU Solo or FFmpeg) sends the signal over RTMP or SRT.
  2. Packaging. The origin assigned to your channel, in Chile or North America, cuts the signal into segments that start on a keyframe and publishes the playlist for each quality.
  3. Delivery. Your website player, apps and smart TVs download the master playlist and the segments over HTTPS.

A few encoder settings show up directly in the playlist:

SettingRecommendationWhy it matters
Keyframe interval2 seconds, fixedEach segment must start on a keyframe. An irregular GOP produces uneven segments and visible jumps when the player switches quality.
Video codecH.264Browsers, smart TVs, apps and set-top boxes decode it natively.
AudioAAC stereoThe audio codec every HLS player expects.
BitrateConstant (CBR), with headroom on your uploadA contribution without dropouts becomes a playlist without missing segments.

These values line up with Apple's HLS authoring specification, which recommends a keyframe every two seconds and 6-second segments. In the XtreamCast panel, the ingest diagnostics show protocol, codecs, keyframe interval, fps and bitrate every 10 seconds, so you can check the signal before you hand the URL to anyone.

Why an M3U8 stream runs behind real time

Segments explain the delay. RFC 8216 tells players not to start closer than three target durations from the end of a live playlist, so with 6-second segments a viewer starts at least 18 seconds behind the newest segment. Our player goes further on purpose and keeps about 30 seconds of margin, which absorbs network drops before the viewer notices them.

When the delay matters, there are two per-channel add-ons: LL-HLS, which uses partial segments and brings the delay down to about 3 seconds, and WebRTC playback, at up to 0.3 seconds, built for auctions, classes and interactive groups. We compare the three options in low-latency streaming: WebRTC, LL-HLS and HLS.

How to open an M3U8 file or link

An M3U8 player is simply a player that understands HLS. These are the quickest ways to open one:

  • VLC. On Windows or Linux, go to Media, Open Network Stream (Ctrl+N) and paste the URL. On a Mac, use File, Open Network. VLC can also open a downloaded .m3u8 file, but only if the segments it lists are still reachable.
  • Safari. Paste the link in the address bar. Safari plays HLS natively on Mac, iPhone and iPad.
  • Chrome and Edge. Desktop versions released since late 2025 play an .m3u8 link natively as well. Older versions download it as a text file.
  • Websites. To behave the same in every browser, most web players rely on hls.js, an open-source JavaScript library that plays HLS through the browser's Media Source Extensions.
  • Apps. AVPlayer on iPhone, iPad and Apple TV plays HLS natively, and so does Media3 ExoPlayer on Android.

When a link does not play, the symptom usually points to the cause:

What you seeLikely causeWhat to check
404 Not FoundThe stream is not live: an origin usually publishes a live playlist only while the encoder is sendingStart the encoder and reload
403 Forbidden, or it played and then stoppedAn expired token, a blocked country or a domain restrictionAsk whoever runs the stream for a fresh link
Plays in VLC, fails on your web pageMissing CORS headers, or an http:// playlist on an https:// pageServe the stream over HTTPS, with CORS that allows your domain

Where to find the M3U8 URL of your own stream

On XtreamCast, the HLS URL of each channel is in the Share Streaming tab of the panel, next to the player URL and the SRT playback URL. On other platforms, look for "HLS URL" or "playback URL"; some only expose an embed code. To see what your own website player is loading, open the browser's developer tools, go to the Network tab and filter by m3u8: the first request is usually the master playlist.

If your channel uses SecureToken, the URL carries a token with a configurable duration and a copied link stops playing when it expires. That is intended: agree with each app or partner how long their link should last.

How to convert M3U8 to MP4 with ffmpeg

This is for streams you own or hold the rights to: your own channel, an event you produced for a client, a broadcast you need to archive. ffmpeg reads the playlist, downloads the segments and joins them into a single file:

ffmpeg -i "https://example.com/live/playlist.m3u8" -c copy -movflags +faststart output.mp4
  • -c copy copies the H.264 video and the AAC audio as they are, without re-encoding. It loses no quality and is limited mostly by your download speed.
  • -movflags +faststart moves the file index to the beginning, so the MP4 starts playing on the web before it finishes downloading.
  • Older tutorials add -bsf:a aac_adtstoasc. Current ffmpeg builds apply that audio conversion on their own when the output is MP4.
  • With a finished playlist, one that ends in #EXT-X-ENDLIST, ffmpeg downloads everything and stops. With a live one, it records from the moment you start until you press q; add -t 01:00:00 to stop after one hour.

Streams protected with DRM cannot be copied this way. And if the stream runs on XtreamCast, you do not need ffmpeg at all: Recording Cloud records each broadcast in the cloud as an MP4, in blocks of up to 12 hours, ready to download or to publish in your OnDemand library. It is included in paid video plans.

How a channel protects its M3U8 URL

An open M3U8 URL can be copied and played anywhere. If your signal has territorial rights or commercial value, combine these layers:

LayerWhat it doesWhat it covers
SecureTokenRequires a token with a configurable duration: a copied URL stops working when it expiresHLS, LL-HLS, WebRTC and SRT
Country geoblockingAn allow list or a block list of countries that you edit in the panelPlayback outside the territories where you hold rights
ShieldPowerLets the embedded player load only on the domains you authorizeYour website player; SecureToken covers the direct URL
Two-step verification and collaboratorsTOTP codes with backup codes, and per-section permissions for your teamAccess to the panel and to the channel credentials

The usual setup for a channel with territorial rights is SecureToken on every output, an allow list with the contracted countries and ShieldPower on its own website. Each layer is described in streaming security: tokens, geoblocking and allowed domains.

How a TV channel delivers its feed: M3U8 for apps, SRT for cable

A professional channel rarely has a single destination. The same input feeds several outputs, each in the format its receiver expects:

DestinationFormatWhat you hand over
Your websiteHLSPlayer Advance™ with your brand, embedded in your page, with VAST pre-roll, mid-roll and post-roll ads
OTT apps and smart TVsHLSThe channel's master M3U8 URL, protected with SecureToken
Cable operators, headends and IRDsSRTOne srt:// URL per channel; the operator's receiver connects as caller
Social networksRTMP or RTMPSRestream to up to 30 destinations at once on paid video plans

For a cable operator, SRT is the natural route: it recovers the packets lost on the way and reaches the headend as a continuous signal, with no player involved. HLS and SRT outputs are both included in paid video plans; this is how SRT delivery to cable operators works. Radio Hoy, for example, sends its Hoy TV signal to cable operators from our Chile origin while XtreamTranscoder feeds its website; that setup and others are in our case studies.

A channel that delivers to operators also delivers its programming data, which we cover in what EPG and XMLTV are. If your channel does not exist yet, start with how to create an online TV channel.

An M3U8 URL for your own channel

Your encoder sends RTMP or SRT. On paid video plans, XtreamCast delivers HLS to your website, apps and smart TVs and SRT to cable operators, from origins in Chile and North America.