Module subtitles_ui

Source
Expand description

Subtitles panel. Toolbar: “Add at playhead” (cue [playhead, playhead+2 s) with the text “Subtitle”, selected + text field focused), “Import…” (rfd: srt/vtt → engine::subtitles::parse → replace or append after a yes/no), “Export SRT…” / “Export VTT…” (engine::subtitles::to_srt/to_vtt), “Burn in” checkbox (project.show_subtitles), and a “Style” collapsing section (font combo from fonts, size, colour, outline width/colour, background box colour, margin from bottom = project.subtitle_margin). Below: the cue list (egui::Grid / ScrollArea): start and end as editable timecode-ish DragValues in seconds (3 decimals, end ≥ start + 0.1, keep the list sorted via Project::sort_cues), a multiline text field, a play button (seek to the cue and play → seeked + play), a select checkbox and a delete one; the cue containing the playhead is highlighted; a “Split at playhead” button on the highlighted cue. A second toolbar row: “To text clips” (Project::cues_to_text_clips — editable Text clips on a “Subtitles” track), “Delete selected”, “Delete in range” (the In/Out range) and “Clear all”. “Open folder” → open_folder: the app writes the .srt sidecar and opens the folder. Undo once per gesture (same edit_start rule as the inspector); returns what changed.

The “Transcribe” section drives engine::transcribe: pick a whisper.cpp model (its download size is named before the click and the download shows a progress bar), transcribe the selected clip’s audio on a worker thread, and turn the transcript into cues (“Transcribe & generate subtitles”). The raw word timings are kept, so “Regenerate cues” rebuilds the cues with new grouping knobs (pause split, punctuation, max words/chars) without re-transcribing; a --prompt field feeds whisper vocabulary hints. Underneath it, the double-take detector lists the lines that were said more than once — “Mark on timeline” drops a marker per flubbed take (described by what was said) and “Cut the duplicates” ripples every take but the last one out, dragging the cues, the markers and the transcript along with the cut. With no model and no whisper.exe the section only ever explains what to install.

Structs§

SubtitlesResponse
SubtitlesState
Target 🔒
What a run needs: the clip’s audio and how its source time maps back onto the timeline.
TranscribeState
Speech-to-text and the double-take detector (the “Transcribe” section).

Constants§

MIN_CUE 🔒
Minimum cue length (end ≥ start + this).
TAKE_WINDOW 🔒
How long a pause may sit between one take and its retake before they are unrelated lines.

Functions§

add_at 🔒
“Add at playhead”: a 2 s cue starting at the playhead.
apply_import 🔒
Import parsed cues, replacing or appending.
cut_dups 🔒
Ripple every take but the last of each group out of the timeline, then drag the cues, our markers and the transcript along with the cut. Returns how many clips went.
export_dialog 🔒
generate 🔒
Regroup the raw words (if the last run had word timings) with the current knobs and regenerate the cues, replacing the previously generated ones. No re-transcription — pure post-processing.
import_dialog 🔒
Import an .srt/.vtt via rfd; asks replace (Yes) or append (No) when cues already exist.
mark_dups 🔒
A marker on every take “Cut the duplicates” would remove, named and described by what was said.
ripple_segment 🔒
Move one transcribed span through a ripple cut; false when the cut swallowed it.
show
style_section 🔒
target 🔒
The first selected clip that has footage behind it.
transcribe_section 🔒
The “Transcribe” section: model + download, the run, and the double-take list.