Skip to content

How to Merge M3U8 to MP4 — 4 Complete Methods for 2026 (Online, FFmpeg, VLC, and More)

M3U8 is the world's most common streaming format — but it is not a video file you can simply double-click and keep. It is a playlist pointing to dozens or hundreds of small .ts segment files scattered across a CDN. To get a self-contained, portable MP4 you can store, edit, or play offline, you need to fetch all the segments and merge them.

This guide covers four complete, tested methods — from the simplest one-click browser tool to advanced FFmpeg command-line options — including how to handle AES-128 encryption and multi-bitrate master playlists.

WARNING

This guide covers scenarios where you own the content or have legal authorization to process it. Always verify your rights before converting third-party video content.

Why You Need to "Merge" M3U8 — Not Just Download It

When you encounter an M3U8 stream, what you have is a text index file that looks like this:

text
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:10
#EXTINF:9.0,
https://cdn.example.com/seg_000001.ts
#EXTINF:9.0,
https://cdn.example.com/seg_000002.ts
#EXTINF:9.0,
https://cdn.example.com/seg_000003.ts
#EXT-X-ENDLIST

A 1-hour video might reference 360+ individual .ts files. Standard download managers grab the index file (a few KB of text) and stop — they never fetch the actual video data. A proper merge tool must:

  1. Parse the M3U8 playlist to extract all segment URLs.
  2. Download every .ts segment (in parallel for speed).
  3. Decrypt segments if AES-128 encryption is used.
  4. Concatenate the raw streams.
  5. Remux the result into an MP4 container.

Here is a visual overview of the process:

M3U8 to MP4 Conversion Process

M3U8 vs. MP4 — When to Convert

FactorM3U8 / HLSMP4
StorageMultiple files (index + segments)Single file
PortabilityRequires all segments + playlistSelf-contained
StreamingOptimized for adaptive deliveryWorks with progressive download
Editing softwareRarely supportedUniversally supported
Offline playbackDepends on local segment pathsAlways works
File managementComplexSimple

Convert when you need a file you can edit, archive, share, or play on any device without an internet connection.

The M3U8 to MP4 Converter runs entirely inside your browser using WebAssembly. Nothing is uploaded to any server — your computer fetches the segments, decrypts them if needed, and merges them locally.

Step 1: Open the tool and paste your M3U8 URL

Visit M3U8 to MP4 Converter and paste your M3U8 link into the URL field. Click Parse.

Step 2: Select quality (for master playlists)

If your URL is a master playlist, the tool will display all available quality levels (e.g., 360p, 720p, 1080p) with bitrate information. Select your preferred quality.

Step 3: Configure download options (optional)

  • Multi-thread mode: Enables parallel segment downloads — significantly faster for large videos. Recommended for most users. Note that very aggressive servers may rate-limit multi-threaded requests; disable if you see fetch errors.
  • Thread count: Adjust based on your network. 4–8 threads is a good default.

Step 4: Start conversion and save

Click Start Conversion. Progress is shown segment by segment. When complete, click Save to download your MP4 file.

What this tool handles:

  • Standard VOD and event M3U8 streams
  • AES-128 encrypted streams (automatically fetches the decryption key)
  • Multi-bitrate master playlists with quality selection
  • Large files (tested up to 4GB on Chrome/Windows with sufficient RAM)

Limitations:

  • DRM-protected streams (Widevine, FairPlay, PlayReady) cannot be converted
  • Very large files on iOS/Safari may cause browser memory crashes — use PC Chrome for files over 500MB

Method 2: FFmpeg (Command Line — Most Flexible)

FFmpeg is the gold standard for video processing. It handles M3U8 conversion natively, including AES-128 decryption.

Basic conversion (stream copy — lossless, fast):

bash
ffmpeg -i "https://cdn.example.com/stream.m3u8" -c copy output.mp4

The -c copy flag tells FFmpeg to copy video and audio streams without re-encoding, preserving original quality and running much faster.

If you get an audio error (Could not write header for output file #0 or ADTS-related errors):

bash
ffmpeg -i "https://cdn.example.com/stream.m3u8" -c copy -bsf:a aac_adtstoasc output.mp4

AES-128 encrypted M3U8:

FFmpeg handles AES-128 decryption automatically. As long as the #EXT-X-KEY URI is publicly accessible, no extra flags are needed:

bash
ffmpeg -i "https://cdn.example.com/encrypted-stream.m3u8" -c copy output.mp4

If the key requires authentication headers (e.g., cookies or a token), you need to provide them:

bash
ffmpeg -headers "Cookie: session=abc123" \
       -i "https://cdn.example.com/encrypted-stream.m3u8" \
       -c copy output.mp4

Choosing a specific quality from a master playlist:

First, open the master playlist in a text editor or browser and find the media playlist URL for your desired quality. Then pass that URL directly to FFmpeg:

bash
ffmpeg -i "https://cdn.example.com/1080p/index.m3u8" -c copy output.mp4

Re-encoding (for compatibility or size reduction):

bash
ffmpeg -i "https://cdn.example.com/stream.m3u8" \
       -c:v libx264 -crf 22 -preset fast \
       -c:a aac -b:a 128k \
       output.mp4

-crf 22 controls quality (lower = better quality, larger file). 18 is near-lossless; 28 is smaller but noticeably lower quality.

FFmpeg strengths over online tools:

  • Full control over encoding parameters
  • Can handle streams that require custom HTTP headers
  • Suitable for batch processing and automation scripts
  • No browser memory limits — can handle very large or long streams

Method 3: VLC Media Player — Convert/Save Stream Feature

VLC can play M3U8 streams and simultaneously save them as MP4 without re-encoding.

Steps:

  1. Open VLC → Media → Convert/Save (Ctrl+R).
  2. Click the Network tab.
  3. Paste your M3U8 URL.
  4. Click Convert/Save (not Play).
  5. In the Convert dialog: set Profile to Video - H.264 + MP3 (MP4).
  6. Set Destination file to your desired output path.
  7. Click Start.

When to use VLC for conversion:

  • You already have VLC installed and prefer a GUI.
  • The stream is a local M3U8 file with relative segment paths.
  • You want a no-code solution on macOS (where FFmpeg setup can be more involved).

VLC limitation: Conversion speed depends entirely on real-time playback speed — a 2-hour stream takes approximately 2 hours to save. FFmpeg and online tools are much faster.

Method 4: yt-dlp (Advanced — Handles Token-Protected Streams)

yt-dlp is a command-line tool that wraps FFmpeg and adds sophisticated header/cookie management. It is particularly useful for streams that require browser cookies or custom Referer headers.

bash
yt-dlp "https://example.com/video-page-url" -o output.mp4

For direct M3U8 URLs:

bash
yt-dlp --add-header "Referer: https://example.com" \
       "https://cdn.example.com/stream.m3u8" \
       -o output.mp4

yt-dlp automatically selects the best quality from master playlists. Use -f "bestvideo+bestaudio" to be explicit.

Handling Common Conversion Problems

ProblemCauseSolution
Converted file is only a few KBSaved the index file, not the videoUse a dedicated M3U8 merger tool
403 Forbidden during segment downloadHotlink protection / expired tokenRe-capture the M3U8 URL; it has a time-limited token
"Cannot decrypt" or "Invalid key" errorAES-128 key URL requires authenticationPass session cookies via headers in FFmpeg or yt-dlp
Audio/video out of sync in outputTimestamp discontinuity in source segmentsAdd -async 1 to FFmpeg command
Browser tab crashes during conversionMemory limit exceeded (iOS/Safari)Switch to Chrome on PC for large files
DRM error — cannot convertWidevine/FairPlay/PlayReady protectionCannot be converted; content is license-locked

Summary

MethodBest ForInstallationSpeed
Online converterQuick, no-install, AES-128NoneFast (parallel)
FFmpegFull control, large files, scriptingRequiredVery fast
VLC ConvertGUI users, local filesRequiredReal-time only
yt-dlpToken/cookie-protected streamsRequiredFast

For most users who need a one-time conversion without setting up a development environment, the M3U8 to MP4 Converter is the fastest path from URL to local MP4 file.

For developers, automation workflows, or streams with authentication requirements, FFmpeg combined with yt-dlp provides the highest flexibility.

Last updated: