Aria2c M3u8 Official
By default, aria2c might name the output file based on the URL, which could result in a file named stream.m3u8.mp4 or just stream.m3u8. You can force a specific filename using the -o flag.
aria2c -o "my_video.mp4" "http://example.com/video/stream.m3u8"
| Tool | Concurrency | Resume | Decryption | Best for | |------|-------------|--------|------------|----------| | aria2c | ✅ Up to 16+ | ✅ | ❌ manual | Speed & large files | | ffmpeg | ❌ Single thread | ✅ | ✅ Built-in | Encrypted streams | | youtube-dl / yt-dlp | ✅ Limited | ✅ | ✅ | Sites with DRM | | wget | ❌ | ✅ | ❌ | Simple scripts |
Verdict: Use aria2c for raw .ts download speed. Combine with ffmpeg for decryption or container conversion.
ffmpeg -f concat -safe 0 -i <(for f in ./video/*.ts; do echo "file '$f'"; done) -c copy final_video.mp4 aria2c m3u8
Note: If the video is encrypted (look for #EXT-X-KEY in m3u8), you'll need the decryption key. Tools like ffmpeg can handle it directly:
ffmpeg -i "https://example.com/stream.m3u8" -c copy video.mp4
But ffmpeg is single-threaded. aria2c downloads fragments faster; then you decrypt with openssl if needed.
Some advanced users pipe through a custom script, but the cleanest "single command" approach uses ffmpeg with aria2c as its downloader via a script: By default, aria2c might name the output file
Create aria2_downloader.sh:
#!/bin/bash
aria2c -x 16 -s 16 -o "$3" "$1"
Then:
ffmpeg -protocol_whitelist file,http,https,tcp,tls,crypto \
-i "stream.m3u8" \
-c copy \
-f mp4 \
-download_protocol "http,https" \
-downloader "./aria2_downloader.sh" \
output.mp4
This tells ffmpeg to delegate chunk downloads to aria2c. Works beautifully, though support varies by ffmpeg build. | Tool | Concurrency | Resume | Decryption
curl -s "https://example.com/video.m3u8" | head -n 20
If you see #EXT-X-STREAM-INF, it's a master playlist. Look deeper for a child m3u8 with higher resolution.
aria2c --max-download-limit=5M -i playlist.txt
Many streaming servers implement "Hotlink Protection." They check the request headers to ensure the request is coming from a legitimate browser, not a script. If you get a 403 error, you likely need to spoof your headers.
You can inspect the "Network" tab in your browser's Developer Tools (F12) to find the User-Agent and Referer headers used by the browser when it played the video.
Example:
aria2c \
--user-agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36" \
--referer="https://example.com/watch-page/" \
-o "video.mp4" \
"http://example.com/video/stream.m3u8"
cd live_vid && cat *.ts > complete.ts