A simple and efficient command-line tool to download and merge video segments from M3U8 playlists.
This tool allows you to download videos from M3U8 playlists (HTTP Live Streaming format). It automatically handles:
- Downloading the M3U8 manifest
- Parsing segment information
- Downloading all video segments
- Merging segments into a single video file using FFmpeg
- Cleaning up temporary files
- Simple command-line interface
- Support for both absolute and relative URLs in playlists
- Progress tracking during download
- Automatic cleanup of temporary files
- Handles HTTP Live Streaming (HLS) format
- Node.js (v22.15.0 or higher)
- FFmpeg (must be installed and available in your PATH)
git clone https://github.com/iaurg/m3u8-downloader.git
cd m3u8-downloader
npm install
chmod +x download-video.js
node download-video.js <m3u8_url> [output_filename]
m3u8_url
(required): URL of the M3U8 playlistoutput_filename
(optional): Name of the output video file (default:output.mp4
)
Download a video and save it as "output.mp4" (default filename):
node download-video.js https://example.com/video.m3u8
Download a video and specify the output filename:
node download-video.js https://example.com/video.m3u8 my-video.mp4
- The script downloads the M3U8 manifest file from the provided URL
- It parses the manifest to extract URLs for all video segments
- Each segment is downloaded to a temporary directory
- FFmpeg is used to concatenate all segments into a single video file
- Temporary files are cleaned up after processing
-
FFmpeg not found: Make sure FFmpeg is installed and added to your system PATH
# Check if FFmpeg is installed ffmpeg -version
-
Permission denied: Make sure the script has executable permissions
chmod +x download-video.js
-
Network errors: Check your internet connection and verify the M3U8 URL is accessible
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- This tool uses FFmpeg for video processing
- Inspired by the need for a simple M3U8 downloader