Created
February 20, 2023 22:09
-
-
Save janodev/2cf8faa6663d3d07778be82c79a17778 to your computer and use it in GitHub Desktop.
Generating Spanish subtitles for a bunch of mp4 files on a folder (works for any language)
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
# install mac whisper | |
brew install python3 ffmpeg | |
pip install setuptools-rust | |
pip install -U openai-whisper | |
# create a script to extract audio and translate | |
for f in *.mp4; do FILE=`basename -s '.mp4' "$f"`; echo ffmpeg -i "\"$f\"" -vn -acodec copy "\"$FILE.aac\"" >> script.sh; done | |
for f in *.mp4; do FILE=`basename -s '.mp4' "$f"`; echo whisper "\"$FILE.aac\"" --language Spanish --model medium --task transcribe >> script.sh; done | |
# run the script. on M1 max this is several times slower than the audio being translated | |
./script.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment