cviniciussdias/audio-subtitle-generator

v0.1.5 2025-08-02 03:02 UTC

This package is auto-updated.

Last update: 2025-08-02 03:04:31 UTC


README

Subtitle generator using Whisper.PHP from an audio input.

Prerequisites

  • PHP >=8.3
  • Composer
  • FFI
  • JIT (optional, for performance)

Usage

After cloning the repository and running composer install, to display the command's usage:

php generate-subtitle -h

If you prefer to require this package as a composer dependency, after running composer require cviniciussdias/audio-subtitle-generator, to display the command's usage:

./vendor/bin/generate-subtitle -h

Options

-f, --filepath=<file_path>         File path of the audio to be transcribed
-p, --prompt=<initial_prompt>      Text (or file path) of the initial prompt for context about the audio
-m, --model=<model>                Model to be used (tiny.en, tiny, base.en, base, small.en, small, medium.en, medium, large-v1, large-v2, large-v3, large) (default: tiny.en)
-t, --threads=<number_of_threads>  Number of threads to use (default: 16)
-l, --language=<language>          Two letter code of the audio's language. (default: autodetect)
-o, --output=<output_path>         Output path of the subtitle file (.srt extension)

Example:

The following example will generate the subtitle file subtitle.srt inside the current directory based on the audio.mp3 file in the same path:

php generate-subtitle \
    -f=audio.mp3 \
    --prompt="Initial prompt for context about the audio" \
    --model=small \
    -t8 \
    -l=pt \
    --output=subtitle.srt

Docker

If you prefer, you can use Docker to run this tool:

https://hub.docker.com/r/cviniciussdias/audio-subtitle-generator