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

generate-subtitles

v1.0.6

Published

Takes media file input to generate .vtt subtile files with support for threads.

Downloads

18

Readme

Generate-Subtitles


To Install

npm i generate-subtitles

Checkout source code at generate-subtitles repo

Description

This package parses video and audio files, to generate .vtt formatted subtitle files. The package is fully asynchronous and adds support for threads flag to run on lower powered systems complemented by file system support.

The package is built upon


Usage


Note- To run the script for first time the package needs to download the model which is then saved in /node_modules/generate-subtitles/lib/whisper.cpp/models

To do that, run

npx generate-subtitles download

and select an appropriate model.

Usage as modules
  • Import generate function from the package.
import { generate } from "generate-subtitles";
  • Now make the options data.
const options = {
    //required- where file must be placed
    inputFile: '/path/to/the/file', 
    //optional- when not specified, it saves at the input Dir
    outputDir: '/path/to/the/dir',
    //required- (enum)Valid inputs are only 'audio' and 'video'
    inputType: '/type_of_input(audio/video)',
    //required
    whisperFlags: {
        //not required- currently supports vtt only
        subFormat: 'vtt',
        //required- default model is base
        model: 'model_name',
        //not required- when using a multilingual model
        //default-english
        language: 'language_name',
        //not required- no of threads to run the model
        //default- 7
        threadCount: number,
    }
}
  • Pass it to the function, which then outputs the .vtt file to output directory, with same name as input file.
try {
    const getSubtiles= await generate(options);
    //resolves with true
    //An output file is generat
} catch(error) {
   // rejects with an error
}

Miscellaneous
  • When using audio input file, it requires .wav format at 16KHz frequency

  • In windows based system, make(Make for Windows).


Changelogs

@1.0.6

  • Fix: Language had an error, where it took input as model name. @1.0.5

  • Fix: removed redundant check input.

  • Fix: OutputDir takes a filename, and outputs to that file.

  • Fix: removed unecessary lower case checks.

    Acknowledgements

  • [Openai-whisper](Introducing Whisper)

  • Whisper.cpp

  • whisper-node