Last active
April 28, 2023 20:27
-
-
Save swenson/c70b8cb27d26799e977910019a08211b to your computer and use it in GitHub Desktop.
Add subtitles to a video using whisper.cpp and ffmpeg. (./main is the whisper.cpp main binary.) https://github.com/ggerganov/whisper.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "Converting audio" | |
rm -f temp.wav | |
ffmpeg -i "$1" -ar 16000 -ac 1 -c:a pcm_s16le temp.wav | |
echo "Transcribing" | |
./main -m models/ggml-base.en.bin -f ./temp.wav --output-srt | |
echo "Adding to video file" | |
ffmpeg -i "$1" -i temp.wav.srt -c copy -metadata:s:s:0 language=eng "${1%.*}.subtitled.mkv" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment