8000 feat(imports): take a video's own captions as its transcript by adeelahmad · Pull Request #624 · adeelahmad/lense · GitHub
[go: up one dir, main page]

Skip to content

feat(imports): take a video's own captions as its transcript - #624

Merged
adeelahmad merged 1 commit into
mainfrom
claude/project-thread-xfmkzn
Oct 18, 2026
Merged

adeelahmad merged 1 commit into
mainfrom
claude/project-thread-xfmkzn

Conversation

@adeelahmad
Copy link
Copy Markdown
Owner

Requested by Adeel · project thread

Description

Before: a video imported by its address was always transcribed, even when the site had captions people wrote for it.

After: with Settings › Documents › Use a video's own captions on (documents.video_captions, off by default), the written captions come down with the video (a site's subtitles, never its automatic ones) and become its transcript, so no speech model or provider is used. Lens takes the transcription language's captions, else the video's own language, else the first. The file is kept next to the media, encrypted like the rest when the namespace is, and the transcript's engine is import:captions. A video without such captions is transcribed as before.

How: mediaurl.py asks yt-dlp for --write-subs --no-write-auto-subs when the setting is on, picks a file, and use_captions writes it as the transcript through ingest.read_text_transcript; jobs.py tries it before transcribing.

Motivation and Context

Item from the personal feature plan sheet ("use existing subtitles instead of transcribing").

Screenshots (if appropriate):

n/a

Steps to reproduce (if appropriate):

Turn on Settings › Documents › Use a video's own captions, then import a video address that has subtitles.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change; ! in the title)

Checklist:

  • The title is a Conventional Commit.
  • My code follows the code style of this project (make hooks checks it on commit).
  • I added or updated tests (test_video_urls.py test_a_videos_own_captions_become_its_transcript).
  • My change requires documentation updates, and I have updated docs/ accordingly (docs/api.md, Videos and podcasts).
  • Users need more than the title to understand it, so I wrote it under ## Unreleased in CHANGELOG.md. Written as changelog.d/captions.md, per build(release): changelog fragments in changelog.d/ instead of one Unreleased section #581.

Done questions (AGENTS.md)

  • Goal: delivers what the user wanted, merged on green CI.
  • Agents: usable through the API, MCP or an assistant tool. The setting is in the settings API; video imports by API, MCP and the assistant use it.
  • Zero setup: no new prerequisite, .env edit or manual step.
  • Fewest clicks and keystrokes. One switch.
  • Configurable: new settings in the web app with defaults; wizard asks only what is required. Settings › Documents, off by default.
  • Light: default install still runs on a Raspberry Pi with cloud models. Skips transcription when captions exist.
  • Private and secure: data local and encrypted, passkeys, threat model updated. The captions file is encrypted like the media; it comes from the same download as the video, so no new surface.
  • Cost: cheapest path, model calls in the activity ledger, budgets respected. No speech call when captions are used.
  • User decides: consequential or new actions wait for the user; defaults unchanged. Off by default.
  • Upgrades: existing installs upgrade safely (upgrade step for stored-data changes). n/a: one new setting with a default; web.captions is a new optional key.
  • Honest: sources cited; labelled built, in progress or planned. The transcript's engine says import:captions.
  • Tests, docs and generated files updated.
  • Open standards; dependencies keep Lens MIT. WebVTT through yt-dlp, already used.
  • Result reported with evidence; "refine later" items written down. Refine later: captions for files uploaded with a sidecar .srt/.vtt.
  • Reuse: existing Lens code and permissive libraries reused, nothing reinvented. Reuses yt-dlp and the transcript importer.

Local CI (ci/local-ci.sh): FastAPI (embedded and server), Next.js, pre-commit and PR title passed.


Generated by Claude Code

@adeelahmad adeelahmad self-assigned this Oct 18, 2026
adeelahmad commented Oct 18, 2026 •
Copy link
Copy Markdown
Owner Author

Next.js failed on settings-kokoro.test.tsx. It was failing on main as well: #622 added ai.answer_comments after #538's test was written, so the test's settings view didn't have it. I ported a fix here at first, then dropped it again: #621 brought the same fix to main. The branch is now rebased on main with only this PR's change.


Generated by Claude Code

adeelahmad pushed a commit that referenced this pull request Oct 18, 2026
#622 added ai.answer_comments (answer when tagged in a comment) after #538
wrote the Kokoro settings test's view of the section, so Save sent an ai
update beside the voice one and main's Next.js check went red at 2deac7a.
The fixture names the default, the same line #621 and #624 carry.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NY27LFMbLezbvQQQeHT19a
@adeelahmad
adeelahmad force-pushed the claude/project-thread-xfmkzn branch from 7372961 to 9c6e17c Compare October 18, 2026 15:42
@adeelahmad
adeelahmad merged commit de99521 into main Oct 18, 2026
12 checks passed
@adeelahmad
adeelahmad deleted the claude/project-thread-xfmkzn branch October 18, 2026 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0