npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

node-hls-stream-downloader

v2.2.17

Published

Download HLS streams.

Downloads

25

Readme

NPM version Build Status Code Coverage Project license

About

Downloads a live HLS stream. This is not original repository, but forked from Spark-NF/hls-downloader.

Usage

CLI

hls-downloader [-V] [-h] [-q QUALITY] -o FILE stream_url

Example

hls-downloader -q best -c 5 -o video.mp4 "https://......./stream.m3u8"

Dependencies

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.

API

const download = require("node-hls-downloader").download;

await download({
  quality: "best",
  concurrency: 5,
  outputFile: "video.mp4",
  streamUrl: "https://......./stream.m3u8",
  onStartCallback: () => console.log("Download started"),
  onProgressCallback: (uri) => console.log(`Segment downloaded: ${uri}`),
  onEndCallback: () => console.log("Download finished"),
});

TypeScript is also supported, with types already provided.

Options

Note: options marked with 🔒 are mandatory.

stream_url, streamUrl 🔒

The URL to the stream (either the master file or a playlist).

--live, live

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

--ffmpeg-merge, mergeUsingFfmpeg

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

--ffmpeg-path, ffmpegPath

Path to the FFMPEG binary. Can be useful to target a specific version or install of FFMPEG.

  • Default: ffmpeg

--segments-dir, segmentsDir

Where the TS segments will be stored.

  • Default: a temporary directory

--merged-segments-file, mergedSegmentsFile

Location of the merged TS segments file.

  • Default: a temporary file

-c, --concurrency, concurrency

How many threads to use for downloading segments.

  • Default: 1

-r, --max-retries, maxRetries

How many times to retry when failing to download segments.

  • Default: 1

-q, --quality, quality 🔒*

Stream quality: worst, best, or max bandwidth.

* only mandatory if passing a master playlist stream URL

-o, --output-file, outputFile 🔒

Target file to download the stream to. If it already exists, it will be overwritten.

-h, --header, httpHeaders

Headers to use when making HTTP requests. On the CLI, the header argument can be repeated. Format is "Name: value".

--quiet, logger

In CLI, the quiet flag will disable all output except errors. Using the API, you can provide a logger config, which is either null to disable logging completely, a function taking any number of arguments, or an object with two members, log and error, each being a function taking any number of arguments.

  • Default: false in CLI, console in API

Authors

License

The program is licensed under the Apache License 2.0.