
ytsled
io.github.ChinmayShanbhag/ytsled
Search local video transcripts and retrieve timestamped captions, chapters, and archive statistics.
Documentation
ytsled
ytsled builds searchable transcript archives from YouTube, Twitch, Vimeo, Nebula, and the sites covered by yt-dlp’s 1,800+ extractors. yt-dlp handles extraction and downloads. ytsled indexes multilingual captions, preserves source URLs and chapters, and exposes the archive through search, MCP, a terminal UI, and offline exports. Live extraction depends on the installed yt-dlp version and the source site.
Installation
| Channel | Command |
|---|---|
| PyPI | pip install ytsled |
| Run with uv | uvx ytsled --help |
| Prebuilt with cargo-binstall | cargo binstall ytsled |
| Build from crates.io | cargo install ytsled --locked |
| Homebrew | brew install ChinmayShanbhag/tap/ytsled |
| Scoop | scoop install ytsled/ytsled |
| Docker | docker run --rm ghcr.io/chinmayshanbhag/ytsled:latest --help |
Before the first Scoop install, run scoop bucket add ytsled https://github.com/ChinmayShanbhag/scoop-bucket.
The Docker image includes yt-dlp and FFmpeg. Mount your archive directory at /data to keep the database and exports between runs. On Linux, use your user ID for write access to that directory.
docker run --rm --user "$(id -u):$(id -g)" -v "$PWD:/data" ghcr.io/chinmayshanbhag/ytsled:latest stats
Prebuilt binaries
Download the archive for your operating system and CPU from GitHub Releases.
| Platform | Archive | Executable |
|---|---|---|
| Windows x86-64 | ytsled-x86_64-pc-windows-msvc.zip | ytsled.exe |
| Linux x86-64 | ytsled-x86_64-unknown-linux-gnu.tar.gz | ytsled |
| Linux ARM64 | ytsled-aarch64-unknown-linux-gnu.tar.gz | ytsled |
| macOS Apple silicon | ytsled-aarch64-apple-darwin.tar.gz | ytsled |
| macOS Intel | ytsled-x86_64-apple-darwin.tar.gz | ytsled |
Extract the archive and put the executable in a directory on your PATH.
Build from source
Source builds and cargo install require a current stable Rust toolchain and the platform's C build tools for bundled SQLite.
git clone https://github.com/ChinmayShanbhag/ytsled.git
cd ytsled
cargo install --path . --locked
Install yt-dlp for sync and put it on your PATH, or pass its location with --yt-dlp. Import and cleanup work with local files.
Usage
The default archive is ytsled.db in the working directory. Use --database PATH to choose a different archive.
Check your environment
ytsled doctor
ytsled --database ./archive.db doctor --json
Doctor checks the executables on your PATH, the yt-dlp version, SQLite and FTS5, and the database location, size, and free disk space. It reports missing tools with install hints and works before a database exists.
Sync a channel or playlist
ytsled sync "https://www.youtube.com/@RustVideos/videos" --concurrency 8
sync writes one JSONL file per captioned video to transcripts/ by default. Use --output DIR to change the destination and --language CODE to change the preferred caption language from English. It prefers manual subtitles and checks regional variants. yt-dlp handles subtitle downloads and retries, and may use FFmpeg to convert a track to SRT.
For scheduled runs, cap the playlist scan and restrict the upload dates.
ytsled sync "https://www.youtube.com/@RustVideos/videos" --since 7 --max-videos 50
--max-videos limits the first playlist entries inspected by yt-dlp, including IDs already archived. --since uses an inclusive UTC date cutoff. ytsled resolves missing dates and caches those it finds. Videos with unknown dates are filtered when --since is set.
Private or unavailable entries and videos without a matching caption track are recorded as skipped. Extraction or download errors become failed, and the batch continues. Failed and interrupted videos are retried on the next sync. Date-filtered entries can be picked up by a wider or unfiltered sync.
Pass site or download options directly to yt-dlp using shell-style quoting within the argument string.
ytsled sync "https://www.twitch.tv/example/videos" --ytdlp-args "--cookies-from-browser chrome --sleep-interval 3"
ytsled sync "https://vimeo.com/76979871" --media --ytdlp-args "-f 'best[height<=720]'"
Add --media on the initial sync to also download video or audio to the output directory's media/ folder. Some formats require FFmpeg.
Add --nfo to write media-server metadata during sync. When media is requested, the NFO sits beside the downloaded file.
Import a yt-dlp archive
ytsled import-archive ./archive.txt
Import a file created by yt-dlp --download-archive to mark its video IDs as completed before running sync.
Ingest a yt-dlp download
yt-dlp --write-subs --write-info-json --exec "ytsled ingest {}" "VIDEO_URL"
ytsled ingest "./Example video [dQw4w9WgXcQ].mp4" --nfo
The hook reads the video ID from the matching .info.json or yt-dlp's default Title [ID] filename. It cleans matching adjacent VTT and SRT files in place, writes a .jsonl transcript next to each, and records the downloaded ID in SQLite. Use --write-info-json with custom filenames.
Transcribe media when subtitles are missing
ytsled ingest "./Recording [meeting01].wav" --transcribe-cmd "whisper-cli -m base.bin -ovtt -of {output} {input}"
ytsled sync "VIDEO_URL" --ytdlp-args "-f bestaudio" --transcribe-cmd "my-transcriber {input} {output}"
The command runs as an executable with arguments. {input} expands to the absolute media path and {output} to the path without its extension. Have the command write VTT or SRT beside the input, such as {output}.en.vtt or the default {input}.vtt from Whisper. Use a transcriber or wrapper that accepts your media format. Sync downloads media for the fallback when yt-dlp advertises no caption tracks, and it rechecks earlier no-caption skips when the fallback is configured.
Clean existing subtitles
Put your VTT or SRT files under captions/, then choose an output format.
ytsled clean-subs ./captions --output ./dataset --format jsonl
ytsled clean-subs ./captions --output ./markdown --format md --timestamps
ytsled clean-subs ./captions --output ./text --format txt
ytsled clean-subs ./captions --output ./spanish --format jsonl --lang es
--format jsonl combines the selected inputs into transcripts.jsonl with one record per source file. Each record has a video ID, title, language, full text, and timed segments. A suffix such as .en, .ja, or .pt-BR identifies the track. Unlabeled tracks use und. SQLite stores one track per video and language. --lang matches the normalized code exactly.
--format txt and --format md mirror the source directory structure and append the output extension to each filename, so clip.srt and clip.vtt produce distinct files. Add --timestamps to include segment start times.
Export chunks for retrieval
ytsled clean-subs ./captions --output ./chunks --format jsonl --chunk-words 250 --chunk-overlap 30
Chunk mode writes one JSONL record per overlapping window with video_id, title, a zero-based chunk_index, start and end in seconds, text, and chapter_title. Word counts use whitespace boundaries. The overlap defaults to 30 words and must be smaller than the chunk size. Timing uses inline WebVTT timestamps where available and estimates word boundaries within untimed cues. Native chapters take precedence over timestamp lines in the video description. Local cleanup reads chapters from an adjacent .info.json file when present.
Search the archive
ytsled search "async rust" --channel "Rust" --limit 10
ytsled search "memory safety" --lang en --json
SQLite FTS5 ranks transcript matches and returns snippets, chapter titles, languages, and timestamped video links. It uses YouTube and Twitch query parameters and Vimeo or generic time fragments. Opening an older archive migrates its saved tracks. Run reindex to recover languages and source URLs from the sidecars and subtitles you have.
Optional semantic search
cargo install ytsled --locked --features semantic
ytsled search "how tasks run concurrently" --semantic
Semantic builds use FastEmbed with the AllMiniLM-L6-v2 model and fuse cosine similarity with FTS5 rankings. Install a compatible ONNX Runtime 1.24 or newer and point ORT_DYLIB_PATH to its shared library. FastEmbed retrieves the model on first use and can use the cached model offline afterward. Set FASTEMBED_CACHE_DIR to select the model cache directory. The default build uses FTS5 without model or ONNX dependencies.
Connect an MCP client
ytsled mcp serves the archive over local stdio. Paste this mcpServers configuration into Claude Code, Cursor, or Windsurf. Replace the database path with your absolute path and place ytsled on the client's PATH.
{
"mcpServers": {
"ytsled": {
"command": "ytsled",
"args": ["--database", "/absolute/path/to/ytsled.db", "mcp"]
}
}
}
The server exposes search_archive, get_transcript, list_channels, and archive_stats. Pass lang to either transcript tool to select a language.
MCP Registry ID mcp-name: io.github.ChinmayShanbhag/ytsled.
Run a watchlist
ytsled watch --init
ytsled watch --config ytsled.toml
ytsled watch --config ytsled.toml --ytdlp-args "--sleep-interval 3"
Add one [[channels]] block per source. Paths are relative to the configuration file. The watchlist syncs each source in order and can export jsonl, md, nfo, and obsidian.
# Optional defaults, also configurable per source.
ytdlp_args = "--sleep-interval 3"
# transcribe_cmd = "my-transcriber {input} {output}"
[[channels]]
url = "https://www.youtube.com/@RustVideos/videos"
since = 7
max_videos = 20
output = "transcripts/rust"
formats = ["jsonl", "md", "nfo", "obsidian"]
chunk_words = 250
chunk_overlap = 30
The command-line options --ytdlp-args and --transcribe-cmd override the corresponding watchlist settings for that run.
Export metadata and a wiki
ytsled export-nfo ./downloads
ytsled export-wiki --output ./vault --format obsidian
ytsled export-wiki --output ./wiki --format html --lang en
NFO export writes XML sidecars beside existing .info.json files for media-library readers that support local NFO metadata. The Obsidian export creates video and channel notes with frontmatter, backlinks, chapters, and timestamp links. The HTML export creates a single searchable index.html that opens offline.
Reindex a local archive and pack context
ytsled reindex ./downloads
ytsled pack --query "memory safety" --channel "Rust" --lang en --max-tokens 12000 --output context.md
ytsled pack --lang en --max-tokens 32000 --output context.xml
reindex reads local .info.json, VTT, and SRT files in parallel and updates the SQLite index in batches without network access. It reports unreadable or empty captions on stderr and keeps unrelated archive records.
pack bundles matching tracks with source metadata, chapters, and timestamped links. The output extension selects Markdown or XML. The estimated token budget uses four UTF-8 bytes per token and counts the file’s markup. Actual token counts vary by model and language. The pack includes only whole cues that fit and reports the estimated tokens and number of distinct videos.
Inspect the archive
ytsled stats
ytsled dedupe --dry-run --input ./downloads
ytsled tui
stats reports archive duration, storage, transcript coverage, and top channels. dedupe reports repeated IDs across sources, title-and-duration matches, and orphaned sidecars. It leaves source files intact. Use --json with either command for structured stdout. In the TUI, use Tab to switch views, j/k or arrows to navigate, / to search, r to retry the selected failed item, and q to quit.
Terminal demo
Run vhs assets/demo.tape from the repository root to record a local playlist sync and chunked JSONL export. The demo uses a fixture and works without network access once the Rust dependencies are cached.
Architecture
syncreads the flat playlist fromyt-dlpand stages unprocessed IDs in a single SQLite transaction. It runs bounded yt-dlp download jobs, then records each result and indexes its captions.import-archiveimports the IDs in ayt-dlpdownload archive in a single transaction. Imported entries count as completed.clean-subsreads VTT and SRT files recursively with Rayon and writes JSONL, plain text, or Markdown.
Tests
CI runs formatting, Clippy with warnings denied, and the Rust tests on Windows, Linux, and Apple silicon macOS. The suite covers transactional archive import, rolling-caption deduplication, subtitle export, chunk timing, incremental sync, and the ingest hook. CI results
Benchmarks
Build in release mode, then run the standard-library benchmark with Python 3.10 or newer. It generates local fixtures in a temporary directory and prints a Markdown table.
cargo build --release --locked
python scripts/bench.py
The archive baseline scans the yt-dlp archive text once for 10,000 lookup requests. The subtitle baseline is a single-threaded Python cleaner that writes the same JSONL records for the generated fixtures. Times include process startup. The combined archive row adds import and lookup times for each trial, and archive peak RAM is the larger of the two process peaks.
The Windows 11 x86-64 run used Python 3.13.3 and three trials. Times are medians, and peak RAM is the maximum across the trials. The Linux x86-64 run used WSL2, Python 3.11.2, and one trial. Both runs reported 20 logical CPUs, used the v0.1.0 release build, and produced matching archive lookup counts and JSONL records.
| Workload | Windows baseline | Windows ytsled | Linux baseline | Linux ytsled |
|---|---|---|---|---|
| One-time import of 10,000 archive IDs | n/a | 0.254 s | n/a | 0.068 s |
| Lookup time for 10,000 archive IDs | 0.306 s | 0.331 s | 0.081 s | 0.085 s |
| Import and lookup time | 0.306 s | 0.578 s | 0.081 s | 0.153 s |
| Peak RAM for archive workload | 23.89 MiB | 24.96 MiB | 17.79 MiB | 18.18 MiB |
| Subtitle cleaning time for 5,000 VTT files | 5.460 s | 1.084 s | 2.950 s | 0.267 s |
| Subtitle cleaning speed | 916 files/s | 4,614 files/s | 1,695 files/s | 18,718 files/s |
| Peak RAM for subtitle cleaning | 31.77 MiB | 13.52 MiB | 18.74 MiB | 17.72 MiB |
Attribution
ytsled relies on the separate yt-dlp project and its extractor maintainers. See yt-dlp's license for its distribution terms. This project is licensed under Apache 2.0.
https://github.com/ChinmayShanbhag/ytsled/releases/download/v0.4.1/ytsled-aarch64-apple-darwin.mcpb# mcpb: https://github.com/ChinmayShanbhag/ytsled/releases/download/v0.4.1/ytsled-aarch64-apple-darwin.mcpbhttps://github.com/ChinmayShanbhag/ytsled/releases/download/v0.4.1/ytsled-x86_64-apple-darwin.mcpb# mcpb: https://github.com/ChinmayShanbhag/ytsled/releases/download/v0.4.1/ytsled-x86_64-apple-darwin.mcpbhttps://github.com/ChinmayShanbhag/ytsled/releases/download/v0.4.1/ytsled-aarch64-unknown-linux-gnu.mcpb# mcpb: https://github.com/ChinmayShanbhag/ytsled/releases/download/v0.4.1/ytsled-aarch64-unknown-linux-gnu.mcpbhttps://github.com/ChinmayShanbhag/ytsled/releases/download/v0.4.1/ytsled-x86_64-unknown-linux-gnu.mcpb# mcpb: https://github.com/ChinmayShanbhag/ytsled/releases/download/v0.4.1/ytsled-x86_64-unknown-linux-gnu.mcpbhttps://github.com/ChinmayShanbhag/ytsled/releases/download/v0.4.1/ytsled-x86_64-pc-windows-msvc.mcpb# mcpb: https://github.com/ChinmayShanbhag/ytsled/releases/download/v0.4.1/ytsled-x86_64-pc-windows-msvc.mcpb