跳到正文
DEV Community· 梁智鸿·· 23 分鐘前AI 評分50

CleanSRT 用一個 Python 腳本清理 58 條字幕項目,並預售桌面版

I cleaned 58 subtitle cues with one Python script — and I'm pre-selling the desktop version

AI 導讀

CleanSRT 以一個只用 Python 標準函式庫、無需 AI 或上載資料的確定性腳本,清理 58 條字幕項目。腳本在示範檔中移除 124 個填充詞、合併 9 處重複字詞,並修正 13 個時間戳問題;腳本、規則和樣本以 MIT 授權免費提供。桌面版預售價為首 20 名 $19,其後 $39。

正文

Auto-captions lie about what you said.

Whisper / CapCut give you "Um, uh, so, so, I, I think you know, like, we should start with, uh, the budget?"

You actually said "I think we should start with the budget?"

I wrote a single deterministic Python script (standard library only, no AI, no upload) that cleans the SRT you already have: it strips standalone fillers (um/uh/erm/you know, filler "like"), collapses repeats ("the the" -> "the"), re-wraps to 37 chars / 2 lines per cue (the Premiere readability rule), sorts cues and trims timestamp overlaps, strips HTML tags, and normalises whitespace and capitalisation. Timestamps are never changed except for overlap trimming.

I ran it on three sample transcripts (58 cues): 124 filler words removed, 9 repeats collapsed, 58 cues re-wrapped, 13 timestamp issues fixed, 12 HTML tags stripped.

The samples are synthetic files written for the demo, not a real creator's transcript — the counts are real counts from running the script on them.

Try it yourself:

python3 clean_srt.py messy.srt clean.srt before-after.txt counts.json

The script, the rules, and the samples are free and MIT-licensed on GitHub: https://github.com/LZH0713/CleanSRT

The full offline desktop app — batch cleaning, chapter export (clean SRT/VTT + chapters.txt + MP3 chapters), and a GUI instead of the command line — is in pre-sale: $19 early bird for the first 20, $39 regular, full refund if it never ships: https://lzhorizon4.gumroad.com/l/rsmqd

Honest question for podcasters and editors: is hand-writing timestamps (Wideframe puts it at 30–45 min per episode, plus 20–30 min for show notes) a pain you would pay $19 to skip, or do you just live with messy captions?

— CleanSRT

來源:DEV Community · dev.to