Show HN: YouTube Guitar Tab Parser

marcelpanse/youtube-guitar-tab-parser
main
Branches
Tags
Go to file
Code
Open more actions menu
Folders and files
Name
Name
Last commit message
Last commit date
Latest commit
History
2 Commits
2 Commits
src
src
.DS_Store
.DS_Store
.env.example
.env.example
.gitignore
.gitignore
README.md
README.md
package-lock.json
package-lock.json
package.json
package.json
tab-parser.iml
tab-parser.iml
tsconfig.json
tsconfig.json
View all files
Repository files navigation
README
More
items
Youtube Guitar Tab Parser
CLI that turns a YouTube guitar-lesson video into a PDF of the guitar tab.
It downloads the video, samples frames, uses Claude vision to locate the tab
region, crops every frame to that region, de-duplicates the crops by the bar
number printed on each line of the score, and stitches the distinct tab lines
vertically into a PDF. It works out of the box with no configuration — the PDF
is written to
out/.pdf
, with the video title as a heading on the
first page and in the document metadata.
Requirements
Node.js ≥ 20
yt-dlp
and
ffmpeg
on your
PATH
(
brew install yt-dlp ffmpeg
)
An Anthropic API key
Setup
npm install
npm run build
cp .env.example .env
#
then put your ANTHROPIC_API_KEY in it
Usage
#
with a .env file
node –env-file=.env dist/cli.js
”

”
#
or with the key already exported
export
ANTHROPIC_API_KEY=sk-ant-…
node dist/cli.js
”

”
During development you can skip the build step:
node –env-file=.env –import tsx src/cli.ts
”

”
The result is written to
out/.pdf
(its path is also printed to
stdout); progress goes to stderr.
Options
Everything has a sensible default; you normally only need the URL.
-i, –interval screenshot interval (default 2)
–model Claude vision model (default claude-sonnet-5)
–sample frames sampled for tab-region detection (default 6)
–dedup-threshold pre-dedup Hamming distance, cost control (default 12)
–max-height cap download resolution (default 720)
–keep-temp keep intermediate frames/crops
How it works
Download
—
yt-dlp
fetches the video (≤
–max-height
).
Frames
—
ffmpeg
extracts one frame every
–interval
seconds.
Detect
— a labeled horizontal-band grid is drawn on
–sample
frames and
Claude vision reports which bands contain sheet music. The median first/last
music band (robust to an outlier) gives the vertical extent; width is kept full.
(Coarse labeled bands are far more reliable than asking a vision model for
precise pixel coordinates.)
Crop
—
sharp
crops every frame to that region.
Pre-dedup
— a dHash perceptual hash drops near-identical consecutive crops.
This is only a cost control to reduce the number of vision calls in the next step.
Bar-number dedup
— Claude reads the measure/bar number printed at the start
of each line and whether the crop is real sheet music. The tool keeps exactly
one crop per distinct bar number (first appearance wins) and drops non-tab
crops (title cards, intros/outros). Because the bar number is constant while
the playback cursor sweeps a line and only changes when the score advances,
this collapses all the near-identical cursor frames of a line into a single page.
PDF
—
pdf-lib
stacks the distinct tab lines vertically down A4 pages,
in the order they appear in the video. The video title (read from
yt-dlp
)
becomes the file name, a heading on the first page, and the document metadata
title. Output:
out/.pdf
.
About
CLI that turns a YouTube guitar-lesson video into a PDF of the guitar tab.
Resources
Readme
Uh oh!
There was an error while loading.
Please reload this page
.
Activity
Stars
48
stars
Watchers
0
watching
Forks
1
fork
Report repository
Releases
No releases published
Packages
0
Uh oh!
There was an error while loading.
Please reload this page
.
Contributors
Uh oh!
There was an error while loading.
Please reload this page
.
Languages
TypeScript
92.0%
JavaScript
8.0%