Search by

js-upup / video-subtitle-window

js-upup

Clip and rebase subtitle cues for a video excerpt.

v0.1.0 2026-11-21 06:50 UTC

This package is not auto-updated.

Last update: 2026-11-22 05:28:42 UTC


README

Clip and rebase subtitle cue records for a video excerpt. Cues that overlap the excerpt are shortened to its edges, and their timestamps are shifted so the excerpt starts at zero. Text and cue order are preserved.

Usage

composer require js-upup/video-subtitle-window
use SubtitleWindow\Window;

$cues = [
    ['startMs' => 500, 'endMs' => 1800, 'text' => 'Opening shot'],
    ['startMs' => 2100, 'endMs' => 3000, 'text' => 'Scene two'],
];
$excerptCues = Window::clip($cues, 1000, 2500);
// Returns cues at 0–800 ms and 1100–1500 ms.

All time intervals use integer milliseconds and an exclusive end. The library operates on cue records. Parsing or writing SRT and editing video are separate steps. PHP 8.2 or newer. MIT license.

For the related clip-generation workflow, see Seedance 2.5 on VidFomo.