A Python script that automatically extracts audio from MP4 video files and transcribes the speech to text using Google's Web Speech API. This project is ideal for users who need to convert video content into readable text for documentation, content creation, or other purposes.
- Audio Extraction: Extracts audio from MP4 files using
ffmpeg
. - Speech Transcription: Converts extracted audio into text using the Google Web Speech API.
- Automated Processing: Scans for all MP4 files in the current directory and processes them automatically.
- File Cleanup: Automatically deletes the intermediate audio file after transcription to save space.
Ensure you have the following installed:
- Python 3.x
- FFmpeg: Used for audio extraction from videos. You can download and install it from here.
- Google Web Speech API dependencies via the
speech_recognition
library.
-
Clone the repository:
git clone https://github.com/danmenzies/easy-video-transcriber.git cd easy-video-transcriber
-
(Optional) Set up a virtual environment:
python -m venv env source env/bin/activate # On Windows: env\Scripts\activate
-
Install the required Python libraries:
pip install -r requirements.txt
-
Install FFmpeg and ensure it’s available in your system’s PATH.
-
Place all the MP4 files you want to transcribe in the script's directory.
-
Run the script:
python main.py
-
The script will:
- Extract audio from each MP4 file.
- Transcribe the audio to text.
- Save the transcription in a text file with the same base name as the video (e.g.,
video.mp4
will generatevideo.txt
).
-
After transcription, the temporary WAV file will be deleted to conserve disk space.
Example output:
Extracting audio from video.mp4...
Transcribing audio from video.wav...
Transcription complete for video.mp4. Check video.txt for the output.
- Python 3.x
ffmpeg
: Required for audio extraction.- Python libraries:
speech_recognition
glob
(standard library)os
(standard library)subprocess
(standard library)
You can install the Python dependencies using the requirements.txt
file.
- Fork the repository.
- Create a feature branch (
git checkout -b feature/feature_name
). - Commit your changes (
git commit -m 'Add feature'
). - Push to the branch (
git push origin feature/feature_name
). - Open a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.
This README.md
can serve as the documentation for your Easy Video Transcriber project. If you'd like to add more details or customization, feel free to let me know!