https://github.com/brlin-tw/media-to-whisper.cpp-subtitles
Converting user-specified media files to subtitles using the Whisper.cpp utility.
https://github.com/brlin-tw/media-to-whisper.cpp-subtitles
bash ffmpeg whisper-cpp
Last synced: 3 months ago
JSON representation
Converting user-specified media files to subtitles using the Whisper.cpp utility.
- Host: GitHub
- URL: https://github.com/brlin-tw/media-to-whisper.cpp-subtitles
- Owner: brlin-tw
- Created: 2024-11-05T04:52:58.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-11-10T02:14:00.000Z (over 1 year ago)
- Last Synced: 2025-06-22T22:05:41.595Z (about 1 year ago)
- Topics: bash, ffmpeg, whisper-cpp
- Language: Shell
- Homepage: https://gitlab.com/brlin/media-to-whisper.cpp-subtitles
- Size: 55.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSES/AGPL-3.0-or-later.txt
Awesome Lists containing this project
README
# media-to-whisper.cpp-subtitles
Converting user-specified media files to subtitles using the Whisper.cpp utility.
[](https://gitlab.com/brlin/media-to-whisper.cpp-subtitles/-/pipelines) [](https://github.com/brlin-tw/media-to-whisper.cpp-subtitles/actions/workflows/check-potential-problems.yml) [](https://pre-commit.com/) [](https://api.reuse.software/info/gitlab.com/brlin/media-to-whisper.cpp-subtitles)
## Prerequisites
You need to have the following software installed and it's command available in the command search PATHs:
* [GNU core utilities](https://www.gnu.org/software/coreutils/)
For determining the absolute path of the utility and the available threads to do the subtitle inference.
* [whisper.cpp](https://github.com/ggerganov/whisper.cpp)
For inferencing the subtitles from the media's audio tracks.
By default it uses [the unofficial snap distribution](https://snapcraft.io/whisper-cpp) of Whisper.cpp.
* [FFmpeg](https://www.ffmpeg.org/)
For converting the input media into formats that can be consumed by whisper.cpp.
## Usage
Refer to the following instructions to use this application:
1. Download the application's release package from [the Releases page](https://gitlab.com/brlin/media-to-whisper.cpp-subtitles/-/releases).
1. Extract the downloaded application release package using your preferred archive manipulation utility.
1. Launch your preferred text terminal emulator application.
1. Refer to [the Environment variables that can change the utility's behaviors section](#environment-variables-that-can-change-the-utilitys-behaviors) for environment variables that can change the utility's behaviors according to your preference and run the utility by running the following command:
```bash
_ENV_VAR_NAME1_=_env_var_value1_ _ENV_VAR_NAME2_=_env_var_value2_... \
/path/to/media-to-whisper.cpp-subtitles/transcribe-media-to-subtitles.sh \
_input_media_1_ _input_media_2_...
```
The generated subtitles files will be saved in the same directory with the input files.
## Environment variables that can change the utility's behaviors
The following environment variables can change the utility's behaviors according to your preference, use these environment variables to optimize your workload:
### GGML_MODEL
The whisper.cpp model file to infer the subtitles.
**Supported values:**
* (Absolute path of the model file you want to use)
* (Relative path of the model file you want to use)
**Default value:** `ggml-medium.bin`
### TRANSCRIBE_THREADS
The thread count for doing the subtitle transcribe task.
**Supported values:**
* `auto`: Automatically determine the optimal transcribe thread count while taken [the `TRANSCRIBE_THREADS_NEGATIVE_OFFSET` environment variable](#transcribe_threads_negative_offset) into consideration
* (A natural number of user-specified thread count)
**Default value:** `auto`
### TRANSCRIBE_THREADS_NEGATIVE_OFFSET
When [the `TRANSCRIBE_THREADS` environment variable](#transcribe_threads) is set to `auto`, this environment variable determines the negative offset that will be applied to the transcribe thread count to allow user to adapt it to their system's optimal settings.
**Supported values:**
(A non-negative number that will be deducted from the detected thread count available to the process)
**Default value:**
`1` (Deduct one from the detected available thread count, on a 8 total CPU thread system the optimal transcribe thread count will be determined to be `7`)
### WHISPERCPP_MAIN
Specify the base command of the Whisper.cpp main program. This environment variable allows users to use a different Whisper.cpp distribution other than the snap.
**Supported values:**
* The path of a valid Whisper.cpp main program.
* The base command of a valid Whisper.cpp main program, if it is in the command search PATHs.
**Default value:** `whisper-cpp-main`
Use [the unofficial snap distribution](https://snapcraft.io/whisper-cpp)'s main app command.
## Licensing
Unless otherwise noted(individual file's header/[REUSE.toml](REUSE.toml)), this product is licensed under [the 3.0 version of the GNU Affero General Public License](https://www.gnu.org/licenses/agpl-3.0.en.html), or any of its more recent versions of your preference.
This work complies to [the REUSE Specification](https://reuse.software/spec/), refer the [REUSE - Make licensing easy for everyone](https://reuse.software/) website for info regarding the licensing of this product.