diff --git a/examples/whisper/cmd.sh b/examples/whisper/cmd.sh index e710b63..4f32fd2 100755 --- a/examples/whisper/cmd.sh +++ b/examples/whisper/cmd.sh @@ -4,13 +4,13 @@ set -eou pipefail -# take stdin and buffer it into a temp file -input_temp=$(mktemp /tmp/whisper-input-XXXXXX) -cat > "$input_temp" +BASE_URL=$(echo "$1" | xargs dirname) -# make sure we have a 16kHz WAV file output_file="${input_temp}_16khz.wav" -ffmpeg -hide_banner -loglevel error -i "$input_temp" -ar 16000 -ac 1 "$output_file" + +# replace relative *.ts URLs with the absolute URL to them +cat | sed 's|^\([^#].*\)|'"$BASE_URL"'/\1|' \ + | ffmpeg -protocol_whitelist https,fd,tls,tcp -f hls -i - -vn -acodec pcm_s16le -ar 16000 -ac 2 "$output_file" # generate the VTT file /app/main \ diff --git a/examples/whisper/scyllaridae.yml b/examples/whisper/scyllaridae.yml index 8bfb7c7..09b864c 100644 --- a/examples/whisper/scyllaridae.yml +++ b/examples/whisper/scyllaridae.yml @@ -4,3 +4,5 @@ allowedMimeTypes: cmdByMimeType: default: cmd: /app/cmd.sh + args: + - "%source-mime-uri"