AI-powered audio/video processing: transcription, speaker diarization, LLM refinement, translation | AI-обработка аудио/видео: транскрибация, распознавание спикеров, перевод
4
stars
35
commits
Python
primary language
Nov 27, 2025
updated
A flexible toolkit for transcribing and translating YouTube videos, audio files, and existing documents.
gigaam-e2e-rnnt / gigaam-e2e-ctc via Hugging Face (transformers, torch ≥ 2.6)tests/test_gigaam_backend.py)--speakers flaggit clone <repository-url>
cd yt-transcriber
python -m venv venv
# macOS/Linux
source venv/bin/activate
# Windows
venv\Scripts\activate
macOS
brew install ffmpeg
Linux (Ubuntu/Debian)
sudo apt update
sudo apt install ffmpeg
Windows
Download a build from ffmpeg.org and add it to your PATH.
pip install --upgrade pip
pip install -r requirements.txt
macOS/Linux
# Install Ollama
curl -fsSL https://ollama.com/install.sh | sh
# Recommended models
ollama pull qwen2.5:3b # Fast, good quality (~3 GB)
ollama pull qwen2.5:7b # Slower, higher quality (~7 GB)
# Start the server (if not already running)
ollama serve
Windows Download the installer from ollama.com.
Create a .env file in the project root:
# Enable OpenAI integration (experimental)
OPENAI_API_KEY=your_api_key_here
# Logging level
LOG_LEVEL=INFO
python -m src.main youtube --url "https://youtube.com/watch?v=dQw4w9WgXcQ" --transcribe whisper-base
python -m src.main youtube \
--url "https://youtube.com/watch?v=dQw4w9WgXcQ" \
--transcribe whisper-base \
--translate nllb
python -m src.main audio \
--input audio.mp3 \
--transcribe whisper-medium \
--translate nllb
python -m src.main video \
--input video.mp4 \
--transcribe whisper-medium \
--translate nllb
Supported video formats: MP4, MKV, AVI, MOV, and any format supported by FFmpeg.
python -m src.main audio \
--input audio.mp3 \
--transcribe whisper-medium \
--refine-model qwen2.5:7b \
--translate nllb
Produces two documents:
audio_original.docx/md — raw transcript without translationaudio_refined.docx/md — polished transcript with translationAdd LLM polish for the translation as well (Ollama backend):
python -m src.main audio \
--input audio.mp3 \
--transcribe whisper-medium \
--refine-model qwen2.5:7b \
--translate nllb \
--refine-translation qwen2.5:3b
Use OpenAI GPT-4o Mini for refinement (requires OPENAI_API_KEY):
python -m src.main audio \
--input audio.mp3 \
--transcribe whisper-medium \
--refine-backend openai-api \
--refine-model gpt-4o-mini-2024-07-18
gpt-4o-mini is an alias; the full dated ID keeps you on a fixed model version.
# Create prompt.txt with project-specific terms
# FIDE, Hikaru Nakamura, Magnus Carlsen, chess tournament
python -m src.main youtube \
--url "https://youtube.com/watch?v=YOUR_VIDEO_ID" \
--transcribe whisper-base \
--prompt-file prompt.txt
# Transcribe with automatic speaker identification
python -m src.main youtube \
--url "https://youtube.com/watch?v=YOUR_VIDEO_ID" \
--transcribe whisper-medium \
--speakers
Requirements for speaker diarization:
export HF_TOKEN=your_token_here (add to ~/.zshrc or ~/.bashrc)Output will include speaker labels:
[00:00] [SPEAKER_00] Hello everyone, welcome to the show
[00:05] [SPEAKER_01] Thanks for having me
[00:08] [SPEAKER_00] Let's get started with today's topic
facebook/nllb-200-distilled-1.3B is released under CC BY-NC 4.0 (non-commercial). Use a different model or obtain a licence for commercial scenarios.# Improve an existing transcript
python -m src.main text --input output/document.md --refine-model qwen2.5:7b
# Translate a document
python -m src.main text --input transcription.docx --translate nllb
# Refine and translate
python -m src.main text --input document.txt --refine-model qwen2.5:7b --translate nllb
Supported formats: .md, .docx, .txt
python -m src.main --help
python -m src.main youtube --help
python -m src.main audio --help
python -m src.main <command> [options]
Commands:
youtube — Process a YouTube videoaudio — Process a local audio filevideo — Process a local video filetext — Process a text document| Option | Description | Example |
|---|---|---|
--transcribe | Transcription method | --transcribe whisper-base |
--translate | Translation method | --translate nllb |
--refine-model | Model for refinement | --refine-model qwen2.5:7b |
--refine-backend | Backend for transcript refinement (not translation) | --refine-backend ollama |
--prompt-file | Custom Whisper prompt file | --prompt-file prompt.txt |
--nllb-model | NLLB model override | --nllb-model facebook/nllb-200-distilled-600M |
--refine-translation | LLM polish for the translated text (Ollama) | --refine-translation qwen2.5:3b |
--speakers | Enable speaker diarization | --speakers |
--summarize-model | Model for summarization | --summarize-model qwen2.5:7b |
--help | Show help | --help |
Note: --refine-backend only switches the backend for transcript refinement (--refine-model). Translation polishing uses --refine-translation and the Ollama backend.
Transcription
whisper-base — fast, good qualitywhisper-small — slower, higher qualitywhisper-medium — slowest, best qualitywhisper-openai-api — OpenAI Whisper API (requires OPENAI_API_KEY)gigaam-e2e-rnnt — GigaAM v3 (RU), максимальное качество + пунктуация/нормализацияgigaam-e2e-ctc — GigaAM v3 (RU), быстрее, чуть проще моделиRefinement (requires Ollama or OpenAI API)
qwen2.5:3b — fast, 3 GB (recommended)qwen2.5:7b — slower, better qualityllama3.2:3b — fast, solid qualityllama3:8b — slower, higher qualitymistral:7b — balancedgpt-4o-mini-2024-07-18 — OpenAI GPT-4o Mini (API; alias gpt-4o-mini also works)Translation
nllb — Meta NLLB (local, free)openai-api — OpenAI GPT API (requires OPENAI_API_KEY)yt-transcriber/
├── src/ # Source code
│ ├── main.py # Entry point
│ ├── config.py # Configuration
│ ├── downloader.py # YouTube downloads
│ ├── transcriber.py # Transcription
│ ├── text_reader.py # Text ingestion
│ ├── translator.py # Translation
│ ├── text_refiner.py # LLM-based refinement
│ ├── document_writer.py # Document generation
│ ├── utils.py # Utilities
│ └── logger.py # Logging setup
├── tests/ # Automated tests
├── output/ # Generated docs
├── temp/ # Temporary files
├── logs/ # Logs
├── requirements.txt # Runtime dependencies
├── .env.example # Sample configuration
└── README.md # Documentation
Note: Whisper and NLLB models are cached in ~/.cache/ on first run.
Main settings live in src/config.py:
# Paths
OUTPUT_DIR = "output" # Output folder
TEMP_DIR = "temp" # Temporary files
LOGS_DIR = "logs" # Logs
# Models
WHISPER_DEVICE = "mps" # cpu/cuda/mps (auto-switch for M1)
NLLB_MODEL_NAME = "facebook/nllb-200-distilled-600M"
# Logging
LOG_LEVEL = "INFO" # DEBUG/INFO/WARNING/ERROR
Approximate processing time on a MacBook Air M1 (16 GB, CPU):
| Video length | whisper_base | whisper_small | NLLB translation | Total (base+translate) | Total (small+translate) |
|---|---|---|---|---|---|
| 3 minutes | ~11 s | ~34 s | ~1.5 min | ~2 min | ~3 min |
| 10 minutes | ~36 s | ~2 min | ~5 min | ~5.5 min | ~7 min |
| 30 minutes | ~1.8 min | ~5.7 min | ~14 min | ~16 min | ~20 min |
| 1 hour | ~3.6 min | ~11 min | ~28 min | ~32 min | ~39 min |
| 2 hours | ~7 min | ~23 min | ~56 min | ~63 min | ~79 min |
Processing factors:
Problem: torch fails to install on Apple Silicon
# Use the dedicated Apple Silicon build
pip install --upgrade torch torchvision torchaudio
Problem: FFmpeg not found
ffmpeg -version
# If missing, install via Homebrew (macOS)
brew install ffmpeg
Problem: Out of memory
# Switch to a smaller Whisper model
python -m src.main --url "..." --transcribe whisper_base
Problem: Model not found
models/ directory is writableProblem: Processing is slow
whisper_base instead of whisper_smallSafe to ignore: Speaker diarization warnings
UserWarning: torchcodec is not installed correctly — Audio loading uses soundfile/librosa fallback (works correctly)UserWarning: std(): degrees of freedom is <= 0 — Internal pyannote calculation (does not affect results)UserWarning: Lightning automatically upgraded your loaded checkpoint — PyTorch Lightning version compatibility (does not affect results)The tool now uses Silero VAD by default for speech boundary detection when splitting large audio files. Silero VAD offers:
For optimal performance:
--speakers flag)python -c "from lightning.pytorch.cli import LightningCLI; LightningCLI(run=False)"
Performance improvements in v1.6:
# Install dev dependencies
pip install -r requirements-dev.txt
# Run tests
pytest tests/
# Coverage report
pytest --cov=src tests/
# Video title
## Translation
Method: NLLB
[00:15] Hello everyone! Today we will talk about...
[01:32] The first important topic is...
## Transcript
Method: whisper_base
[00:15] Hello everyone! Today we'll talk about...
[01:32] The first important topic is...
Uses the same layout with Markdown syntax.
Pull requests are welcome! For major changes, open an issue first to discuss what you would like to improve.
git checkout -b feature/amazing-feature)git commit -m 'Add amazing feature')git push origin feature/amazing-feature)LICENSE for details.For questions or suggestions, please open an issue in this repository.
whisper_medium for critical contentqwen2.5:7b for best results--refine-model to produce a clean transcriptwhisper_base — high throughputwhisper_medium — best accuracyqwen2.5:3b — fast refinementqwen2.5:7b — highest quality~/.cache/whisper/ (~140 MB – 1.5 GB)ollama list and ollama rm <model>35 commits
Python
99.8%
AI-powered audio/video processing: transcription, speaker diarization, LLM refinement, translation | AI-обработка аудио/видео: транскрибация, распознавание спикеров, перевод
4
stars
35
commits
Python
primary language
Nov 27, 2025
updated
A flexible toolkit for transcribing and translating YouTube videos, audio files, and existing documents.
gigaam-e2e-rnnt / gigaam-e2e-ctc via Hugging Face (transformers, torch ≥ 2.6)tests/test_gigaam_backend.py)--speakers flaggit clone <repository-url>
cd yt-transcriber
python -m venv venv
# macOS/Linux
source venv/bin/activate
# Windows
venv\Scripts\activate
macOS
brew install ffmpeg
Linux (Ubuntu/Debian)
sudo apt update
sudo apt install ffmpeg
Windows
Download a build from ffmpeg.org and add it to your PATH.
pip install --upgrade pip
pip install -r requirements.txt
macOS/Linux
# Install Ollama
curl -fsSL https://ollama.com/install.sh | sh
# Recommended models
ollama pull qwen2.5:3b # Fast, good quality (~3 GB)
ollama pull qwen2.5:7b # Slower, higher quality (~7 GB)
# Start the server (if not already running)
ollama serve
Windows Download the installer from ollama.com.
Create a .env file in the project root:
# Enable OpenAI integration (experimental)
OPENAI_API_KEY=your_api_key_here
# Logging level
LOG_LEVEL=INFO
python -m src.main youtube --url "https://youtube.com/watch?v=dQw4w9WgXcQ" --transcribe whisper-base
python -m src.main youtube \
--url "https://youtube.com/watch?v=dQw4w9WgXcQ" \
--transcribe whisper-base \
--translate nllb
python -m src.main audio \
--input audio.mp3 \
--transcribe whisper-medium \
--translate nllb
python -m src.main video \
--input video.mp4 \
--transcribe whisper-medium \
--translate nllb
Supported video formats: MP4, MKV, AVI, MOV, and any format supported by FFmpeg.
python -m src.main audio \
--input audio.mp3 \
--transcribe whisper-medium \
--refine-model qwen2.5:7b \
--translate nllb
Produces two documents:
audio_original.docx/md — raw transcript without translationaudio_refined.docx/md — polished transcript with translationAdd LLM polish for the translation as well (Ollama backend):
python -m src.main audio \
--input audio.mp3 \
--transcribe whisper-medium \
--refine-model qwen2.5:7b \
--translate nllb \
--refine-translation qwen2.5:3b
Use OpenAI GPT-4o Mini for refinement (requires OPENAI_API_KEY):
python -m src.main audio \
--input audio.mp3 \
--transcribe whisper-medium \
--refine-backend openai-api \
--refine-model gpt-4o-mini-2024-07-18
gpt-4o-mini is an alias; the full dated ID keeps you on a fixed model version.
# Create prompt.txt with project-specific terms
# FIDE, Hikaru Nakamura, Magnus Carlsen, chess tournament
python -m src.main youtube \
--url "https://youtube.com/watch?v=YOUR_VIDEO_ID" \
--transcribe whisper-base \
--prompt-file prompt.txt
# Transcribe with automatic speaker identification
python -m src.main youtube \
--url "https://youtube.com/watch?v=YOUR_VIDEO_ID" \
--transcribe whisper-medium \
--speakers
Requirements for speaker diarization:
export HF_TOKEN=your_token_here (add to ~/.zshrc or ~/.bashrc)Output will include speaker labels:
[00:00] [SPEAKER_00] Hello everyone, welcome to the show
[00:05] [SPEAKER_01] Thanks for having me
[00:08] [SPEAKER_00] Let's get started with today's topic
facebook/nllb-200-distilled-1.3B is released under CC BY-NC 4.0 (non-commercial). Use a different model or obtain a licence for commercial scenarios.# Improve an existing transcript
python -m src.main text --input output/document.md --refine-model qwen2.5:7b
# Translate a document
python -m src.main text --input transcription.docx --translate nllb
# Refine and translate
python -m src.main text --input document.txt --refine-model qwen2.5:7b --translate nllb
Supported formats: .md, .docx, .txt
python -m src.main --help
python -m src.main youtube --help
python -m src.main audio --help
python -m src.main <command> [options]
Commands:
youtube — Process a YouTube videoaudio — Process a local audio filevideo — Process a local video filetext — Process a text document| Option | Description | Example |
|---|---|---|
--transcribe | Transcription method | --transcribe whisper-base |
--translate | Translation method | --translate nllb |
--refine-model | Model for refinement | --refine-model qwen2.5:7b |
--refine-backend | Backend for transcript refinement (not translation) | --refine-backend ollama |
--prompt-file | Custom Whisper prompt file | --prompt-file prompt.txt |
--nllb-model | NLLB model override | --nllb-model facebook/nllb-200-distilled-600M |
--refine-translation | LLM polish for the translated text (Ollama) | --refine-translation qwen2.5:3b |
--speakers | Enable speaker diarization | --speakers |
--summarize-model | Model for summarization | --summarize-model qwen2.5:7b |
--help | Show help | --help |
Note: --refine-backend only switches the backend for transcript refinement (--refine-model). Translation polishing uses --refine-translation and the Ollama backend.
Transcription
whisper-base — fast, good qualitywhisper-small — slower, higher qualitywhisper-medium — slowest, best qualitywhisper-openai-api — OpenAI Whisper API (requires OPENAI_API_KEY)gigaam-e2e-rnnt — GigaAM v3 (RU), максимальное качество + пунктуация/нормализацияgigaam-e2e-ctc — GigaAM v3 (RU), быстрее, чуть проще моделиRefinement (requires Ollama or OpenAI API)
qwen2.5:3b — fast, 3 GB (recommended)qwen2.5:7b — slower, better qualityllama3.2:3b — fast, solid qualityllama3:8b — slower, higher qualitymistral:7b — balancedgpt-4o-mini-2024-07-18 — OpenAI GPT-4o Mini (API; alias gpt-4o-mini also works)Translation
nllb — Meta NLLB (local, free)openai-api — OpenAI GPT API (requires OPENAI_API_KEY)yt-transcriber/
├── src/ # Source code
│ ├── main.py # Entry point
│ ├── config.py # Configuration
│ ├── downloader.py # YouTube downloads
│ ├── transcriber.py # Transcription
│ ├── text_reader.py # Text ingestion
│ ├── translator.py # Translation
│ ├── text_refiner.py # LLM-based refinement
│ ├── document_writer.py # Document generation
│ ├── utils.py # Utilities
│ └── logger.py # Logging setup
├── tests/ # Automated tests
├── output/ # Generated docs
├── temp/ # Temporary files
├── logs/ # Logs
├── requirements.txt # Runtime dependencies
├── .env.example # Sample configuration
└── README.md # Documentation
Note: Whisper and NLLB models are cached in ~/.cache/ on first run.
Main settings live in src/config.py:
# Paths
OUTPUT_DIR = "output" # Output folder
TEMP_DIR = "temp" # Temporary files
LOGS_DIR = "logs" # Logs
# Models
WHISPER_DEVICE = "mps" # cpu/cuda/mps (auto-switch for M1)
NLLB_MODEL_NAME = "facebook/nllb-200-distilled-600M"
# Logging
LOG_LEVEL = "INFO" # DEBUG/INFO/WARNING/ERROR
Approximate processing time on a MacBook Air M1 (16 GB, CPU):
| Video length | whisper_base | whisper_small | NLLB translation | Total (base+translate) | Total (small+translate) |
|---|---|---|---|---|---|
| 3 minutes | ~11 s | ~34 s | ~1.5 min | ~2 min | ~3 min |
| 10 minutes | ~36 s | ~2 min | ~5 min | ~5.5 min | ~7 min |
| 30 minutes | ~1.8 min | ~5.7 min | ~14 min | ~16 min | ~20 min |
| 1 hour | ~3.6 min | ~11 min | ~28 min | ~32 min | ~39 min |
| 2 hours | ~7 min | ~23 min | ~56 min | ~63 min | ~79 min |
Processing factors:
Problem: torch fails to install on Apple Silicon
# Use the dedicated Apple Silicon build
pip install --upgrade torch torchvision torchaudio
Problem: FFmpeg not found
ffmpeg -version
# If missing, install via Homebrew (macOS)
brew install ffmpeg
Problem: Out of memory
# Switch to a smaller Whisper model
python -m src.main --url "..." --transcribe whisper_base
Problem: Model not found
models/ directory is writableProblem: Processing is slow
whisper_base instead of whisper_smallSafe to ignore: Speaker diarization warnings
UserWarning: torchcodec is not installed correctly — Audio loading uses soundfile/librosa fallback (works correctly)UserWarning: std(): degrees of freedom is <= 0 — Internal pyannote calculation (does not affect results)UserWarning: Lightning automatically upgraded your loaded checkpoint — PyTorch Lightning version compatibility (does not affect results)The tool now uses Silero VAD by default for speech boundary detection when splitting large audio files. Silero VAD offers:
For optimal performance:
--speakers flag)python -c "from lightning.pytorch.cli import LightningCLI; LightningCLI(run=False)"
Performance improvements in v1.6:
# Install dev dependencies
pip install -r requirements-dev.txt
# Run tests
pytest tests/
# Coverage report
pytest --cov=src tests/
# Video title
## Translation
Method: NLLB
[00:15] Hello everyone! Today we will talk about...
[01:32] The first important topic is...
## Transcript
Method: whisper_base
[00:15] Hello everyone! Today we'll talk about...
[01:32] The first important topic is...
Uses the same layout with Markdown syntax.
Pull requests are welcome! For major changes, open an issue first to discuss what you would like to improve.
git checkout -b feature/amazing-feature)git commit -m 'Add amazing feature')git push origin feature/amazing-feature)LICENSE for details.For questions or suggestions, please open an issue in this repository.
whisper_medium for critical contentqwen2.5:7b for best results--refine-model to produce a clean transcriptwhisper_base — high throughputwhisper_medium — best accuracyqwen2.5:3b — fast refinementqwen2.5:7b — highest quality~/.cache/whisper/ (~140 MB – 1.5 GB)ollama list and ollama rm <model>35 commits
Python
99.8%