mixing.transcript.persist¶
Reuse-or-create the SRT that lives next to a media file.
Encodes the “transcribe once, persist, reuse” rule: the SRT lives alongside
the media (same folder, same basename, .srt). If it already exists it is
returned untouched — re-transcribing costs API credits and the file may have
been hand-corrected. Otherwise it is generated via ElevenLabs Scribe (whose
raw response is itself cached on disk) and written next to the media.
Functions
|
Return |
- mixing.transcript.persist.srt_for_media(media, *, srt_path=None, reuse=True, refresh=False, cache=True, max_chars=80, **transcribe_kwargs)[source]¶
Return
(srt_text, srt_path)formedia, transcribing if needed.- Parameters:
media (
Union[str,Path]) – Audio or video file (Scribe extracts audio from video).srt_path (
Union[str,Path,None]) – Where the SRT lives/should be written. Defaults to the media path with an.srtsuffix.reuse (
bool) – WhenTrue(default) and the SRT already exists, read and return it without re-transcribing.refresh (
bool) – Force re-transcription even if the SRT exists (overwrites it).cache (
bool) – Pass-through tomixing.transcript.transcribe()’s on-disk response cache.max_chars (
int) – Max characters per SRT cue when generating.transcribe_kwargs – Extra args forwarded to
transcribe(e.g.language_code,diarize).
- Return type:
- Returns:
The SRT text and the path it lives at.