Created
March 28, 2024 18:13
-
-
Save ryanfb/b974f502939c27b3967607423e50e23f to your computer and use it in GitHub Desktop.
Auto-transcribe and burn subtitles for all videos without existing subtitles
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
for ext in avi mp4 mpg mkv; do | |
for i in *.${ext}; do | |
if [ ! -e "$(basename "$i" ".${ext}").srt" ]; then | |
echo "Transcribing: $i" | |
time whisperx "$i" --model large-v3 --language en --task transcribe --hf_token $HUGGINGFACE_TOKEN --compute_type int8 --chunk_size 5 | |
echo "Burning subtitles: $i" | |
ffmpeg -i "$i" -vf subtitles="$(basename "$i" ".${ext}").srt" "$(basename "$i" ".${ext}")-burned.${ext}" | |
else | |
echo "Skipping: $i" | |
fi | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment