master
Bel LaPointe 2024-09-21 17:37:50 -04:00
parent 2254afcbfb
commit f04a55590f
2 changed files with 7 additions and 4 deletions

View File

@ -22,7 +22,7 @@ fn main() -> Result<(), &'static str> {
// Edit params as needed.
// Set the number of threads to use to 1.
params.set_n_threads(1);
//params.set_n_threads(1);
// Enable translation.
params.set_translate(true);
// Set the language to translate to to English.

View File

@ -3,17 +3,20 @@
main() {
set -euo pipefail
input_wav="$1"
model="${2:-../models/ggml-small.en.bin}"
input_wav="$(realpath "$1")"
model="$(realpath "${2:-../models/ggml-small.en.bin}")"
already_transcribed="${3:-false}"
sanitized_wav="${input_wav%.*}.mono-16khz.wav"
ffmpeg -y -i "$input_wav" -ac 1 -ar 16k "$sanitized_wav"
if ! $already_transcribed; then
pushd "$(dirname "$(realpath "$BASH_SOURCE")")"
cd ../gitea-whisper-rs/
cargo run --example wav_subtitles -- "$model" "$sanitized_wav"
popd
fi
out_to_srt ./transcript.txt > "${input_wav%.*}.srt"
out_to_srt ../gitea-whisper-rs/transcript.txt > "${input_wav%.*}.srt"
ffmpeg -y -i "$input_wav" -i "${input_wav%.*}.srt" "${input_wav%.*}.mkv"
ls "${input_wav%.*}.mkv"