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

srt_for_media(media, *[, srt_path, reuse, ...])

Return (srt_text, srt_path) for media, transcribing if needed.

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) for media, 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 .srt suffix.

  • reuse (bool) – When True (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 to mixing.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:

tuple[str, Path]

Returns:

The SRT text and the path it lives at.