This Python script allows you to transcribe audio and video files using the Wit.ai API. It supports transcription of YouTube videos, local audio files (WAV and MP3), and local video files (MP4, MKV, AVI).
Clone the repository:
git clone https://github.com/marouane53/transcribe.git
Build the Docker image:
cd transcribe
docker build -t transcribe-app .
Run the Docker container, mounting the local downloads
directory:
docker run -it --rm -v $(pwd)/downloads/:/usr/src/app/downloads transcribe-app
Replace $(pwd)/downloads/
with the path to your local downloads
directory you wish to use for saving the transcription results. This ensures that any files downloaded or created by the script will be accessible on your host machine.
For Windows:
bin
directory to your system's PATH environment variable.For macOS (using Homebrew):
brew install ffmpeg
For Linux (using apt):
sudo apt update
sudo apt install ffmpeg
For Windows:
pip install yt-dlp
For macOS and Linux:
sudo pip install yt-dlp
.env.example
file to a new file named .env
in the root directory of your project..env
file and replace the placeholder values with your actual Wit.ai API keys and any other necessary configuration values.Note: The .env
file is where your sensitive information such as API keys will be stored. It is crucial to ensure this file is never committed to your version control system. The .gitignore
file in this project is already configured to exclude .env
.
.env
file and fill in your Wit.ai API keys next to the corresponding language variables (e.g., WIT_API_KEY_ENGLISH
, WIT_API_KEY_ARABIC
, etc.).For Windows users, a pre-packaged release is available that includes the necessary executable files (ffmpeg and yt-dlp) along with the Python script. You can download the release from here.
The release version eliminates the need for installing ffmpeg and yt-dlp separately, as the executable files are included in the package. Simply extract the ZIP file and run the script directly.
Run the script: python transcribe.py
Choose whether you want to transcribe a YouTube video or a local file.
Follow the prompts to provide the necessary information (YouTube link or file path, language sign).
The script will download the audio (for YouTube videos), convert the file to WAV format (if necessary), and start the transcription process.
Once the transcription is completed, the generated files (TXT and SRT) will be saved in the same directory as the input file.
This project was inspired by and adapted from the Tafrigh project.
This project is licensed under the MIT License.