Skip to content

feat(asr): word timings only for the clips that ship - #214

Open
stephanvoytov wants to merge 1 commit into
mutonby:mainfrom
stephanvoytov:pr/two-pass-asr
Open

stephanvoytov wants to merge 1 commit into
mutonby:mainfrom
stephanvoytov:pr/two-pass-asr

Conversation

@stephanvoytov

Copy link
Copy Markdown

Summary

Two-pass ASR for long sources, plus reuse of the captions a YouTube source already has.

Why

The clip pipeline transcribed the whole source with word-level timestamps, although only the delivered clips need them. On a 42-minute source the source pass was the dominant cost. With this change the source pass is text-only (or the captions YouTube already serves) and each selected clip gets one word-level pass.

What changed

  • ASR_CLIP_WORDS=1: the source transcript is requested without word timings; _process_one_clip refines each cut clip, stores caption_words, and captions, re-styling, hook grounding, the Remotion preview and the editor EDL use them. With no words on the source pass, clip cuts snap to segment boundaries.
  • USE_SOURCE_CAPTIONS=1 + SOURCE_CAPTIONS_LANG: read the source's own YouTube captions (json3) through a shared, dependency-light youtube_captions module. A requested language that YouTube cannot serve falls back to ASR instead of feeding a translated track to the model. Early-audio ASR is skipped when captions can be used.
  • LLM_SCORE_REASONING_EFFORT / LLM_DETAIL_REASONING_EFFORT: optional per-pass effort; the OpenCode Go x-opencode-session header is sent only to opencode.ai.
  • Dashboard: Advanced toggle, with its default coming from /api/config.
  • Cache safety: coarse transcripts are not stored in source_cache; a checkpoint without words is rejected when the mode is off; the remote-worker prepare path still requires words.

The pipeline no longer imports free_tools (which has a lazy cloud hook); the caption reader moved to youtube_captions.py. That also keeps the existing audit test green.

Defaults

All new environment variables default off; existing deployments are unchanged unless they opt in.

Testing

  • pytest tests/ -q: 2711 passed, 43 skipped.
  • cd dashboard && npm run build && npm run lint.
  • Manual: a 59-minute Russian YouTube source used its Russian captions (1365 segments) and skipped the source ASR; a 2:24 local source used the coarse source pass + two per-clip word passes and produced captioned clips.

A long source used to be transcribed with word timestamps in full even though only the delivered clips need them. With ASR_CLIP_WORDS the source pass is text-only (or the source YouTube captions) and each selected clip gets one word-level pass; caption_words then drive burned captions, re-styling, hook grounding, the Remotion preview and the editor EDL.

- ASR_CLIP_WORDS / USE_SOURCE_CAPTIONS / SOURCE_CAPTIONS_LANG
- shared youtube_captions module: the pipeline no longer imports free_tools (and its cloud hook)
- per-pass reasoning effort and the OpenCode Go session header
- tests and docs
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.

1 participant