字幕ファイル(SRT/VTT)のチェックと自動修正

Subtitle SRT/VTT checker and fixer

SRT・VTT 字幕の重なり・順番の乱れ・表示時間・1秒あたりの文字数・1行の長さを調べ、直した字幕を新しいファイルに書き出します。SRT と VTT の相互変換もできます。

ClaudeHermes AgentCodexCursorMIT(改変・再配布・商用利用可)Python

できること

字幕ファイル(.srt / .vtt)を読み込み、問題点の一覧と修正版のファイルを作ります。元のファイルは変更しません。

  • 順番が前後した字幕の並べ替え、重なった字幕の終了時刻の調整、終了が開始より前になっている字幕の修復、空の字幕の削除
  • 表示時間が短すぎる字幕や、文字数に対して表示が短い字幕を、次の字幕までの空き時間の範囲で延長
  • 1秒あたりの文字数・1行の幅・行数を判定(全角文字は半角2文字分として計算するので日本語字幕にも対応)
  • オプションで長すぎる字幕のカット、はみ出した行の改行し直し、字幕間の最小間隔の確保
  • SRT → VTT、VTT → SRT の変換(SRT で使えない位置指定などは削除して報告)
  • 変更内容と残った問題を、元ファイルの字幕番号つきで一覧表示・JSON 出力

使い方

python scripts/subfix.py check input.srt
python scripts/subfix.py fix input.srt -o input.fixed.srt --report report.json
python scripts/subfix.py convert captions.vtt -o captions.srt

エージェントに「この字幕をチェックして直して」と頼むと、まずチェック結果を見せ、基準(文字数・時間など)を確認してから修正版を書き出し、自動で直せなかった箇所の直し方を提案します。

必要な環境

  • Python 3(標準ライブラリのみ)

注意点

  • 初期値(英語 17文字/秒・42桁、日本語 4文字/秒・13文字×2行など)は控えめな目安です。納品先の規定があればその数値を指定してください。
  • 日本語の改行し直しは辞書を使わないため、単語の途中で改行されることがあります。結果は目で確認してください。
  • 字幕の文言そのものは変更しません(タイミングの修正のみ)。
English description

Check SRT and VTT subtitles for overlaps, wrong order, durations, reading speed and line length, write a fixed copy, and convert between SRT and VTT.

What it does

Reads subtitle files (.srt / .vtt) and produces a list of problems plus a fixed copy. The original file is never changed.

  • Sorts out-of-order cues, shortens cues that overlap the next one, repairs cues whose end is before their start, removes empty cues
  • Extends cues that are too short or too fast to read, but only into the free time before the next cue
  • Checks characters per second, line width and number of lines; full-width characters count as two columns, so Japanese subtitles are measured correctly
  • Optional: cut overly long cues, re-break lines that are too wide, enforce a minimum gap between cues
  • Converts SRT to VTT and VTT to SRT, reporting anything SRT cannot hold (positioning, voice tags)
  • Lists every change and every remaining issue with the original cue number, on screen and as JSON

How to use

python scripts/subfix.py check input.srt
python scripts/subfix.py fix input.srt -o input.fixed.srt --report report.json
python scripts/subfix.py convert captions.vtt -o captions.srt

Ask your agent to check and fix a subtitle file. It shows the check result, confirms the limits, writes the fixed copy and suggests how to handle what could not be fixed automatically.

Requirements

  • Python 3 (standard library only)

Caveats

  • Default limits (English 17 chars/s and 42 columns, Japanese 4 chars/s and 13 full-width characters x 2 lines) are conservative starting points. Use your platform's or client's numbers when you have them.
  • Japanese line re-breaking has no dictionary and may split a word; review the result.
  • Subtitle wording is never changed, only timing and line breaks.

インストール方法

  1. ダウンロードしたZIPを展開します(中に subtitle-srt-fixer/ フォルダと SKILL.md があります)。
  2. フォルダごと、使うエージェントのスキル置き場にコピーします。
    • Claude:~/.claude/skills/(プロジェクト単位なら .claude/skills/)
    • Hermes Agent:~/.hermes/skills/
    • Codex:~/.agents/skills//Cursor:~/.cursor/skills/
    • Claude アプリ(claude.ai):「カスタマイズ → スキル」からZIPをアップロード
  3. エージェントを再起動し、スキル一覧に表示されることを確認します。

Windows・Mac 別、エージェント別のインストール手順

出品者

AI Skill Market 公式

出品スキル 44 件

出品者のプロフィールとスキル一覧