yt-tabs is a command-line tool that extracts guitar sheet/tab images from YouTube videos and optionally compiles them into a PDF.
The pipeline is:
- Download the video.
- Extract frames with FFmpeg.
- Detect sheet/tab regions from frames.
- Save sheet images and/or generate a PDF.
The project also includes a cache management CLI so you can inspect and clean generated artifacts (videos, frames, sheets, and PDFs).
- Python 3.10+ (recommended)
- FFmpeg available in your system
PATH
pip install -r requirements.txtpip install -e .After installation, the CLI command is available as:
yt-tabs --helpyt-tabs extract <youtube_url> [OPTIONS]Generate a PDF:
yt-tabs extract "https://www.youtube.com/watch?v=<id>" --out-pdf output.pdfSave detected sheets as images (without generating PDF):
yt-tabs extract "https://www.youtube.com/watch?v=<id>" --save-sheetsReuse previously cached sheets when generating PDF:
yt-tabs extract "https://www.youtube.com/watch?v=<id>" --use-sheets-cache --out-pdf output.pdfUse debug logging:
yt-tabs --verbose extract "https://www.youtube.com/watch?v=<id>" --out-pdf output.pdfList cache entries:
yt-tabs cache listShow cache size:
yt-tabs cache sizeClear all cache data:
yt-tabs cache clearPurge specific artifact types:
yt-tabs cache purge-videos [VIDEO_ID]
yt-tabs cache purge-frames [VIDEO_ID]
yt-tabs cache purge-sheets [VIDEO_ID]
yt-tabs cache purge-pdfs [VIDEO_ID]You can configure extraction behavior in three ways:
- Default config (built-in values)
- Profile-based config (
--profile) - Explicit overrides via CLI flags
Available profiles:
extra_safesafeaggressive
Example:
yt-tabs extract "https://www.youtube.com/watch?v=<id>" --profile safe --out-pdf output.pdfYou can load a simple key-value config file with --config-file.
Example file:
fps=1
qscale=3
frame_diff_threshold=0.025
sheet_intensity_threshold=200
staff_pattern_match_thresh=0.8Usage:
yt-tabs extract "https://www.youtube.com/watch?v=<id>" --config-file ./config.ini --out-pdf output.pdfNote: keys can be written with underscores (e.g.
frame_diff_threshold).
All runtime parameters from the Config dataclass are exposed as CLI flags in yt-tabs extract.
You can inspect all options with:
yt-tabs extract --helpImportant customization flags include:
--cache-path: cache directory--video-download-path: where downloaded videos are stored--fps,--qscale: frame extraction parameters--sheet-intensity-threshold: sheet detection sensitivity--frame-diff-threshold: frame difference threshold--initial-frame-offset,--intersheet-discards: frame selection tuning--pixel-avg-window-size: sheet Y-position estimation window--staff-pattern-width,--staff-line-thickness,--staff-space-to-line-ratio,--staff-lines: staff pattern geometry--staff-min-scale-percent,--staff-max-scale-percent: template matching scale range--staff-pattern-match-thresh: staff matching confidence threshold--sheet-area-ratio: minimum sheet area ratio in frame
Example with custom detection tuning:
yt-tabs extract "https://www.youtube.com/watch?v=<id>" \
--fps 2 \
--frame-diff-threshold 0.02 \
--sheet-intensity-threshold 190 \
--staff-line-thickness 1 \
--out-pdf tuned-output.pdfThis is a sample from the result of the latest stages of the extraction pipeline. You can check the full breakdown of the pipeline here
![]() |
|---|
| Sheet extraction pipeline result |
Run tests with coverage:
pytest --cov=src --cov-report=term-missing --cov-report=html