#!/bin/sh -e
#
# audio-transcribe - transcribe auto with whisper
# dependencies: whisper.cpp
#
# ---
# see: https://github.com/ggml-org/whisper.cpp

if [ -z "$1" ]; then
  printf '%s\n' "Usage: $(basename "$0") <filename>"
  exit 1
fi

tmp="$(mktemp -d)/audio.wav"
ffmpeg -i "$1" -ar 16000 "${tmp}" 2>/dev/null
whisper-cpp -m "${HOME}/projects/src/audio/ggml-medium.en.bin" -np -nt "${tmp}"
