fixed
parent
2254afcbfb
commit
f04a55590f
|
|
@ -22,7 +22,7 @@ fn main() -> Result<(), &'static str> {
|
||||||
|
|
||||||
// Edit params as needed.
|
// Edit params as needed.
|
||||||
// Set the number of threads to use to 1.
|
// Set the number of threads to use to 1.
|
||||||
params.set_n_threads(1);
|
//params.set_n_threads(1);
|
||||||
// Enable translation.
|
// Enable translation.
|
||||||
params.set_translate(true);
|
params.set_translate(true);
|
||||||
// Set the language to translate to to English.
|
// Set the language to translate to to English.
|
||||||
|
|
|
||||||
|
|
@ -3,17 +3,20 @@
|
||||||
main() {
|
main() {
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
input_wav="$1"
|
input_wav="$(realpath "$1")"
|
||||||
model="${2:-../models/ggml-small.en.bin}"
|
model="$(realpath "${2:-../models/ggml-small.en.bin}")"
|
||||||
already_transcribed="${3:-false}"
|
already_transcribed="${3:-false}"
|
||||||
|
|
||||||
sanitized_wav="${input_wav%.*}.mono-16khz.wav"
|
sanitized_wav="${input_wav%.*}.mono-16khz.wav"
|
||||||
ffmpeg -y -i "$input_wav" -ac 1 -ar 16k "$sanitized_wav"
|
ffmpeg -y -i "$input_wav" -ac 1 -ar 16k "$sanitized_wav"
|
||||||
|
|
||||||
if ! $already_transcribed; then
|
if ! $already_transcribed; then
|
||||||
|
pushd "$(dirname "$(realpath "$BASH_SOURCE")")"
|
||||||
|
cd ../gitea-whisper-rs/
|
||||||
cargo run --example wav_subtitles -- "$model" "$sanitized_wav"
|
cargo run --example wav_subtitles -- "$model" "$sanitized_wav"
|
||||||
|
popd
|
||||||
fi
|
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"
|
ffmpeg -y -i "$input_wav" -i "${input_wav%.*}.srt" "${input_wav%.*}.mkv"
|
||||||
ls "${input_wav%.*}.mkv"
|
ls "${input_wav%.*}.mkv"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue