Extract guitar tabs from YouTube videos and save them as a PDF, automatically.
- Downloads the video via yt-dlp
- Extracts frames every N seconds via ffmpeg
- Sends each frame to a local vision model (LLaVA via Ollama) to detect and read tab notation
- Deduplicates repeated frames
- Compiles everything into a formatted PDF
System:
sudo apt install ffmpegOllama:
Install Ollama and pull the vision model:
curl -fsSL https://ollama.com/install.sh | sudo sh
ollama pull llava
ollama servePython:
pip install yt-dlp ollama reportlab Pillowpython tabgrab.py "https://youtu.be/your_video"Options:
# Sample frames more frequently (good for fast-moving tabs)
python tabgrab.py "https://youtu.be/xxx" --interval 1
# Custom output file and PDF title
python tabgrab.py "https://youtu.be/xxx" --output mysong.pdf --title "Hotel California"
# Use a different Ollama vision model
python tabgrab.py "https://youtu.be/xxx" --model minicpm-v| Flag | Default | Description |
|---|---|---|
--interval |
2.0 |
Seconds between frame samples |
--output |
guitar_tabs.pdf |
Output PDF filename |
--title |
Guitar Tabs |
Title shown in the PDF |
--model |
llava |
Ollama vision model to use |
- If tabs are being missed, try
--interval 1to sample more frames - 720p download is used by default to keep things fast
- LLaVA works best on clean, high-contrast tab displays
- If accuracy is poor, try
minicpm-vas an alternative model:ollama pull minicpm-v
MIT