Generate subtitles easily with ffmpeg and whisper
npm install subtitles-generatorGenerate subtitles easily with ffmpeg and whisper.
---
- Features
- Prerequisites
- Installation
- Usage
- License
โ Can be used via CLI or in code
โ Support video or audio files as input
- ffmpeg (ffmpeg will be used as to generate wav file from the video file)
Using via code (for CLI no need to install locally).
> NOTE: The package is using esm modules!
Install the package locally.
```
npm i subtitles-generator
Basic example.
`ts
import { subtitlesGenerator } from 'subtitles-generator';
await subtitlesGenerator('something.mp4');
`
With options.
`ts
import { subtitlesGenerator } from 'subtitles-generator';
const srtFilePath = await subtitlesGenerator('something.mp4', {
outputFilePath: './',
modelType: 'base.en',
shouldTryToDownloadModel: true,
language: 'en',
translateToEnglish: false,
});
console.log(srtFilePath); // 'something.srt'
`
Using via CLI.
`sh`
npx subtitles-generator --help
Create srt file from mp4 file.
`sh``
npx subtitles-generator -i something.mp4 -m base.en