Builds captions (SRT / WebVTT) and chapter metadata from a demo timeline.
Captions come from say events: each starts at at_ms and lasts
duration_ms. Chapters come from scene events.
Summary
Functions
Chapters as {start_ms, end_ms, title} from scene events and the intro
and outro cards. Each runs until the next one, and the last one runs until
duration_ms.
Caption cues as {start_ms, end_ms, text}.
ffmpeg FFMETADATA text with one [CHAPTER] per chapter.
SubRip text.
WebVTT text.
Functions
Chapters as {start_ms, end_ms, title} from scene events and the intro
and outro cards. Each runs until the next one, and the last one runs until
duration_ms.
Caption cues as {start_ms, end_ms, text}.
iex> PhxDemo.Captions.cues(%{"events" => [%{"type" => "say", "at_ms" => 100, "duration_ms" => 2000, "text" => "Hi"}]})
[{100, 2100, "Hi"}]
ffmpeg FFMETADATA text with one [CHAPTER] per chapter.
SubRip text.
iex> PhxDemo.Captions.srt([{100, 2100, "Hi"}])
"1\n00:00:00,100 --> 00:00:02,100\nHi\n"
WebVTT text.
iex> PhxDemo.Captions.vtt([{100, 2100, "Hi"}])
"WEBVTT\n\n00:00:00.100 --> 00:00:02.100\nHi\n"