Skip to main content

Module subtitle

Module subtitle 

Source
Expand description

Subtitle format parser — SRT, ASS/SSA, WebVTT.

Provides pure-Rust parsing for the three most common text subtitle formats. Malformed events are skipped with a log::warn!; a file with zero valid events returns SubtitleError::NoEvents.

§Example

use ff_format::subtitle::{SubtitleTrack, SubtitleError};

let srt = "1\n00:00:01,000 --> 00:00:04,000\nHello world\n\n";
let track = SubtitleTrack::from_srt(srt).unwrap();
assert_eq!(track.events.len(), 1);
assert_eq!(track.events[0].text, "Hello world");

Structs§

SubtitleEvent
A single subtitle event (cue).
SubtitleTrack
A parsed subtitle track containing ordered events.

Enums§

SubtitleError
Error type for subtitle parsing operations.