r/madeinpython • u/Important-Carpet329 • 19h ago
From timed words to subtitle cues: extracting a Python library from my video editor
I maintain CUEVA Studio and pulled its subtitle segmentation code into a standalone Python package. The input is a sequence of words with start and end times. For example, Merhaba (0–0.45 s) and dünya! (0.5–1.2 s) become one SRT cue from 00:00:00,000 to 00:00:01,200.
The tricky part was applying character limits to Japanese text without spaces while keeping overlapping cues readable. The repository includes the segmenter, writers for SRT, WebVTT and ASS, and 13 tests. You can run the README example locally without a speech model or editor.
If you maintain a caption pipeline, how do you handle line breaks when the recognizer gives you one long unspaced segment? I’d welcome a short input and your expected split.
