subtitle-generation について
subtitle-generationは、each::senseを使って動画の字幕を作成・調整するスキルです。動画制作、ソーシャルメディア、アクセシビリティ向けに、文字起こし、翻訳、話者ラベル、タイミング調整、各種形式への出力を行います。
主な機能
- 01タイムスタンプ付き音声文字起こし
- 02多言語字幕の生成
- 03話者の識別とラベル付け
- 04アニメーション字幕とカラオケ字幕
- 05SRT、VTTなどへの出力
- 06字幕翻訳とタイミング調整
活用シーン
- 01動画からタイミング付き字幕を作成
- 02複数言語の字幕を用意
- 03ポッドキャスト字幕に話者ラベルを追加
- 04ショート動画にアニメーション字幕を追加
インストール
コマンドをコピーしてターミナルで実行します。
npx skills add https:/ / github.com/ eachlabs/ skills --skill subtitle-generationインストール後、Claude Code で/subtitle-generationを入力して読み込まれたか確認します。
同梱ファイルreferences/SSE-EVENTS.md
詳細
字幕生成
each::sense を使用して、動画向けのプロ品質の字幕とキャプションを生成します。このスキルでは、正確な文字起こし、多言語字幕、アニメーションキャプション、さまざまなエクスポート形式を作成できます。ソーシャルメディア、動画制作、アクセシビリティに最適化されています。
特徴
- 自動字幕生成: 正確なタイミングで音声を自動的にテキスト化します
- 多言語生成: 音声から複数の言語の字幕を生成します
- アニメーションキャプション: TikTok/Instagram スタイルの、単語ごとに表示するアニメーションキャプション
- SRT/VTT エクスポート: 編集や配信に使える標準字幕形式
- 話者ダイアライゼーション: 会話に登場する話者を識別してラベル付けします
- 字幕翻訳: 既存の字幕をほかの言語に翻訳します
- 焼き込み字幕: 字幕を動画に直接レンダリングします(ハードコード)
- カラオケスタイル: 音楽や歌詞動画向けに、単語ごとにハイライト表示します
- タイミング調整: 字幕のタイミングと同期を微調整します
- バッチ処理: 複数の動画の字幕を一度に生成します
クイックスタート
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-H "Accept: text/event-stream" \
-d '{
"messages": [{"role": "user", "content": "Generate subtitles for this video with accurate timestamps"}],
"model": "eachsense/beta",
"stream": true,
"mode": "max",
"file_urls": ["https://example.com/my-video.mp4"]
}'
字幕形式と出力
| 形式 | 拡張子 | 用途 |
|---|---|---|
| SRT | .srt | 汎用形式。ほとんどの動画プレーヤーや編集ソフトで利用できます |
| VTT | .vtt | Web 動画、HTML5 プレーヤー、YouTube |
| 焼き込み | .mp4 | ソーシャルメディア。プレーヤーの対応は不要です |
| JSON | .json | カスタムアプリケーション、プログラムからのアクセス |
| ASS/SSA | .ass | 高度なスタイル設定、アニメ字幕 |
使用例
1. 動画から字幕を自動生成
動画ファイルの音声を自動的に文字起こしし、単語レベルで正確なタイムスタンプを付けます。
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-H "Accept: text/event-stream" \
-d '{
"messages": [{"role": "user", "content": "Transcribe this video and generate subtitles with accurate timestamps. Output as SRT format. The video contains English speech."}],
"model": "eachsense/beta",
"stream": true,
"mode": "max",
"file_urls": ["https://example.com/interview-video.mp4"]
}'
2. 多言語字幕の生成
音声から複数の言語の字幕を直接生成します。
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-H "Accept: text/event-stream" \
-d '{
"messages": [{"role": "user", "content": "Generate subtitles for this video in English, Spanish, and French. Provide separate SRT files for each language. The original audio is in English."}],
"model": "eachsense/beta",
"stream": true,
"mode": "max",
"file_urls": ["https://example.com/product-demo.mp4"]
}'
3. アニメーション/スタイル付きキャプション(TikTok スタイル)
TikTok や Instagram Reels で人気の、単語ごとのハイライト表示を使った目を引くアニメーションキャプションを作成します。
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-H "Accept: text/event-stream" \
-d '{
"messages": [{"role": "user", "content": "Add TikTok-style animated captions to this video. Use bold white text with black outline, word-by-word pop animation, centered at the bottom third of the screen. Make it trendy and engaging."}],
"model": "eachsense/beta",
"stream": true,
"mode": "max",
"file_urls": ["https://example.com/short-form-content.mp4"]
}'
4. SRT/VTT エクスポート
動画編集ソフトやストリーミングプラットフォームで使える、標準形式の字幕ファイルを生成します。
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-H "Accept: text/event-stream" \
-d '{
"messages": [{"role": "user", "content": "Transcribe this video and export subtitles in both SRT and VTT formats. Ensure proper line breaks (max 42 characters per line, 2 lines max). Include timestamps accurate to milliseconds."}],
"model": "eachsense/beta",
"stream": true,
"mode": "max",
"file_urls": ["https://example.com/documentary.mp4"]
}'
5. 話者ダイアライゼーション(話者の識別)
会話、インタビュー、ポッドキャストに登場する話者を識別してラベル付けした字幕を生成します。
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-H "Accept: text/event-stream" \
-d '{
"messages": [{"role": "user", "content": "Generate subtitles for this podcast with speaker diarization. There are 2 speakers - identify them as Speaker 1 and Speaker 2 (or Host and Guest if you can determine roles). Format each line with the speaker label."}],
"model": "eachsense/beta",
"stream": true,
"mode": "max",
"file_urls": ["https://example.com/podcast-episode.mp4"]
}'
6. 字幕翻訳
タイミングを維持しながら、既存の字幕を別の言語に翻訳します。
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-H "Accept: text/event-stream" \
-d '{
"messages": [{"role": "user", "content": "Translate these English subtitles to Japanese. Preserve the original timing and format. Ensure natural Japanese phrasing rather than literal translation."}],
"model": "eachsense/beta",
"stream": true,
"mode": "max",
"file_urls": ["https://example.com/original-subtitles.srt"]
}'
7. 焼き込み字幕
プレーヤーの対応がなくても表示されるように、字幕を動画ファイルに直接レンダリングします(ハードコード/埋め込み)。
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-H "Accept: text/event-stream" \
-d '{
"messages": [{"role": "user", "content": "Generate subtitles for this video and burn them directly into the video. Use white text with black background box, Arial font, positioned at bottom center. Output a new video file with embedded subtitles."}],
"model": "eachsense/beta",
"stream": true,
"mode": "max",
"file_urls": ["https://example.com/social-media-clip.mp4"]
}'
8. 単語ごとのカラオケスタイル
単語ごとにハイライト表示するカラオケ風字幕を作成します。ミュージックビデオや歌詞コンテンツに最適です。
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-H "Accept: text/event-stream" \
-d '{
"messages": [{"role": "user", "content": "Create karaoke-style subtitles for this music video. Display lyrics with word-by-word highlighting as they are sung. Use a gradient color change effect (from white to yellow) for the currently sung word. Center the text on screen."}],
"model": "eachsense/beta",
"stream": true,
"mode": "max",
"file_urls": ["https://example.com/music-video.mp4"]
}'
9. 字幕タイミングの調整
音声との同期を改善するため、字幕のタイミングを微調整します。
# First, upload video and generate initial subtitles
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-H "Accept: text/event-stream" \
-d '{
"messages": [{"role": "user", "content": "Generate subtitles for this video"}],
"model": "eachsense/beta",
"stream": true,
"mode": "max",
"session_id": "subtitle-timing-project",
"file_urls": ["https://example.com/video-with-delay.mp4"]
}'
# Then adjust timing in the same session
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-H "Accept: text/event-stream" \
-d '{
"messages": [{"role": "user", "content": "The subtitles are appearing 500 milliseconds too early. Shift all subtitle timings forward by 500ms and regenerate the SRT file."}],
"model": "eachsense/beta",
"stream": true,
"session_id": "subtitle-timing-project"
}'
10. 字幕のバッチ生成
1 つのワークフローで複数の動画の字幕を生成します。
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-H "Accept: text/event-stream" \
-d '{
"messages": [{"role": "user", "content": "Generate English subtitles for all these videos. Output SRT files for each. Use consistent formatting across all videos: max 2 lines, 42 characters per line, minimum 1 second display time per subtitle."}],
"model": "eachsense/beta",
"stream": true,
"mode": "max",
"file_urls": [
"https://example.com/episode-01.mp4",
"https://example.com/episode-02.mp4",
"https://example.com/episode-03.mp4"
]
}'
ベストプラクティス
文字起こしの品質
- クリアな音声: はっきりした発話で、背景ノイズが少ない場合に最適な結果が得られます
- 言語の指定: 精度を高めるため、音声の言語を指定します
- 話者数: 話者ダイアライゼーションの精度を高めるため、話者数を指定します
- コンテキスト: 精度を高めるため、内容(専門用語、名前など)のコンテキストを提供します
字幕のフォーマット
- 行の長さ: 読みやすさのため、1 行を 42 文字未満にします
- 表示時間: 各字幕の表示時間は 1~7 秒にします
- 字幕あたりの行数: 1 つの字幕ブロックにつき最大 2 行にします
- 読解速度: 快適に読めるよう、1 分あたり 150~180 語を目安にします
アニメーションキャプション
- フォントの選択: 短尺コンテンツには、太字のサンセリフフォントが最適です
- コントラスト: どのような背景でも見やすくなるよう、縁取りや影を使います
- 位置: プラットフォームの UI 要素に重ならないよう、安全領域を確保します
- アニメーション: 大げさな効果より、控えめなアニメーションのほうが読みやすくなります
翻訳
- 文化的な適応:翻訳だけでなく、ローカライズを依頼します
- タイミングの柔軟性:言語によっては、読むのにより多くの時間が必要です
- 文字数制限:CJK 言語では、1行あたりの文字数を少なくできることがよくあります
字幕生成のプロンプトのヒント
字幕を依頼するときは、プロンプトに次の詳細を含めます。
- ソース言語:動画では何語が話されていますか?
- 出力形式:SRT、VTT、映像への焼き込み、アニメーションのどれですか?
- スタイル要件:フォント、色、位置、アニメーション
- 話者情報:話者の人数、分かる場合は役割
- 特別な用語:専門用語、名前、ブランド
- 出力言語:1つの言語、または複数の翻訳
プロンプト構成の例
"Generate [format] subtitles for this video.
Source language: [language].
[Number] speakers: [roles if known].
Style: [font, color, position requirements].
Special terms to recognize: [names, technical words].
Additional requirements: [line length, timing, etc.]"
モードの選択
生成する前にユーザーに確認します。
「速くて低コストなものと、高品質なもののどちらを希望しますか?」
| モード | 最適な用途 | 速度 | 品質 |
|---|---|---|---|
max | 最終版の字幕、プロ向けコンテンツ、精度が重要なコンテンツ | 遅め | 最高 |
eco | 簡易版の作成、レビュー用コピー、一括処理 | 速め | 良好 |
複数ターンでの字幕の調整
字幕生成を繰り返し調整するには、session_id を使用します。
# Initial subtitle generation
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-H "Accept: text/event-stream" \
-d '{
"messages": [{"role": "user", "content": "Generate subtitles for this video with speaker identification"}],
"model": "eachsense/beta",
"stream": true,
"session_id": "subtitle-project-001",
"file_urls": ["https://example.com/interview.mp4"]
}'
# Refine based on feedback
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-H "Accept: text/event-stream" \
-d '{
"messages": [{"role": "user", "content": "Change Speaker 1 label to John and Speaker 2 to Sarah. Also fix the spelling of TensorFlow wherever it appears."}],
"model": "eachsense/beta",
"stream": true,
"session_id": "subtitle-project-001"
}'
# Add styling and export
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-H "Accept: text/event-stream" \
-d '{
"messages": [{"role": "user", "content": "Now create a burned-in version with the corrected subtitles. Use yellow text for John and cyan for Sarah."}],
"model": "eachsense/beta",
"stream": true,
"session_id": "subtitle-project-001"
}'
言語サポート
each::sense は、次の言語を含む50以上の言語で字幕生成をサポートしています。
| 言語 | コード | 備考 |
|---|---|---|
| 英語 | en | 米国、英国、オーストラリアのバリエーション |
| スペイン語 | es | ラテンアメリカとヨーロッパのバリエーション |
| フランス語 | fr | フランスとカナダのバリエーション |
| ドイツ語 | de | |
| 日本語 | ja | |
| 韓国語 | ko | |
| 中国語 | zh | 簡体字と繁体字 |
| アラビア語 | ar | RTL に対応 |
| ヒンディー語 | hi | |
| ポルトガル語 | pt | ブラジルとヨーロッパのバリエーション |
エラー処理
| エラー | 原因 | 解決方法 |
|---|---|---|
Failed to create prediction: HTTP 422 | 残高不足 | eachlabs.ai でチャージします |
| 文字起こしの品質が低い | 音質が悪い | よりクリアな音声ソースを用意します |
| 言語を検出できない | 複数の言語が混在している、または発話が不明瞭 | ソース言語を明示的に指定します |
| タイムアウト | 動画が長い、または処理が複雑 | クライアントのタイムアウトを最低10分に設定します |
クライアントの設定
重要:長い動画では、字幕の生成にかなりの時間がかかることがあります。
- 最小タイムアウト:10分(600秒)
- 推奨:動画の長さに応じてタイムアウトを設定します(動画1分につき2~3分)
- ストリーミング:SSE イベント処理を使用して進行状況を表示します
関連スキル
each-sense- コア API ドキュメントvideo-generation- 字幕を内蔵した動画を生成voice-audio- 音声処理と音声合成video-edit- 動画編集とポストプロダクション