srt.tools.normalize

Take a badly formatted SRT file and output a strictly valid one.

normalize(subs, strict)

Normalises subtitles.

Parameters
  • subsSubtitle objects

  • strict (bool) – Whether to enable strict mode, see Subtitle.to_srt() for more information

Returns

A single SRT formatted string, with each input Subtitle represented as an SRT block

Return type

str

Raises

SRTParseError – If parsing fails.