autosub
autosub uses ffmpeg and OpenAI Whisper's nodejs bindings to automatically generate and overlay subtitles on any video.
Installation
Before using autosub, you need to have ffmpeg installed. You can install ffmpeg using your package manager:
sudo apt update && sudo apt install ffmpeg
brew install ffmpeg
choco install ffmpeg
Install Package
- Note: When you run this project for the first time, it will automatically download an AI model and then compile it. If you encounter any errors during this process,
please raise an issue in the Nodejs-Whisper repository.
npm install -g autosub
Usage
Generate subtitles for a video:
autosub generate -i <Absolute path to video> -o <output path>
Options:
-i, --input
: Absolute path to the input video file.-o, --output
: (Optional) Output path for the subtitled video. If not provided, the output will be saved in the same directory as the input file.
Example:
autosub generate -i User/chetan/Developer/video.mp4 -o User/chetan/Developer/output.mp4
Development
Available AI models to generate subtitles for video (bigger model will give better result)
- For me tiny.en model works fine.
- To changes AI model you need to change "modelName" value in transcription.ts
Model | Disk | Mem |
---|
tiny | 75 MB | ~390 MB |
tiny.en | 75 MB | ~390 MB |
base | 142 MB | ~500 MB |
base.en | 142 MB | ~500 MB |
small | 466 MB | ~1.0 GB |
small.en | 466 MB | ~1.0 GB |
medium | 1.5 GB | ~2.6 GB |
medium.en | 1.5 GB | ~2.6 GB |
large-v1 | 2.9 GB | ~4.7 GB |
large-v2 | 2.9 GB | ~4.7 GB |
large | 2.9 GB | ~4.7 GB |
Todo List