This project enables real-time transcription of YouTube videos using your system's audio input. It captures audio through a loopback device and transcribes it.
- Real-time audio capture from system audio output (loopback)
- Automatic transcription using Whisper.cpp models
- Support for multiple languages
- Timestamped transcription output
- Automatic saving of transcriptions to text files
This project requires Python 3.12 and the following dependencies:
faster-whisper>=1.2.1
sounddevice>=0.5.3
numpy>=2.4.1Install with:
pip install -r requirements.txtpip install faster-whisper sounddevice numpyThe application requires a whisper.cpp model file. You can download one of the following models:
-
Large model (recommended for accuracy):
curl -L -o models/ggml-large-v3-turbo-q5_0.bin https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-large-v3-turbo-q5_0.bin
-
Medium model (better balance of speed/accuracy):
curl -L -o models/ggml-medium.en.bin https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-medium.en.bin
-
Base model (fastest, less accurate):
curl -L -o models/ggml-base.en.bin https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-base.en.bin
This application requires a loopback audio device to capture system audio. For Windows users, you'll need to:
-
Enable Stereo Mix (if available):
- Open Windows Sound Settings
- Go to "Recording" tab
- Right-click on your default audio device and select "Properties"
- In the "Listen" tab, check "Listen to this device"
- Look for "Stereo Mix" in the list
-
Install Virtual Audio Cable (VB-Cable):
- Download from vb-audio.com
- Install and configure it as your loopback device
- Set it as default recording device
Run the transcription script:
python transcribe.pyThe program will:
- List available audio devices
- Prompt you to select a loopback device
- Start capturing audio from the selected device
- Transcribe audio in real-time with timestamps
- Save output to a timestamped text file
Press Ctrl+C to stop transcription.
Transcriptions are saved in text files with the following format:
[00:01:23] This is the transcribed text from the audio.
[00:01:45] Another sentence from the video.
You can modify these settings at the top of transcribe.py:
MODEL_PATH: Path to your whisper.cpp model fileLANGUAGE: Language of the video (default: "en")SAMPLE_RATE: Audio sample rate (default: 16000)CHUNK_DURATION: Audio chunk duration in seconds before transcription (default: 5)
If no loopback devices are detected:
- Ensure your audio drivers are up to date
- Verify that Stereo Mix is enabled or VB-Cable is properly installed
- Check that the selected device has input capabilities
- Make sure system volume is at a reasonable level
- Use high-quality audio sources for better transcription accuracy
- Ensure no other applications are using the audio device simultaneously
- This application works best with clear, well-recorded audio
- Transcription quality depends heavily on the audio source quality
- The application automatically resamples audio to 16000Hz for optimal performance with Whisper models
- Python 3.12+
sounddevice- Audio input/output librarynumpy- Numerical computing libraryfaster-whisper- Fast Whisper transcription libraryscipy- Scientific computing (included in requirements.txt)
Note: This application requires system audio capture capabilities. On Windows, this typically means having either Stereo Mix enabled or a virtual audio cable installed.