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 🙏

© 2026 – Pkg Stats / Ryan Hefner

video-hls-converter

v0.0.1

Published

Here’s a detailed README.md for your project, covering its purpose, use case, and usage instructions:

Readme

Here’s a detailed README.md for your project, covering its purpose, use case, and usage instructions:


video-hls-converter

Overview

video-hls-converter is a Node.js/TypeScript library for converting video files into HTTP Live Streaming (HLS) format with multiple quality levels. It leverages fluent-ffmpeg to automate the process of generating HLS segments and playlists, making it easy to prepare videos for adaptive streaming.


Purpose

  • Automate HLS Conversion: Simplifies the process of converting a single video file into multiple HLS streams (different resolutions/bitrates).
  • Multi-Quality Output: Supports a wide range of output qualities, from 120p to 4K, for adaptive streaming.
  • Customizable: Allows you to specify custom resolutions, bitrates, and output folders.
  • Progress Reporting: Provides real-time progress updates for each quality level.

Use Cases

  • Video Platforms: Prepare videos for streaming on web or mobile platforms using adaptive bitrate streaming.
  • Media Servers: Automate video ingestion pipelines for media servers.
  • Developers: Integrate into Node.js applications to offer video upload and streaming features.

How It Works

  1. Input: Provide a video file and specify the desired output folder.
  2. Conversion: The library uses FFmpeg (via fluent-ffmpeg) to transcode the video into multiple HLS streams.
  3. Output: Generates .m3u8 playlists and .ts segment files for each quality, plus a master playlist.
  4. Cleanup (Optional): Can delete the original video after conversion.

Installation

pnpm install video-hls-converter
# or
npm install video-hls-converter

Note: You must have FFmpeg installed and available in your system’s PATH.


Usage

Basic Example

import { VideoConverter } from 'video-hls-converter';

const videoConverter = new VideoConverter('video', 'output');
videoConverter.hlsConvert(
    'input.mp4',
    (progress) => {
        console.log(`Progress: ${progress.percent}% for quality: ${progress.quality}`);
    }
)
.then(() => {
    console.log('Video conversion successful');
})
.catch((error) => {
    console.error('Error during video conversion:', error.message);
});

Constructor Options

new VideoConverter(
    inputFolder: string,         // Folder containing input video
    outputPath: string = "output", // Output folder for HLS files
    inputVideoCleanUp: false | string = false // If true or a string, deletes input after conversion
)

Custom Qualities

You can specify custom quality settings:

const customQualities = [
  { resolution: "640x360", bitrate: "800k", maxrate: "856k", bufsize: "1200k", file: "360p.m3u8", name: "360", segments: "360p_%03d.ts" },
  // ...add more
];

videoConverter.hlsConvert(
  'input.mp4', // file name
  undefined,
  ['360'], // Only convert to 360p
  undefined,
  customQualities
);

API Reference

hlsConvert(inputFileName, progressCallback?, resolutionArray?, video_id?, qualityArray?)

  • inputFileName: Name of the video file in the input folder.
  • progressCallback: Optional function to receive progress updates.
  • resolutionArray: Array of quality names to generate (e.g., ['360', '720']).
  • video_id: Optional unique identifier for output folder.
  • qualityArray: Optional array of custom quality objects.

Output Structure

  • output/{video_id}/
    • master.m3u8 (master playlist)
    • 360p.m3u8, 720p.m3u8, ... (variant playlists)
    • 360p_001.ts, ... (segment files)

Requirements

  • Node.js 18+
  • FFmpeg installed and in PATH

License

MIT