Simple script that translates and/or transcribes video audio to English and adds subtitles to said video using the Whisper API and MoviePy.
Please note: I've only set this up on a Linux terminal with Python 3.8+. So these instructions might not be entirely right if you're using a non-Unix-based operating system (AKA Windows. MacOS should be fine).
Install imagemagick for MacOS. You can do this with Homebrew:
brew install imagemagick
python -m venv ./venv
source absolute/path/to/activate_file
pip install -r requirements.txt --use-pep517
cp env-template .env
Then paste in your OPENAI_API_KEY
within the double quotes.
python main.py --video <PATH TO TARGET MP4> --type <translate or transcribe>
The transcribe option doesn't seem to work for certain languages and transcriptions for languages that aren't English aren't as accurate. These are mostly issues with the Whisper API and Moviepy that are outside of our hands.