This Python program transcribes and translates video files into text documents. It supports multiple languages and handles various video formats.
- Transcribes video files to text
- Translates text to desired language
- Saves output as text files
- Supports common video formats (MP4, AVI, MOV, etc.)
- Includes error handling and retry logic
- Python 3.7+
- FFmpeg (system-wide installation required)
-
Clone this repository:
git clone https://github.com/umairalamchaudhry/Video-Transcriber.git cd Video-Transcriber
-
Create and activate a virtual environment:
python -m venv venv venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Install FFmpeg (Windows): a. Download FFmpeg from https://www.gyan.dev/ffmpeg/builds/ b. Choose the "ffmpeg-release-full.7z" file c. Extract the downloaded file to C:\ffmpeg d. Add FFmpeg to system PATH:
- Open Start Menu and search for "Environment Variables"
- Click "Edit the system environment variables"
- Click "Environment Variables" button
- In System variables, find Path and click Edit
- Click New and add: C:\ffmpeg\bin
- Click OK to save changes e. Verify installation:
- Open Command Prompt
- Run: ffmpeg -version
- You should see FFmpeg version information
- Place your video file in the project directory
- Run the program:
python transcriber.py
- Follow the prompts:
- Enter video file name
- Choose target language code
- Enter output file name
The program will:
- Convert video to audio
- Transcribe audio to text
- Translate text to target language
- Save transcription as text file
- Show preview in terminal
-
Audio Conversion
- Uses pydub and FFmpeg to convert video to WAV format
- Handles various video formats
-
Speech Recognition
- Uses SpeechRecognition library
- Implements Google Web Speech API
- Includes retry logic for API calls
-
Translation
- Uses deep-translator library
- Supports multiple languages
- Handles API errors gracefully
-
File Handling
- Saves transcriptions as UTF-8 encoded text files
- Cleans up temporary files
- Checks for file existence
- Handles API errors with retries
- Provides meaningful error messages
The program supports translation to any language supported by Google Translate. Common codes:
- English: en
- Spanish: es
- French: fr
- Hindi: hi
- Urdu: ur
- Ensure FFmpeg is installed and in PATH
- Verify installation with
ffmpeg -version
- Check internet connection
- Try again later if API quota exceeded
MIT License
Pull requests are welcome. For major changes, please open an issue first to discuss proposed changes.
- pydub for audio processing
- SpeechRecognition for transcription
- deep-translator for translation