- Navigate to the project directory:
cd batch-folder-audio-to-srt
- Set up a virtual environment:
For Windows:
python3 -m venv venv source venv/bin/activate # For Linux/Mac
venv\Scripts\activate
- Install dependencies:
pip install git+https://github.com/openai/whisper.git
- Convert an audio file (
.m4a
) to an SRT subtitle file:python3 audio-to-srt.py "/path/to/audio/file.m4a"
- The generated
.srt
file will be saved in the./SrtFiles
directory where the script is executed.
- Navigate to the project directory:
cd batch-folder-audio-to-srt
- Run the batch conversion script:
Note: The input folder is hardcoded in the script. All SRT files will be saved to the
python3 run-for-folder.py
./SrtFiles
directory.
- Use the
.env-template
to create and fill out a.env
file, including your Algolia write access API key (find it here). - Navigate to the
upload-srt-to-algolia
directory:cd upload-srt-to-algolia
- Run a connection test:
python3 test.py
- Upload the SRT file:
python3 upload-srt-to-algolia.py "/path/to/subtitles.srt"
- Run the following script to check the number of quotes that would be uploaded:
python3 find_quote_count.py "/path/to/srt/folder/"
- To upload all SRT files from a folder:
python3 upload_folder_to_algolia.py "/path/to/srt/folder/"
- File: "Livestream: TF2/CS:GO: April 14, 2012 (Pre Recorded) - Jerma985.m4a" (Length: 1:18:43)
- Time Taken: 18 minutes 27 seconds
- Processing Speed: 14.07 seconds per minute of audio
Estimate for processing a longer file:
- File Length: 1:58:14 (118 minutes)
- Estimated Time: 27.67 minutes
- Example:
python3 convert.py "/path/to/long/audiofile.m4a"
- Activate the environment:
- Windows:
venv_name\Scripts\activate
- Mac/Linux:
source venv_name/bin/activate
- Windows:
- Deactivate the environment:
deactivate
- Manage dependencies:
- Freeze installed dependencies to a file:
pip freeze > requirements.txt
- Install dependencies from a file:
pip install -r requirements.txt
- Freeze installed dependencies to a file:
Download and convert YouTube videos to high-quality MP3:
yt-dlp -f bestaudio -x --audio-format mp3 --audio-quality 0 --add-metadata https://www.youtube.com/watch?v=AL2IkW4JWl4
- Install Whisper:
pip install -U openai-whisper sudo apt update && sudo apt install ffmpeg
- Convert MP3 to text:
whisper audio.mp3 --model medium
- Install Conda.
- Initialize Conda: Getting Started.
- Follow the steps for installing WhisperX: WhisperX.
- Ensure
ffmpeg
is installed and accessible from the command line.