GithubHelp home page GithubHelp logo

wenpeng-song / hls-downloader Goto Github PK

View Code? Open in Web Editor NEW

This project forked from spark-nf/hls-downloader

0.0 0.0 0.0 439 KB

Download HLS streams in NodeJS

License: Apache License 2.0

JavaScript 4.88% TypeScript 95.12%

hls-downloader's Introduction

HLS downloader

NPM version Build Status Code Coverage Project license

About

Downloads a live HLS stream.

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",
});

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.

hls-downloader's People

Contributors

spark-nf avatar wenpeng-song avatar dependabot[bot] avatar brenthoneybone avatar professorpinguino avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.