mcpField
O
omnicaptions-LaiCut

omnicaptions-LaiCut

github.com/lattifaiクリエイティブ・メディア22109 回インストール38 週間前に更新
リポジトリ

omnicaptions-LaiCut について

omnicaptions-LaiCutは、LattifAI APIを使って音声と既存の字幕や文字起こしを同期するスキルです。正確なタイミングが必要な字幕作業向けで、単語単位の時刻をJSONに保持し、ほかの形式へ変換できます。

主な機能

  1. 01音声と既存字幕の同期
  2. 02単語単位のタイムスタンプ生成
  3. 03字幕の文単位への再分割
  4. 04JSON、SRT、VTT、ASSなどで出力
  5. 05LattifAI APIキーの設定

活用シーン

  1. 01ダウンロード字幕のタイミングずれを修正
  2. 02手動の文字起こしを音声に同期
  3. 03自動生成字幕のタイミングを改善

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/lattifai/omni-captions-skills --skill omnicaptions-laicut

インストール後、Claude Code で/omnicaptions-laicutを入力して読み込まれたか確認します。

詳細

LaiCut

LattifAI の音声・テキスト処理ツールキットです。現在は強制アライメントに対応しており、翻訳と話者ダイアライゼーションにも近日対応予定です。

LattifAI API キーが必要です — https://lattifai.com/dashboard/api-keys から取得してください。

使用する場面

  • 正確なタイミングが必要な場合 — ユーザーから正確なタイムスタンプや精密なアライメントを求められたとき
  • ずれた字幕を同期する場合 — ダウンロードした字幕のタイミングのずれを修正するとき
  • 手動で作成した書き起こしをアライメントする場合 — テキストを音声に正確に合わせるとき
  • 書き起こし後にアライメントする場合 — 自動生成された字幕のタイミングを改善するとき
  • 複数の形式に対応する必要がある場合 — SRT、VTT、ASS、LRC、TXT、MD

使用しない場面

  • 書き起こし全体が必要な場合(/omnicaptions:transcribe を使用)
  • 既存の字幕や書き起こしがない場合(アライメントするものがありません)
  • 非常に短いクリップ(5 秒未満)の場合

セットアップ

pip install "omni-captions-skills[laicut]" --extra-index-url https://lattifai.github.io/pypi/simple/

API キー

優先順位:LATTIFAI_API_KEY 環境変数 → .env ファイル → ~/.config/omnicaptions/config.json

設定されていない場合は、ユーザーに次のように尋ねてください:Please enter your LattifAI API key (get from https://lattifai.com/dashboard/api-keys):

その後、-k <key> を指定して実行します。キーは設定ファイルに自動的に保存されます。

CLI の使用方法

# Basic alignment (default: JSON with word-level timing, RECOMMENDED)
omnicaptions LaiCut audio.mp3 caption.srt
# → caption_LaiCut.json

# Then convert to desired format (preserves word timing in JSON for future use)
omnicaptions convert caption_LaiCut.json -o caption_LaiCut.srt

# Smart sentence segmentation (for word-level captions like YouTube VTT)
omnicaptions LaiCut video.mp4 caption.vtt --split-sentence
オプション説明
-o, --output出力ファイル(デフォルト:<caption>_LaiCut.json)
-f, --format出力形式(デフォルト:json)
-k, --api-keyLattifAI API キー
--split-sentenceAI による意味的な文の分割
-v, --verbose進行状況を表示

JSON 出力(推奨)

JSON 出力では、後続の処理に使える単語レベルのタイミングが保持されます。

[
  {
    "text": "Hello world",
    "start": 0.0,
    "end": 2.5,
    "words": [
      {"word": "Hello", "start": 0.0, "end": 0.5},
      {"word": "world", "start": 0.6, "end": 2.5}
    ]
  }
]

JSON をほかの形式に変換します:

# For playback/editing
omnicaptions convert video.en_LaiCut.json -o video.en_LaiCut.srt

# For bilingual ASS
omnicaptions convert video.en_LaiCut.json -o video.en_LaiCut.ass --style bilingual

# For karaoke
omnicaptions convert lyrics_LaiCut.json -o lyrics_LaiCut_karaoke.ass --karaoke

翻訳する場合:まず SRT に変換してください(JSON は大きすぎて Claude で読み込めません)。

# 1. JSON → SRT
omnicaptions convert video.en_LaiCut.json -o video.en_LaiCut.srt

# 2. Claude 翻译 → video.en_LaiCut_Claude_zh.srt

# 3. 转换为带颜色 ASS
omnicaptions convert video.en_LaiCut_Claude_zh.srt -o video.en_LaiCut_Claude_zh_Color.ass \
  --line1-color "#00FF00" --line2-color "#FFFF00"

スマートな文分割を有効にするかユーザーに確認する

入力字幕が単語レベル、または分割が適切でない場合(例:YouTube VTT)は、--split-sentence を有効にするかユーザーに確認してください:

Is the caption word-level or poorly segmented (e.g., YouTube VTT)?
- Yes → Add --split-sentence (AI re-segments into natural sentences)
- No → Keep original segmentation

使用例:YouTube VTT、単語単位でアライメントされた字幕、乱雑な自動生成字幕

LattifAI API キーのエラー処理

LaiCut には LattifAI API キーが必要です(Gemini API キーではありません)。

エラーの例:

API KEY verification error: API KEY is invalid or expired.

適切な対処方法:

  1. LaiCut には有効な LattifAI API キーが必要だとユーザーに伝えます
  2. 新しいキーを提供するかどうかをユーザーに確認します
  3. https://lattifai.com/dashboard/api-keys に案内します
  4. 「タイミングはすでに十分正確」と主張して、アライメントの手順を絶対に省略しないでください

よくある間違い

間違い対処方法
API キーが無効、または期限切れ新しいキーをユーザーに求め、省略しないでください
API キーがないLATTIFAI_API_KEY を設定するか、-k を使用します
音声形式のエラーまず WAV/MP3/M4A に変換します
出力が空字幕にテキストが含まれているか確認します

関連スキル

スキル使用する場面
/omnicaptions:transcribeまず書き起こしを生成する
/omnicaptions:convert字幕形式を変換する
/omnicaptions:translateアライメント後に翻訳する
ワークフローの例

重要:

  • LaiCut はデフォルトで JSON を出力します(単語レベルのタイミングが保持されます)
  • 再生や翻訳に必要な場合は、SRT/ASS に変換します
  • アライメント後にバイリンガル字幕を生成します
# No caption: transcribe → align (JSON) → convert → translate
omnicaptions transcribe video.mp4
# → video_GeminiUnd.md
omnicaptions LaiCut video.mp4 video_GeminiUnd.md
# → video_GeminiUnd_LaiCut.json
omnicaptions convert video_GeminiUnd_LaiCut.json -o video_GeminiUnd_LaiCut.srt
# → video_GeminiUnd_LaiCut_Claude_zh.srt (after translate)

# Has caption: download → align (JSON) → convert → translate
omnicaptions download "https://youtu.be/xxx"
# → xxx.en.vtt
omnicaptions LaiCut xxx.mp4 xxx.en.vtt
# → xxx.en_LaiCut.json
omnicaptions convert xxx.en_LaiCut.json -o xxx.en_LaiCut.srt
# → xxx.en_LaiCut_Claude_zh.srt (after translate)
# → xxx.en_LaiCut_Claude_zh_Color.ass (after convert with --style)

コメント