Skip to content

Add plain text and transcript import with auto segmentation #37

@laubonghaudoi

Description

@laubonghaudoi

Summary

Add a browser-only import flow for pasted plain text or .txt transcript files, then split the text into draft subtitle cues. This is a high-value way to support caption creation without adding ASR or server-side processing.

Why this is in scope

  • Runs entirely in the browser.
  • Complements the existing "start from scratch" flow.
  • Helps users who already have a transcript from another tool.
  • Keeps AI transcription as a non-goal while making generated transcripts easier to edit.

Implementation plan

  1. Add segmentation utilities.

    • Create lib/transcript-segmentation.ts.
    • Support these modes first:
      • Split by non-empty lines.
      • Split by sentence punctuation.
      • Split by maximum character count.
    • Output Subtitle[] with generated IDs, UUIDs, draft start/end times, and text.
  2. Add timing options.

    • Default cue duration: 3 seconds.
    • Default gap: 0.2 seconds.
    • Optional max characters per cue.
    • Optional start time offset.
    • Keep the first version simple; alignment happens later on the waveform.
  3. Add import UI.

    • Add an Import transcript option in the load subtitles / manage tracks dialog.
    • Allow paste into a textarea and loading a .txt file.
    • Show a preview table with cue number, start, end, and text.
    • Let the user create a new track or replace an empty active track.
  4. Integrate with existing track actions.

    • Use loadSubtitlesIntoTrack or setInitialSubtitles depending on current track state.
    • Name generated tracks from the file name or Transcript.
    • Preserve undo behavior consistently with other imports.
  5. Tests.

    • Add tests/transcript-segmentation.test.ts.
    • Cover line mode, sentence mode, max-character mode, empty input, and timing generation.

Acceptance criteria

  • Users can paste text or load a .txt file and create draft subtitles locally.
  • Segmentation is previewed before import.
  • Imported cues can be edited, retimed, and exported like normal SRT/VTT cues.
  • No ASR, cloud call, account, or backend is introduced.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions