A tool for generating subtitles using Google Gemini models.
Project description
Subtitle tool
This utility uses Google Gemini to generate subtitles to audio and video files.
Dependencies
ffmpeg needs to be installed for audio extraction.
Process
- Extract the audio from the video
- Send the audio to Gemini for transcription
- Backup the existing subtitle
- Save the new subtitle
Dependencies
-
Export the API key for Gemini to the environment variable
GEMINI_API_KEYor specify it in the command line with the flag--api-key. -
ffmpegneeds to be installed (brew install ffmpeg,apt-get install ffmpegordnf install ffmpeg) -
Ensure
uvinstalls its dev dependencies withuv sync --extra dev.
Installation
pip install subtitle-tool
Developing
For local development it is useful to install the binary from the development
location into the user's PATH. For this, run the following commands:
uv tool install -e .
uv tool update-shell
Usage
- Subtitle files with the defaults:
subtitle-tool video.avi
subtitle-tool audio.mp3
- Usage options:
Usage: subtitle-tool [OPTIONS] MEDIAFILE
Generate subtitles for a media file
Options:
--api-key TEXT Google Gemini API key
-m, --ai-model TEXT Gemini model to use [default:
gemini-2.5-flash]
-s, --subtitle-path TEXT Subtitle file name [default: MEDIAFILE.srt]
-v, --verbose Enable debug logging for subtitle_tool
modules
-d, --debug Enable debug logging for all modules
-k, --keep-temp-files Do not erase temporary files
-l, --audio-segment-length INTEGER
Length of audio segments to be subtitled in
seconds [default: 30]
-p, --parallel-segments INTEGER
Number of segments subtitled in parallel
[default: 5]
--help Show this message and exit.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file subtitle_tool-0.1.55.tar.gz.
File metadata
- Download URL: subtitle_tool-0.1.55.tar.gz
- Upload date:
- Size: 50.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f93e359007efd86598280dc6817221418c8b27c386ad85d5ffdc1fcde9737e17
|
|
| MD5 |
c9609dff01a2c7c2c6f1561169751b95
|
|
| BLAKE2b-256 |
042e5a4acde54b0d40ef9e033381f4de55e0e39d6f70546f7c753c1592e88636
|
File details
Details for the file subtitle_tool-0.1.55-py3-none-any.whl.
File metadata
- Download URL: subtitle_tool-0.1.55-py3-none-any.whl
- Upload date:
- Size: 17.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7240f99d0a2fa799f96b30fa7ef4eda054e62ccb8aea8eceac25107c551b1f81
|
|
| MD5 |
c68d913f39f39f93742da8ace88ae817
|
|
| BLAKE2b-256 |
f30eec4acf604a6d75f1243b34a89fb4967f754dc0e277b728de54f14af70059
|