Aria2c M3u8 · Instant & Trusted
Many streams require authentication. Save headers to a file (headers.txt):
Referer: https://example.com/video-page
User-Agent: Mozilla/5.0 ...
Cookie: sessionid=abc123
Then use:
aria2c --header="Referer: https://example.com" \
--header="Cookie: sessionid=abc123" \
-i segment_list.txt -j 16
For a fully automated approach, use this script: aria2c m3u8
#!/bin/bash
M3U8_URL="$1"
OUTPUT_NAME="video"
aria2c saves a control file (.aria2). Just rerun the same command; it resumes automatically.
First create a file list for ffmpeg:
for f in ./ts_segments/*.ts; do echo "file '$f'" >> merge.txt; done
Then merge:
ffmpeg -f concat -safe 0 -i merge.txt -c copy output.mp4
You now have a single MP4 file.
After downloading seg_001.ts, seg_002.ts, …, merge them:
# On Linux/macOS
cat ./video/*.ts > output.ts
rm -rf ./segments