From daa9041b4d5fb3c7ca0c077323ddd9f7ef53afb9 Mon Sep 17 00:00:00 2001 From: Joe Corall Date: Mon, 16 Dec 2024 12:35:35 -0500 Subject: [PATCH 1/5] Create VTT files from HLS derivative --- examples/whisper/cmd.sh | 10 +++++----- examples/whisper/scyllaridae.yml | 2 ++ 2 files changed, 7 insertions(+), 5 deletions(-) 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" From 6e742766df7363c9b68bb598343869709a9faa97 Mon Sep 17 00:00:00 2001 From: Joe Corall Date: Mon, 16 Dec 2024 12:42:02 -0500 Subject: [PATCH 2/5] fixup --- examples/whisper/cmd.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/whisper/cmd.sh b/examples/whisper/cmd.sh index 4f32fd2..8d46785 100755 --- a/examples/whisper/cmd.sh +++ b/examples/whisper/cmd.sh @@ -5,7 +5,7 @@ set -eou pipefail BASE_URL=$(echo "$1" | xargs dirname) - +input_temp=$(mktemp /tmp/whisper-input-XXXXXX) output_file="${input_temp}_16khz.wav" # replace relative *.ts URLs with the absolute URL to them From 918ba1b9192a93d2c2e8f18db246cbcfa77f1be4 Mon Sep 17 00:00:00 2001 From: Joe Corall Date: Mon, 16 Dec 2024 12:54:45 -0500 Subject: [PATCH 3/5] fixup mimetype --- examples/whisper/scyllaridae.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/examples/whisper/scyllaridae.yml b/examples/whisper/scyllaridae.yml index 09b864c..d3d6955 100644 --- a/examples/whisper/scyllaridae.yml +++ b/examples/whisper/scyllaridae.yml @@ -1,6 +1,5 @@ allowedMimeTypes: - - "audio/*" - - "video/*" + - "application/vnd.apple.mpegurl" cmdByMimeType: default: cmd: /app/cmd.sh From 06b90aa68a2ad374d26c5a97b3b2525c78600da4 Mon Sep 17 00:00:00 2001 From: Joe Corall Date: Mon, 16 Dec 2024 13:09:51 -0500 Subject: [PATCH 4/5] fixup --- examples/whisper/cmd.sh | 2 +- examples/whisper/scyllaridae.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/whisper/cmd.sh b/examples/whisper/cmd.sh index 8d46785..2b656a4 100755 --- a/examples/whisper/cmd.sh +++ b/examples/whisper/cmd.sh @@ -10,7 +10,7 @@ output_file="${input_temp}_16khz.wav" # 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" + | ffmpeg -protocol_whitelist https,fd,tls,tcp,pipe -f hls -i - -vn -acodec pcm_s16le -ar 16000 -ac 2 "$output_file" > /dev/null 2>&1 # generate the VTT file /app/main \ diff --git a/examples/whisper/scyllaridae.yml b/examples/whisper/scyllaridae.yml index d3d6955..e442913 100644 --- a/examples/whisper/scyllaridae.yml +++ b/examples/whisper/scyllaridae.yml @@ -4,4 +4,4 @@ cmdByMimeType: default: cmd: /app/cmd.sh args: - - "%source-mime-uri" + - "%source-uri" From 3c75c88be68c66c3906d6d74f48b2a9e1f82daae Mon Sep 17 00:00:00 2001 From: Joe Corall Date: Mon, 16 Dec 2024 13:10:37 -0500 Subject: [PATCH 5/5] hide --- examples/whisper/cmd.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/whisper/cmd.sh b/examples/whisper/cmd.sh index 2b656a4..3504a2f 100755 --- a/examples/whisper/cmd.sh +++ b/examples/whisper/cmd.sh @@ -10,7 +10,7 @@ output_file="${input_temp}_16khz.wav" # replace relative *.ts URLs with the absolute URL to them cat | sed 's|^\([^#].*\)|'"$BASE_URL"'/\1|' \ - | ffmpeg -protocol_whitelist https,fd,tls,tcp,pipe -f hls -i - -vn -acodec pcm_s16le -ar 16000 -ac 2 "$output_file" > /dev/null 2>&1 + | ffmpeg -hide_banner -loglevel error -protocol_whitelist https,fd,tls,tcp,pipe -f hls -i - -vn -acodec pcm_s16le -ar 16000 -ac 2 "$output_file" > /dev/null 2>&1 # generate the VTT file /app/main \