Install auto-subtitle
mainInstall the auto-subtitle package directly from the GitHub repository using pip. Ensure you have Python 3.7 or newer installed.
pip install git+https://github.com/m1guelpf/auto-subtitle.gitrepository·main·Indexed 25 days ago
https://github.com/m1guelpf/auto-subtitleA Python-based tool that uses ffmpeg and OpenAI's Whisper model to automatically generate and overlay subtitles onto video files. It supports transcription in multiple languages, translation to English, and the generation of .srt files.
Install the auto-subtitle package directly from the GitHub repository using pip. Ensure you have Python 3.7 or newer installed.
pip install git+https://github.com/m1guelpf/auto-subtitle.gitThe tool requires ffmpeg to process video files. Install it using your operating system's package manager:
apt.brew.choco.# on Ubuntu or Debian
sudo apt update && sudo apt install ffmpeg
# on MacOS using Homebrew
brew install ffmpeg
# on Windows using Chocolatey
choco install ffmpegYou can control whether the tool performs standard transcription or translation to English using the --task flag. If you specify a language, it will be used for the source audio; otherwise, the tool attempts to detect it automatically.
Note: If you use an English-only Whisper model (e.g., a model ending in .en), the tool will force the language to en regardless of your input.
To transcribe a non-English video and translate the resulting subtitles into English, use the --task translate flag.
auto_subtitle /path/to/video.mp4 --task translateYou can specify a different OpenAI Whisper model using the --model flag to improve transcription accuracy, especially for non-English languages.
Available models:
tinytiny.enbasebase.ensmall (default)small.enmediummedium.enlargeauto_subtitle /path/to/video.mp4 --model mediumTo see a full list of available command-line arguments and options, run the command with the --help flag.
auto_subtitle --helpRun the auto_subtitle command followed by the path to your video file. Use the -o flag to specify the output directory. By default, the tool uses the small Whisper model, which is optimized for English.
auto_subtitle /path/to/video.mp4 -o subtitled/The following arguments and flags are available for the auto-subtitle command:
| Argument | Flag | Default | Description |
|---|---|---|---|
video | (positional) | N/A | Paths to video files to transcribe (supports multiple files). |
--model | small | Name of the Whisper model to use (e.g., tiny, base, small, medium, large). | |
--output_dir | -o | . | Directory to save the outputs. |
--output_srt | False | Whether to output the .srt file along with the video files. | |
--srt_only | False | Only generate the .srt file and not create overlayed video. | |
--verbose | False | Whether to print out the progress and debug messages. | |
--task | transcribe | Task type: transcribe (X->X speech recognition) or translate (X->English translation). | |
--language | auto | The origin language of the video. If auto, it is detected automatically. Supports ISO 639-1 codes (e.g., en, es, fr, zh). |
The auto-subtitle CLI tool allows you to transcribe video files or translate them into English, generating either .srt subtitle files or new video files with subtitles overlaid. You can process multiple video files in a single command.
Basic Usage:
auto-subtitle path/to/video.mp4