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

simple-hls

v0.0.1

Published

A Multi-Bitrate Transcoding Library for NodeJS.

Downloads

115

Readme

Simple-HLS

NPM Module is a simple FFMPEG Wrapper that will allow you to easily transcode Multi-bitrate HLS videos.

Installation

Installing FFMPEG

First, you will need to make sure that FFMPEG is installed on your machine, you can do these by utilizing Home Brew:

brew install FFMPEG

If you are utilizing Linux, here is a great article on how to install https://linuxize.com/post/how-to-install-ffmpeg-on-ubuntu-18-04/

If you are using Windows, here is another great article on how to install https://www.wikihow.com/Install-FFmpeg-on-Windows

Installing Simple-HLS

To install Simple-HLS for local development, you simply (pun intended) need to run npm install simple-hls.

Using Simple-HLS

import {Transcoder} from 'simple-hls'

async function transcodeSomething () {
    //Create a new instance of the transcoder
    //First Parameter is the path to the video that you want to transcode
    //Second Parameter is the path to the folder/directory you would like the HLS Files Saved
    //Third Parameter is an optional options object

    const t = new Transcoder(`${__dirname}/test.mp4`, `${__dirname}/path_to_output_directory`, {showLogs: false});
    try {
        const hlsPath = await t.transcode();
        console.log('Successfully Transcoded Video');
    } catch(e){
        console.log('Something went wrong');
    }
    
}

Renditions

Out of the box the outputted renditions are 1080p, 720p, 480p, 360p. However, we do allow for you to supply an array of custom renditions into the options object (if you need more or less). Below is an example on how to supply custom renditions:

    //All fields in each object are REQUIRED... There is no minimum or maximum amount of renditions that you can have.

    const customRenditions = [
         {
        width: 640,
        height: 360,
        profile: 'main',
        hlsTime: '4',
        bv: '800k',
        maxrate: '856k',
        bufsize: '1200k',
        ba: '96k',
        ts_title: '360p',
        master_title: '360p'
    },
    {
        width: 842,
        height: 480,
        profile: 'main',
        hlsTime: '4',
        bv: '1400k',
        maxrate: '1498',
        bufsize: '2100k',
        ba: '128k',
        ts_title: '480p',
        master_title: '480p'
    },
    {
        width: 1280,
        height: 720,
        profile: 'main',
        hlsTime: '4',
        bv: '2800k',
        maxrate: '2996k',
        bufsize: '4200k',
        ba: '128k',
        ts_title: '720p',
        master_title: '720p' 
    },
    {
        width: 1920,
        height: 1080,
        profile: 'main',
        hlsTime: '4',
        bv: '5000k',
        maxrate: '5350k',
        bufsize: '7500k',
        ba: '192k',
        ts_title: '1080p',
        master_title: '1080p'
    }
];
    ]

    const t = new Transcoder(inputPath, outputPath, {renditions: customRenditions});
    try {
        const hlsPath = await t.transcode();
        console.log('Successfully Transcoded Video');
    } catch(e){
        console.log('Something went wrong');
    }

Reporting Bugs

If you have an issues and/or feature requests, please post an issue in the github page.