BoldTranscriptsEx.WebVTT (bold_transcripts_ex v0.5.1)

Provides functionality for working with WebVTT files.

This module handles:

  • Converting Bold transcripts to WebVTT subtitles
  • Smart subtitle splitting based on word timing and natural pauses
  • Line length optimization for readability
  • Speaker identification in subtitles using WebVTT's <v> tag

Configuration:

  • Maximum 42 characters per line
  • Maximum 2 lines per subtitle
  • Natural breaks at pauses longer than 0.15s
  • 0.0s gap between subtitles for better readability

Summary

Functions

Generates WebVTT subtitles from a Bold transcript.

Functions

generate_subtitles(transcript)

Generates WebVTT subtitles from a Bold transcript.

Parameters

  • transcript: A Bold transcript map containing:
    • metadata.speakers - Map of speaker IDs to names
    • utterances - List of utterances with word-level timing

Returns

A string containing the WebVTT subtitles with speaker labels.

Examples

iex> transcript = %{
...>   "metadata" => %{"speakers" => %{"A" => "John"}},
...>   "utterances" => [
...>     %{
...>       "start" => 0.0,
...>       "end" => 2.5,
...>       "text" => "Hello world",
...>       "speaker" => "A",
...>       "words" => [
...>         %{"word" => "Hello", "start" => 0.0, "end" => 1.0},
...>         %{"word" => "world", "start" => 1.5, "end" => 2.5}
...>       ]
...>     }
...>   ]
...> }
iex> BoldTranscriptsEx.WebVTT.generate_subtitles(transcript)
"WEBVTT\n\n1\n00:00:00.000 --> 00:00:02.300\n<v John>Hello world</v>"