Tutorial · HLS · AES-128
How to Download Encrypted M3U8 Video (AES-128) in 2026
A practical, no-fluff guide to saving AES-128 encrypted HLS streams. Three tested methods, ranked from easiest to most technical, with the legal context most articles skip.
Most M3U8 downloaders work great until they meet an encrypted stream. The progress bar stalls at 0 percent, ffmpeg spits a "Cannot load X-Key" error, the online converter returns a corrupt file. The frustrating part is that the encryption used by 90 percent of these streams is not actually meant to lock the content to a single device. It is a transport layer that any compliant tool can read, if you know what to look for.
This guide covers the three methods that consistently work in 2026, in the exact order I would recommend. We focus on legitimate use cases: downloading your own content, archiving courses you have legally purchased, saving videos you have explicit permission to back up. We do not cover DRM bypass and we do not pretend to. The distinction matters, and most articles glossing over it are misleading.
1. What encrypted M3U8 actually means
An M3U8 file is a plain-text playlist used by HTTP Live Streaming (HLS), the protocol Apple created in 2009 and that now powers most adaptive video on the web. A regular HLS stream lists video segments (typically .ts or .m4s files) one per line, and the player downloads them in order to reconstruct the video. If you have never opened one, our M3U8 explainer walks through the format end to end.
An encrypted M3U8 looks almost identical, but it includes a tag that tells the player how to decrypt the segments before playback:
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:10
#EXT-X-KEY:METHOD=AES-128,URI="https://cdn.example.com/keys/abc.key",IV=0x1a2b...
#EXTINF:9.96,
segment-001.ts
#EXTINF:9.92,
segment-002.ts
...
The #EXT-X-KEY line is the heart of the matter. It tells any HLS-compliant player three things: the encryption method (almost always AES-128 in CBC mode), the URL of the key file (a 16-byte binary blob), and an optional initialization vector. With those three pieces, the player decrypts each segment in memory and feeds the decoded bytes to the video codec.
The crucial detail: the key URL is delivered alongside the video. It is fetched over plain HTTPS, often without any special authentication beyond the same session that loaded the page. That means any compliant downloader can fetch the key the same way. This is by design. AES-128 in HLS is meant to prevent casual hotlinking and segment scraping, not to lock the video to a single device. That second job belongs to DRM, which is an entirely different system that we cover later.
2. Why most downloaders fail on encrypted streams
If the standard tools fail on encrypted M3U8, it is for one of three reasons, each of which has a fix:
The tool ignores the EXT-X-KEY line
Many free downloaders, especially the browser extensions that have not been updated in two years, treat every M3U8 as if it were unencrypted. They concatenate the segments as raw bytes and produce an MP4 the codec cannot decode. The output looks like a video file but plays as static. This is the single most common cause of "I downloaded the M3U8 but it does not play".
The tool cannot fetch the key
The key URL often sits behind the same authentication wall as the video itself. If the tool runs outside your browser session (a command-line script with no cookies, a remote online converter), the key request returns 403 Forbidden and the download fails immediately. Browser extensions sidestep this entirely because they run inside the session that already loaded the player.
The tool ignores the Referer header
Some CDNs require a specific Referer on segment requests, even when the segment URLs are pre-signed. Without it, you get random 403 errors mid-download, usually around 30 to 50 percent. The fix is to forge the header, which extensions do automatically through Chrome's declarativeNetRequest API and which command-line tools require explicit configuration for.
3. Method 1: Browser extension (recommended)
A browser extension running inside your active session is the path of least resistance. It inherits cookies, headers, and the AES key automatically. You click once, the extension does the work, you get a single MP4 file at the end. No command line, no manual key extraction, no header forging.
Step-by-step with Vidora
- Install Vidora from the Chrome Web Store. It runs on Chrome, Edge, Brave, and any Chromium-based browser.
- Open the page that hosts the encrypted video. Press play once so the browser fetches the M3U8 manifest and the AES key. Without play, the player has not pulled either yet.
- Click the Vidora icon in your toolbar. The encrypted stream appears in the popup, with the available quality renditions detected automatically.
- Pick a quality and click Download. Vidora fetches every segment, decrypts each one with the correct AES key, muxes audio and video, and writes a single MP4 to your Downloads folder.
For a 30-minute 1080p encrypted stream, the whole process usually takes two to four minutes on a regular connection. Vidora downloads up to six segments in parallel, which is faster than ffmpeg's default sequential mode but slower than yt-dlp's tuned concurrency.
Why this method wins
- The AES key is fetched inside your authenticated session, with the same cookies the player used. Auth never breaks.
- Decryption happens in memory, segment by segment. The output MP4 is plaintext and ready to play.
- The Referer header is forged transparently using Chrome's declarative net request rules. No 403 errors mid-download.
- Vidora supports AES-128 only, which is the format used by 90 percent of encrypted HLS in the wild. SAMPLE-AES is also supported on platforms that use it.
4. Method 2: ffmpeg with the extracted key
If you cannot or will not install an extension, ffmpeg can download and decrypt an HLS stream natively, as long as you give it the key URL or the key file directly. The catch is that ffmpeg cannot extract the key from your authenticated session by itself. You have to feed it.
Step-by-step manual extraction
- Open the page in Chrome and start playback so the browser fetches the playlist.
- Open DevTools (F12), switch to the Network tab, and filter by
m3u8. We have a full DevTools tutorial if this part is unfamiliar. - Right-click the playlist request and Copy as cURL. This captures the URL plus every header, including cookies and Referer.
- Paste the cURL command into your terminal, but replace
curlwithffmpeg -headersformatted with each captured header. The full command looks like this:
ffmpeg \
-headers $'Referer: https://source.example.com/\r\nCookie: session=abc123\r\n' \
-i "https://cdn.example.com/playlist.m3u8" \
-c copy \
output.mp4
The -c copy flag tells ffmpeg to mux the segments without re-encoding. This keeps the original bitrate and is fast. ffmpeg fetches the EXT-X-KEY URL itself, decrypts each segment in memory, and writes a clean MP4. Documentation for the flags lives on the official ffmpeg site.
When ffmpeg is the right choice
- You are working on a server or a system without a Chromium browser available.
- You need to script the download (cron job, batch processing, CI pipeline).
- You want full control over codec, bitrate, or container output.
When ffmpeg breaks
- The key URL requires JavaScript-derived headers (rare but seen on a few enterprise platforms).
- Cookies expire mid-download. ffmpeg does not refresh them.
- The playlist uses SAMPLE-AES with byte-range fragments, which older ffmpeg versions handle poorly.
5. Method 3: yt-dlp for advanced users
yt-dlp is the spiritual successor to youtube-dl and supports AES-128 HLS out of the box. It is the most flexible of the three options and the only one that handles certain edge cases like rotating keys (where each segment uses a fresh key).
yt-dlp \
--add-header "Referer: https://source.example.com/" \
--cookies-from-browser chrome \
-o "%(title)s.%(ext)s" \
"https://source.example.com/video-page"
The flag --cookies-from-browser chrome is the killer feature here: yt-dlp pulls cookies straight from your Chrome profile, which means private streams that require login work without manual cURL extraction. The output filename template uses the video's actual title rather than a generic name.
yt-dlp's main downsides: the syntax has a learning curve, releases sometimes lag behind site changes by a week or two, and Windows users often hit antivirus false positives because the executable is unsigned by default.
6. Common errors and how to fix them
Error: "Cannot load X-Key file" or "Failed to fetch key"
The key URL needs the same Referer or cookie that the original playlist request used. Open DevTools, find the .key request, and copy its full headers. Pass them to ffmpeg with -headers or to yt-dlp with --add-header.
Error: "Output file is corrupted" or "plays as static"
You used a tool that ignored the EXT-X-KEY tag and wrote the encrypted segments straight to disk. Switch to a tool that decrypts (Vidora, ffmpeg, yt-dlp) and re-download. There is no recovery path: the encrypted bytes you saved cannot be turned into video without the key applied at fetch time.
Error: "Download stalls between 80 and 95 percent"
A handful of segments returned 403 Forbidden because the auth token expired mid-download. Replay the source page so the cookie refreshes, then restart. Some platforms rotate tokens every 10 minutes regardless of activity. Your download must complete inside that window.
Error: "Audio is silent in the output MP4"
The downloader fetched only the video stream and ignored the separate audio playlist. Encrypted master playlists almost always have separate audio and video renditions. Make sure your tool muxes both: ffmpeg with -c copy handles it natively, Vidora handles it transparently. yt-dlp users should add --merge-output-format mp4.
Error: "Output is much larger than the source"
The downloader re-encoded the video instead of muxing the original streams. Use -c copy with ffmpeg, the --no-recode flag with yt-dlp, or any tool that skips re-encoding (Vidora muxes streams as-is).
7. AES-128 vs DRM: the legal nuance
Most articles on this topic skip this section because it is uncomfortable. We will not. The single most important distinction in encrypted HLS is the difference between AES-128 transport encryption and content DRM, and that distinction has direct legal implications.
AES-128 in HLS is part of the open HLS specification (RFC 8216). The key travels alongside the video and any HLS-compliant player can read it: VLC, mpv, Safari, hls.js, ffmpeg, yt-dlp. By itself, AES-128 is not a copy protection measure under the DMCA or the EU Copyright Directive. Reading it does not constitute "circumvention of a technological protection measure" because the key is delivered with the content. Many lawyers, including the EFF, have argued this point repeatedly.
DRM (Widevine, FairPlay, PlayReady) is fundamentally different. The key is sealed inside a hardware-backed Content Decryption Module on the playback device and is never exposed to user code. Bypassing DRM almost always involves circumventing a technological protection measure, and that is illegal in most jurisdictions. Vidora does not bypass DRM. ffmpeg does not bypass DRM. yt-dlp does not bypass DRM. None of the methods in this article work against Netflix, Disney Plus, or Prime Video.
The practical guide:
- Generally safe: downloading your own uploads, content you have legitimately purchased (most online courses, Vimeo Pro, Bunny Stream), public-domain content, content under permissive Creative Commons licenses, content where the creator gave explicit permission.
- Generally not safe: downloading copyrighted material to redistribute, bypassing paywalls on content you have not paid for, mass-archiving for resale.
- Always illegal: bypassing DRM. None of the tools here do this.
Vidora is technology, not legal advice. The legal responsibility for any download rests with you and depends on your jurisdiction, the content's license, and how you intend to use the file. When in doubt, ask the rights holder.
8. Frequently asked questions
What does encrypted M3U8 mean?
It is an HLS playlist whose video segments are encrypted with AES-128 (or AES-SAMPLE-AES). The playlist contains an EXT-X-KEY tag pointing to a key file. Any compliant player downloads the key, decrypts each segment in memory, and plays the video. The encryption is part of the open HLS specification and is not the same thing as DRM.
Is downloading an encrypted M3U8 legal?
It depends on the content. AES-128 is a transport layer, not a copyright signal. Downloading your own video, a course you legitimately purchased, or content you have explicit permission to save is generally legal. Downloading copyrighted material you have no right to redistribute is not. The legal responsibility rests with you, not with the tool.
What is the difference between AES-128 and DRM?
AES-128 in HLS delivers the key alongside the video, often over plain HTTPS, and any compliant player can read it. DRM (Widevine, FairPlay, PlayReady) seals the key inside a hardware-backed Content Decryption Module that user code cannot reach. Vidora, ffmpeg, and yt-dlp can all handle AES-128. None of them bypass DRM, by design.
Why does my download fail with "Cannot load X-Key"?
The key URL needs authentication, a Referer header, or both. Browser extensions handle this automatically because they run inside your authenticated session. With ffmpeg or yt-dlp, capture the headers from DevTools (Right-click, Copy as cURL) and pass them with -headers or --add-header.
Can I play an encrypted M3U8 without downloading it?
Yes. Any HLS-compliant player will fetch the key transparently and play the stream: VLC, mpv, hls.js, native Safari, or the player on the source page. AES-128 in HLS is designed to make casual scraping harder, not to lock playback to a single device.
Does Vidora bypass DRM-protected streams like Netflix?
No. Vidora handles AES-128 HLS, which is part of the open HLS specification. It never bypasses DRM. Netflix, Disney Plus, Prime Video, and other premium services use Widevine or FairPlay, and no Chrome extension can legitimately download those streams.
About the author
RGC Digital LLC builds Vidora, a Pro video downloader Chrome extension for Vimeo, Bunny.net, HLS streams, and MP4. Based in Albuquerque, NM. We write about video tooling, streaming protocols, and Chrome extension engineering.