omnicaptions-convert について
omnicaptions-convert は、字幕ファイルを 30 種類以上の形式に変換するスキルです。ASS のスタイル設定や、単語単位のタイミング情報を使ったカラオケ字幕の生成にも対応します。
主な機能
- 0130 種類以上の字幕形式を変換
- 02ファイルの一括変換
- 03ASS のプリセットと色の指定
- 04単語ハイライト付きカラオケ出力
活用シーン
- 01SRT を VTT、ASS、TTML に変換
- 02文字起こしを標準的な字幕ファイルに変換
- 03スタイル付きまたは二言語の ASS 字幕を作成
- 04単語単位のタイミング情報を含む JSON からカラオケ字幕を生成
インストール
コマンドをコピーしてターミナルで実行します。
$
npx skills add https:/ / github.com/ lattifai/ omni-captions-skills --skill omnicaptions-convertインストール後、Claude Code で/omnicaptions-convertを入力して読み込まれたか確認します。
詳細
キャプション形式の変換
lattifai-captions を使用して、30 種類以上のキャプション形式を相互に変換します。
⚡ YouTube ワークフロー
# 1. Transcribe YouTube video directly
omnicaptions transcribe "https://youtube.com/watch?v=VIDEO_ID" -o transcript.md
# 2. Convert to any format
omnicaptions convert transcript.md -o output.srt
omnicaptions convert transcript.md -o output.ass
omnicaptions convert transcript.md -o output.vtt
使用する場面
- SRT を VTT、ASS、TTML などに変換する場合
- Gemini の Markdown 字幕起こしを標準的なキャプション形式に変換する場合
- 単語レベルのタイムスタンプを含む YouTube VTT をほかの形式に変換する場合
- 形式を一括変換する場合
使用しない場面
- 文字起こしが必要な場合(
/omnicaptions:transcribeを使用) - 翻訳が必要な場合(
/omnicaptions:translateを使用)
セットアップ
pip install omni-captions-skills --extra-index-url https://lattifai.github.io/pypi/simple/
クイックリファレンス
| 形式 | 拡張子 | 読み込み | 書き込み |
|---|---|---|---|
| SRT | .srt | ✓ | ✓ |
| VTT | .vtt | ✓ | ✓ |
| ASS/SSA | .ass | ✓ | ✓ |
| TTML | .ttml | ✓ | ✓ |
| Gemini MD | .md | ✓ | ✓ |
| JSON | .json | ✓ | ✓ |
| TXT | .txt | ✓ | ✓ |
全形式:SRT、VTT、ASS、SSA、TTML、DFXP、SBV、SUB、LRC、JSON、TXT、TSV、Audacity、Audition、FCPXML、EDL など。
CLI の使い方
# Convert (auto-output to same directory, only changes extension)
omnicaptions convert input.srt -t vtt # → ./input.vtt
omnicaptions convert transcript.md # → ./transcript.srt
# Specify output file or directory
omnicaptions convert input.srt -o output/ # → output/input.srt
omnicaptions convert input.srt -o output.vtt # → output.vtt
# Specify format explicitly
omnicaptions convert input.txt -o out.srt -f txt -t srt
ASS スタイルプリセット
ASS 形式に変換するときは、--style を使用してプリセットスタイルを適用します。
omnicaptions convert input.srt -o output.ass --style default # White text, bottom
omnicaptions convert input.srt -o output.ass --style top # White text, top
omnicaptions convert input.srt -o output.ass --style bilingual # White + Yellow (for bilingual)
omnicaptions convert input.srt -o output.ass --style yellow # Yellow text, bottom
| プリセット | 位置 | 1 行目 | 2 行目 | 用途 |
|---|---|---|---|---|
default | 下部 | 白 | 白 | 標準的なキャプション |
top | 上部 | 白 | 白 | 下部が隠れている場合 |
bilingual | 下部 | 白 | 黄色 | バイリンガルキャプション(原文 + 译文) |
yellow | 下部 | 黄色 | 黄色 | 視認性を高める場合 |
バイリンガルの例
SRT に次のような 2 行のキャプションがある場合:
1
00:00:01,000 --> 00:00:03,000
Hello World
你好世界
--style bilingual またはカスタムカラーを使用します:
# Preset: white + yellow
omnicaptions convert bilingual.srt -o output.ass --style bilingual
# Custom colors: green English + yellow Chinese
omnicaptions convert bilingual.srt -o output.ass --line1-color "#00FF00" --line2-color "#FFFF00"
# Mix preset with custom line2 color
omnicaptions convert bilingual.srt -o output.ass --style default --line2-color "#FF6600"
カスタムカラーオプション
| オプション | 説明 |
|---|---|
--line1-color "#RRGGBB" | 1 行目(原文)の色 |
--line2-color "#RRGGBB" | 2 行目(翻訳)の色 |
一般的な色:#FFFFFF(白)、#FFFF00(黄色)、#00FF00(緑)、#00FFFF(シアン)、#FF6600(オレンジ)
フォントサイズと解像度
フォントサイズは動画の解像度に基づいて自動計算されます。解像度は次の優先順位で検出されます。
--resolution引数(例:1080p、4k、1920x1080)--video引数(ffprobe を使用して検出).meta.jsonファイル(omnicaptions downloadによって保存)- デフォルト:1080p
# Auto-detect from .meta.json (saved by download command)
omnicaptions convert abc123.en.srt -o abc123.en.ass --karaoke
# Specify resolution directly
omnicaptions convert input.srt -o output.ass --resolution 4k
omnicaptions convert input.srt -o output.ass --resolution 720p
omnicaptions convert input.srt -o output.ass --resolution 1920x1080
# Detect from video file (uses ffprobe)
omnicaptions convert input.srt -o output.ass --video video.mp4
# Override auto-calculated fontsize
omnicaptions convert input.srt -o output.ass --resolution 4k --fontsize 80
| 解像度 | PlayRes | 自動フォントサイズ |
|---|---|---|
| 480p | 854×480 | 24 |
| 720p | 1280×720 | 32 |
| 1080p | 1920×1080 | 48(デフォルト) |
| 2K | 2560×1440 | 64 |
| 4K | 3840×2160 | 96 |
カラオケモード
単語単位のハイライト付きカラオケ字幕を生成します。単語レベルのタイミングが必要です(まず LaiCut でアラインメントを行ってください)。
# Basic karaoke (sweep effect - gradual fill)
omnicaptions convert lyrics_LaiCut.json -o lyrics_LaiCut_karaoke.ass --karaoke
# Different effects
omnicaptions convert lyrics_LaiCut.json -o lyrics_LaiCut_karaoke.ass --karaoke sweep # Gradual fill (default)
omnicaptions convert lyrics_LaiCut.json -o lyrics_LaiCut_karaoke.ass --karaoke instant # Instant highlight
omnicaptions convert lyrics_LaiCut.json -o lyrics_LaiCut_karaoke.ass --karaoke outline # Outline then fill
# LRC karaoke (enhanced word timestamps)
omnicaptions convert lyrics_LaiCut.json -o lyrics_LaiCut_karaoke.lrc --karaoke
| 効果 | ASS タグ | 説明 |
|---|---|---|
sweep | \kf | 左から右へ徐々に塗りつぶします(デフォルト) |
instant | \k | 単語を即座にハイライトします |
outline | \ko | 輪郭を塗りつぶしてから、テキストを塗りつぶします |
カラオケのワークフロー
# 1. Align with LaiCut (get word-level timing in JSON)
omnicaptions LaiCut audio.mp3 lyrics.txt
# 2. Convert to karaoke ASS
omnicaptions convert lyrics_LaiCut.json -o karaoke.ass --karaoke
# Or combine with style
omnicaptions convert lyrics_LaiCut.json -o karaoke.ass --karaoke --style yellow
Python の使い方
from omnicaptions import Caption
# Load any format
cap = Caption.read("input.srt")
# Write to any format
cap.write("output.vtt")
cap.write("output.ass")
cap.write("output.ttml")
よくある間違い
| 間違い | 解決方法 |
|---|---|
| 形式が検出されない | --from / --to フラグを使用します |
| タイムスタンプがない | ソース形式にタイミング情報が必要です |
| エンコーディングエラー | encoding="utf-8" を指定します |
関連スキル
| スキル | 使用する場面 |
|---|---|
/omnicaptions:transcribe | 音声/動画から文字起こしが必要な場合 |
/omnicaptions:translate | Gemini API で翻訳する場合 |
/omnicaptions:translate | Claude で翻訳する場合(API キー不要) |
/omnicaptions:download | 先に動画/キャプションをダウンロードする場合 |
ワークフローの例
# Transcribe → Convert → Translate (with Claude)
/omnicaptions:transcribe video.mp4
/omnicaptions:convert video_GeminiUnd.md -o video.srt
/omnicaptions:translate video.srt -l zh --bilingual
コメント
Markdown 対応