Code Monkey home page Code Monkey logo

keshav2003garg / quality-subs-generator Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 51 KB

Generate high-quality subtitles for your videos effortlessly! This npm package combines the power of ffmpeg and the advanced Whisper model to provide a seamless solution for converting videos into different quality formats with accurate subtitles.

Home Page: https://www.npmjs.com/package/quality-subs-generator

License: MIT License

JavaScript 5.01% Dockerfile 5.61% TypeScript 89.05% Shell 0.33%
docker npm-package video-pro

quality-subs-generator's Introduction

Quality Subs Generator

Effortlessly generate high-quality subtitles for your videos using the "quality-subs-generator" npm package. This powerful tool combines the capabilities of ffmpeg and the advanced Whisper model, providing a seamless solution for converting videos into various quality formats with precise subtitles.

Installation

Install the package easily using npm or Yarn:

Using npm

npm install quality-subs-generator

Using Yarn

yarn add quality-subs-generator

Usage

This package utilizes Docker for all processing, ensuring a hassle-free experience for users. You only need Docker; no need to deal with the tedious installation of components like the Whisper model, ffmpeg binaries, etc. The isolated environment also reduces the risk of system crashes.

During the initial run, the package will build a Docker image. This process includes heavy installations, such as ffmpeg, the OpenAI-Whisper model, transcription models, Node.js runtime, and more. Please note that it may take some time (approximately ~30 minutes) depending on internet speed and system resources, resulting in an image size of around ~10GB. Subsequent video processing will not rebuild the image; they will directly run a container.

Note: If you change modelName in whisperOptions, the image will rebuild. However, if you haven't deleted the Docker image created for building the required image, only the model downloading stage will run. In case you delete the image, the entire build process will restart. It's essential to note that after each change in modelName, new images will be created, but they won't consume significant space.

Example

import startProcessing from 'quality-subs-generator';

const processVideoWithSubtitles = async () => {
    try {
        await startProcessing({
            inputVideoPath: `${process.cwd()}/input/video.mp4`,
            outputDirectory: `${process.cwd()}/output`,
            qualities: ['144'],
            logs: true,
            imageBuildOptions: { logs: true },
            whisperOptions: { outputFormat: 'srt', modelName: 'tiny' }, // Default output format is srt, and the default model is 'tiny'
        });
        console.log('Service finished');
    } catch (error) {
        console.error(error);
    }
};

processVideoWithSubtitles();

Dependencies

Contributing

We welcome contributions! Feel free to contribute by raising issues or submitting pull requests. Please follow our contribution guidelines.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contact

For any inquiries or feedback, please reach out to Keshav Garg. Your input is valuable!

quality-subs-generator's People

Contributors

keshav2003garg avatar

Stargazers

suraj dhankad avatar

Watchers

 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.