Downloads a live HLS stream.
hls-downloader [-V] [-h] [-q QUALITY] -o FILE stream_url
hls-downloader -q best -c 5 -o video.mp4 "https://......./stream.m3u8"
You need to have FFMPEG installed, even with the "merge using FFMPEG" feature disabled, as FFMPEG is still used to transmux the merged TS file into an MP4 file.
const download = require("node-hls-downloader").download;
await download({
quality: "best",
concurrency: 5,
outputFile: "video.mp4",
streamUrl: "https://......./stream.m3u8",
});
TypeScript is also supported, with types already provided.
Note: options marked with 🔒 are mandatory.
The URL to the stream (either the master file or a playlist).
Download the stream as a live feed, refreshing the playlist and downloading only new segments. Automatically stops when no new segments are found after a while.
- Default:
false
Merge TS segments using FFMPEG instead of basic concatenation. Not recommended, but you can use it if stuttering issues occur when merging the TS segments.
- Default:
false
Where the TS segments will be stored.
- Default: a temporary directory
Location of the merged TS segments file.
- Default: a temporary file
How many threads to use for downloading segments.
- Default:
1
Stream quality: worst
, best
, or max bandwidth.
* only mandatory if passing a master playlist stream URL
Target file to download the stream to. If it already exists, it will be overwritten.
Headers to use when making HTTP requests. On the CLI, the header argument can be repeated. Format is "Name: value".
The program is licensed under the Apache License 2.0.