vikit.common.subtitle_tools

Overview

Function

trim_subtitles(subtitles, start_time_sec, end_time_sec)

Trim the subtitles to the specified time range and shift their timing to begin

Functions

vikit.common.subtitle_tools.trim_subtitles(subtitles: pysrt.SubRipFile, start_time_sec: float, end_time_sec: float) pysrt.SubRipFile

Trim the subtitles to the specified time range and shift their timing to begin at 0 seconds.

Parameters:
  • subtitles -- The subtitles to preprocess.

  • start_time_sec -- The start time (in seconds) of the desired range.

  • end_time_sec -- The end time (in seconds) of the desired range.

Returns:

A SubRipFile object containing the trimmed subtitles. Possibly empty.