AI-powered video lecture transcription, analysis, and subtitle generation
Project description
๐ฌ AI Video Lecture Assistant
Automatically transcribe, analyze, and add subtitles to educational videos using AI
Transform your video lectures into searchable transcripts, insightful summaries, study quizzes, and videos with professional subtitles - all running 100% locally with no API costs!
Created by Aditya Takawale
โจ Features
- ๐ค Accurate Transcription - Powered by OpenAI Whisper (supports 99+ languages)
- ๐ค AI Analysis - Generate summaries, key insights, and quiz questions using Ollama
- ๏ฟฝ Embedded Subtitles - Creates video files with toggleable subtitle tracks
- ๐ Word Documents - Professional analysis reports in .docx format
- ๐ 100% Local & Private - No cloud APIs, no data leaves your computer
- ๐ฐ Zero Cost - Completely free to use, no API keys required
๐ Quick Start
Prerequisites
- Python 3.9+ installed
- FFmpeg installed (see platform-specific instructions below)
- Ollama installed and running (Download here)
Platform-Specific Setup
๐ช Windows Setup
# 1. Install FFmpeg (choose one method)
# Method A: Using Chocolatey (recommended)
choco install ffmpeg
# Method B: Using Scoop
scoop install ffmpeg
# Method C: Manual download from https://ffmpeg.org/download.html
# 2. Verify FFmpeg installation
ffmpeg -version
# 3. Install Ollama from https://ollama.ai
# 4. Continue with "Installation" steps below
๐ macOS Setup
# 1. Install Homebrew (if not installed)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# 2. Install FFmpeg
brew install ffmpeg
# 3. Install Ollama
brew install ollama
# 4. Verify installations
ffmpeg -version
ollama --version
# 5. Continue with "Installation" steps below
๐ง Linux Setup
# Ubuntu/Debian
sudo apt update
sudo apt install ffmpeg
curl -fsSL https://ollama.ai/install.sh | sh
# Fedora/RHEL
sudo dnf install ffmpeg
curl -fsSL https://ollama.ai/install.sh | sh
# Arch Linux
sudo pacman -S ffmpeg
curl -fsSL https://ollama.ai/install.sh | sh
# Verify installations
ffmpeg -version
ollama --version
# Continue with "Installation" steps below
Installation
Windows:
# 1. Clone/download this repository
cd c:\Developer\ai-summary
# 2. Create virtual environment
python -m venv .venv
# 3. Activate virtual environment
.venv\Scripts\activate
# 4. Install dependencies
pip install -r requirements.txt
# 5. Start Ollama (in a separate terminal)
ollama serve
# 6. Pull the AI model
ollama pull llama3.1
macOS/Linux:
# 1. Clone/download this repository
cd ~/ai-summary
# 2. Create virtual environment
python3 -m venv .venv
# 3. Activate virtual environment
source .venv/bin/activate
# 4. Install dependencies
pip install -r requirements.txt
# 5. Start Ollama (in a separate terminal)
ollama serve
# 6. Pull the AI model
ollama pull llama3.1
โก Easy Usage - Simple Script
Simplest method - Just drag and drop:
process_video.bat "my_lecture.mp4"
Or drag-and-drop your video file onto process_video.bat!
Advanced Usage
# Full processing with all options
python embed_subtitles.py video.mp4 --keep-srt
# Use better Whisper model for higher accuracy
python embed_subtitles.py video.mp4 -m small
# Custom output directory
python embed_subtitles.py video.mp4 -o my_outputs
# Use different AI model
python embed_subtitles.py video.mp4 --ollama-model llama3.2
๐ Output Files
After processing my_lecture.mp4, you'll get:
outputs/
โโโ my_lecture_with_subtitles.mp4 โ Video with embedded subtitle track
โโโ my_lecture_subtitles.srt โ Standalone subtitle file
โโโ my_lecture_analysis.docx โ Word document with analysis
โโโ my_lecture_analysis.json โ JSON data
How to Use the Video with Subtitles
- Open
my_lecture_with_subtitles.mp4in VLC, Windows Media Player, or any video player - Look for the "Subtitles" or "CC" button in player controls
- Toggle subtitles ON/OFF as needed!
๐ฆ Distribution Options
Option 1: Share Source Code (Recommended for Developers)
# 1. Share the entire folder
# 2. Recipients install Python + Ollama
# 3. Recipients run: pip install -r requirements.txt
# 4. Ready to use!
Option 2: Standalone Executable (For End Users)
# Install PyInstaller
pip install pyinstaller
# Create executable
pyinstaller --onefile --name="AI-Video-Processor" embed_subtitles.py
# Distribute: dist/AI-Video-Processor.exe + include instructions to install Ollama
Note: Users will still need Ollama installed (AI models are too large to bundle ~4GB+).
Option 3: Complete Installer Package
Use Inno Setup or NSIS to create a professional installer:
- Bundles Python runtime
- Auto-installs dependencies
- Creates desktop shortcuts
- Includes Ollama installer link
โก Optimizations & Improvements
Current Performance
- Processing Time: ~5-10 minutes for 10-minute video (base model)
- Accuracy: 95-99% transcription, 75-90% AI analysis quality
Suggested Optimizations
1. GPU Acceleration (Faster transcription)
# Edit transcriber.py, change:
result = model.transcribe(audio_path, fp16=False) # CPU
# To:
result = model.transcribe(audio_path, fp16=True) # GPU (10x faster!)
2. Batch Processing Script
# Process multiple videos at once
python batch_process_all.py videos/*.mp4
3. Quality vs Speed Trade-offs
# Ultra-fast (2-3 min for 10-min video, lower accuracy)
python embed_subtitles.py video.mp4 -m tiny
# Balanced (default, 5-10 min)
python embed_subtitles.py video.mp4 -m base
# High quality (15-30 min, best accuracy)
python embed_subtitles.py video.mp4 -m medium
4. Model Caching (Already implemented)
- Whisper model loads once and stays in memory
- Ollama runs as persistent service
5. Parallel Processing
- Process video + audio analysis simultaneously
- Use multiprocessing for batch operations
๐ง Advanced Features to Add
Low-hanging fruit:
- โ Batch processing multiple videos
- โ Progress bars with estimated time remaining
- โ Email/notification when long processing completes
- โ Custom AI prompts for specialized content
Medium complexity: 5. ๐น Chapter detection and timestamps 6. ๐จ Custom subtitle styling (fonts, colors, positioning) 7. ๐ Web interface (Flask/FastAPI + React) 8. ๐ฑ Mobile app companion
Advanced: 9. ๐ฃ๏ธ Speaker diarization (identify different speakers) 10. ๐ Auto-generate highlight reels 11. ๐ Anki flashcard export 12. ๐ด Real-time processing during live streams
๐ ๏ธ Technical Architecture
Video File (.mp4, .avi, etc.)
โ
1. Audio Extraction (moviepy)
โ
2. Speech-to-Text (Whisper AI) โ Timestamped segments
โ
3. Content Analysis (Ollama LLM) โ Summary + Insights + Quiz
โ
4. Subtitle Generation (SRT format)
โ
5. Subtitle Embedding (FFmpeg) โ mov_text codec
โ
Output: Video with subtitles + Word doc + JSON
Models & Technologies
- Whisper (base model ~140MB) - 99 language support
- Ollama llama3.1 (~4.7GB) - Local LLM, no API calls
- FFmpeg - Video processing
- python-docx - Document generation
๐ System Requirements
Minimum:
- OS: Windows 10/11, macOS 10.15+, Linux (Ubuntu 18.04+, Fedora 30+, Arch)
- RAM: 4GB
- Storage: 8GB (models + videos)
- CPU: Any modern processor
Recommended:
- RAM: 8GB+
- Storage: 20GB+ SSD
- GPU: NVIDIA with CUDA support (10x faster on Windows/Linux)
- GPU: Apple Silicon M1/M2/M3 (Metal acceleration on macOS)
๐ Troubleshooting
FFmpeg Not Found
Error: [Errno 2] No such file or directory: 'ffmpeg'
Solution:
# macOS
brew install ffmpeg
# Ubuntu/Debian
sudo apt install ffmpeg
# Windows (Chocolatey)
choco install ffmpeg
# Verify installation
ffmpeg -version
SSL Certificate Error (macOS)
Error: ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED]
Solution:
# Run the Install Certificates command
/Applications/Python\ 3.12/Install\ Certificates.command
# OR use Homebrew Python (includes certificates)
brew install python@3.12
Ollama Connection Error
Error: Connection refused to localhost:11434
Solution:
# Start Ollama server
ollama serve
# In another terminal, verify model is installed
ollama list
ollama pull llama3.1
Out of Memory Error
Error: RuntimeError: CUDA out of memory
Solution:
# Use a smaller Whisper model
python embed_subtitles.py video.mp4 -m tiny # or -m base
# Process shorter videos
# Consider splitting long videos into segments
Import Errors
Error: ModuleNotFoundError: No module named 'ai_video_assistant'
Solution:
# Make sure virtual environment is activated
# Windows
.venv\Scripts\activate
# macOS/Linux
source .venv/bin/activate
# Reinstall package
pip install -r requirements.txt
Permission Errors (Linux/macOS)
Error: PermissionError: [Errno 13]
Solution:
# Make sure you have write permissions
chmod +w ./outputs
chmod +w ./temp_audio
# Don't run with sudo unless necessary
๐จโ๐ป Author
Aditya Takawale
- GitHub: @Aditya-Takawale
- Repository: AI-Summary
๐ License
MIT License - See LICENSE file for details
Copyright ยฉ 2025 Aditya Takawale
๐ Acknowledgments
Built with:
- OpenAI Whisper - Speech recognition (MIT License)
- Ollama - Local AI models (MIT License)
- MoviePy - Video processing (MIT License)
- FFmpeg - Media processing (LGPL)
This project is an independent integration of these tools and is not affiliated with or endorsed by OpenAI, Ollama, or any of the above projects.
โ๏ธ Disclaimer
This software is provided "as is" for educational and personal use. Users are responsible for:
- Complying with copyright laws when processing videos
- Respecting terms of service of video platforms
- Using this tool ethically and legally
- Not redistributing copyrighted content without permission
The author is not responsible for misuse of this software.
๐ Support
If you find this project helpful, please give it a โญ๏ธ on GitHub!
Report Issues: GitHub Issues
Built with โค๏ธ by Aditya Takawale | 100% Local, 100% Free, 100% Private
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ai_video_assistant-1.0.5.tar.gz.
File metadata
- Download URL: ai_video_assistant-1.0.5.tar.gz
- Upload date:
- Size: 25.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1b4d24c88cb526669f33a9b4a637435879e644844f69a59b3399f905a165bfe7
|
|
| MD5 |
eaf79bf7487b10e77205727db50a866d
|
|
| BLAKE2b-256 |
c8a64b47cf7b836929b8c07bd4169cb890d79701e06c90884c6a9748b93b7747
|
File details
Details for the file ai_video_assistant-1.0.5-py3-none-any.whl.
File metadata
- Download URL: ai_video_assistant-1.0.5-py3-none-any.whl
- Upload date:
- Size: 22.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c006703f5ad7867313cb07e63fc99eb595f19d1ea116e352b0f2db06c3dd23f7
|
|
| MD5 |
fa13c8579281a8fc218166bac1d5a9a5
|
|
| BLAKE2b-256 |
3ccb4b3ad5f7c0f44be5c3de0441f934b8d7af2afdb20c5c333c7813ad877022
|