Skip to content

Commit

Permalink
Create VTT files from HLS derivative
Browse files Browse the repository at this point in the history
  • Loading branch information
joecorall committed Dec 16, 2024
1 parent 2b04619 commit daa9041
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 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
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 \
Expand Down
2 changes: 2 additions & 0 deletions examples/whisper/scyllaridae.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ allowedMimeTypes:
cmdByMimeType:
default:
cmd: /app/cmd.sh
args:
- "%source-mime-uri"

0 comments on commit daa9041

Please sign in to comment.