Skip to content

Commit

Permalink
Create VTT files from HLS derivative (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
joecorall authored Dec 16, 2024
1 parent 2b04619 commit 3e2baec
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
10 changes: 5 additions & 5 deletions examples/whisper/cmd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

set -eou pipefail

# take stdin and buffer it into a temp file
BASE_URL=$(echo "$1" | xargs dirname)
input_temp=$(mktemp /tmp/whisper-input-XXXXXX)
cat > "$input_temp"

# 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 -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 \
Expand Down
5 changes: 3 additions & 2 deletions examples/whisper/scyllaridae.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
allowedMimeTypes:
- "audio/*"
- "video/*"
- "application/vnd.apple.mpegurl"
cmdByMimeType:
default:
cmd: /app/cmd.sh
args:
- "%source-uri"

0 comments on commit 3e2baec

Please sign in to comment.