SRT / WebVTT 字幕工具:解析、序列化、整体平移与缩放、重叠检查,附 CLI 与 Web GUI。
Dependencies

ui/dist/index.htmlmoon build ui --target js --release
cp _build/js/release/build/ui/ui.js ui/dist/app.js# 检查字幕
moon run cmd/main -- check examples/sample.srt
# 整体后移 1.5 秒
moon run cmd/main -- shift examples/sample.srt --by 1.5s --output shifted.srt
# 整体缩放 120%
moon run cmd/main -- scale examples/sample.srt --percent 120 --output scaled.srt
# 一键消除重叠(后一条顺延 100ms)
moon run cmd/main -- fix examples/overlap.srt --gap 100ms --output fixed.srt
# SRT -> WebVTT
moon run cmd/main -- convert examples/sample.srt --to vtt --output out.vtt
# JSON 格式的检查结果
moon run cmd/main -- check examples/sample.srt --jsonlet subtitle = match @Mr-Houjie/mbt-subtitle.parse_srt(text) {
Ok(value) => value
Err(message) => {
println("解析失败: \{message}")
return
}
}
let issues = @Mr-Houjie/mbt-subtitle.validate(
subtitle,
@Mr-Houjie/mbt-subtitle.ValidateOptions::new(),
)
let moved = @Mr-Houjie/mbt-subtitle.shift(subtitle, 1500)
let scaled = @Mr-Houjie/mbt-subtitle.scale(subtitle, 120)
let output = @Mr-Houjie/mbt-subtitle.serialize_srt(moved)types.mbt 公共类型(Cue / Subtitle / Issue / ValidateOptions)
parse.mbt SRT / VTT 解析与时间码解析
serialize.mbt SRT / VTT 序列化
transform.mbt 整体平移、缩放、消除重叠、重新编号
validate.mbt 时长、空文本、重叠与行宽检查
conformance.mbt 17 组一致性断言(测试与自检共用)
cmd/main CLI
cmd/verify 独立自检入口
ui/ Rabbita Web GUI(薄层)# 标准测试(Linux / macOS)
moon test
# 独立自检(Windows 下 moon test 可能受嵌套进程限制)
moon run cmd/verifymoon run cmd/goldenpub struct Cue {
index : Int
start_ms : Int
end_ms : Int
text : String
}pub enum IssueKind {
EndBeforeStart
EmptyText
Overlap
TooShort
TooLong
LineTooLong
}pub struct ValidateOptions {
min_duration_ms : Int
max_duration_ms : Int
max_chars_per_line : Int
}fn ValidateOptions::create(min_duration_ms : Int, max_duration_ms : Int, max_chars_per_line : Int) -> ValidateOptionsInstall
Download zipSRT / WebVTT 字幕工具:解析、序列化、整体平移与缩放、重叠检查,附 CLI 与 Web GUI。
Dependencies