Communitygithub.com

ポッドキャストをShortsに 3:単語ごとのアニメ字幕

Whisperで文字起こしし、pycapsで描画して、単語ごとに動くアニメーション字幕を動画に焼き込みます。シンプルな標準スタイル、光る近未来テーマ、自作のCSSから選べます。

ポッドキャストをShortsに 3:単語ごとのアニメ字幕 とは?

ポッドキャストをShortsにレシピのステップ3(字幕)。エージェントがWhisperで音声を認識し、pycapsでアニメーション字幕を描画します。ミニマルな標準スタイル、付属の金とマゼンタに光るテーマ、独自のCSSファイルから選べ、指定した時間に固定テキストを置くこともできます。

対応~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/FilippTrigub/abra/tree/HEAD/skills/video-captioner

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

video-captioner — アニメーションキャプションパイプライン

Whisperで音声を文字起こしし、単語ごとにアニメーションするキャプションを動画に焼き付けます。色補正は行いません。視覚的な強調が必要な場合は、最初に video-enhancer スキルを使用してください。

パイプライン

入力動画 → Whisper文字起こし → pycaps字幕レンダリング → キャプション付き出力動画

キャプションスタイル

3つのオプションがあります:

  1. デフォルト(フラグなし) — pycaps組み込みのミニマルスタイル: 白いテキスト、エフェクトなし。
  2. 未来的(バンドル) — --css scripts/futuristic.css — 金とマゼンタが交互に表示されるキャプションで、グローエフェクトと等幅フォントを使用。tech系、ゲーム、ハイエナジーなコンテンツに適しています。
  3. カスタム — ユーザーは --css /path/to/custom.css で任意のCSSファイルパスを指定できます。

ユーザーがキャプションスタイルに言及していない場合は、デフォルトの見た目、未来的なスタイル、またはカスタムCSSファイルのいずれを希望するか尋ねてください。

静的キャプション

音声を文字起こしする代わりに、--caption を使用して特定のタイムスタンプに定義済みテキストを追加します:

--caption "開始-終了: テキスト"

フォーマット:

  • 時刻は M:SS または MM:SS 形式(例: 0:05 = 5秒, 1:30 = 90秒)
  • 複数のキャプション: --caption を複数回使用
  • 静的キャプションと文字起こしの両方が指定された場合、静的キャプションが優先されます

例:

uv run python scripts/caption_service.py \
  --input ./input --output ./output \
  --caption "0:01-0:05: Hello world" \
  --caption "0:10-0:20: これはデモです" \
  --css scripts/futuristic.css

キャプションスタイリング

スタイリングは JSON設定ファイル で管理します。静的キャプションを使用する場合、スタイリングは自動的に適用されます。

デフォルトスタイリング

--style-config が指定されていない場合、config.default.json が使用されます:

  • 背景: 白 (#FFFFFF)
  • テキスト色: 青 (#0066FF)
  • フォント: auto — 最初に caption タグが付いた利用可能なブランドフォントを使用し、なければCourier Newにフォールバック
  • パディング: 10px 15px
  • マージン: 0

スタイル設定の使用

設定ファイルを渡すことでスタイルを切り替えます:

# ダークモードスタイルを使用
uv run python scripts/caption_service.py \
  --input ./input --output ./output \
  --caption "0:01-0:05: Hello" \
  --style-config config.dark-mode.json

含まれている設定:

  • config.default.json — 白背景、青文字、Courier New(デフォルト)
  • config.dark-mode.json — 暗い背景、白文字、大きいフォント

カスタムスタイル設定の作成

config.default.json をコピーして変更:

{
  "caption_bg_color": "#000000",
  "caption_color": "#FFFFFF",
  "caption_font": "auto",
  "caption_font_tag": "caption",
  "caption_padding": "20px 30px",
  "caption_margin": "10px",
  "caption_font_size": 48
}

そして使用:

uv run python scripts/caption_service.py \
  --input ./input --output ./output \
  --caption "0:01-0:05: テキスト" \
  --style-config my-custom-style.json

CLIフラグで設定を上書き

CLIフラグは設定ファイルの値より優先されます:

uv run python scripts/caption_service.py \
  --input ./input --output ./output \
  --caption "0:01-0:05: Hello" \
  --style-config config.dark-mode.json \
  --caption-color "#00FF00"  # 設定ファイルのテキスト色を上書き

スタイル設定リファレンス

キー型説明
caption_bg_colorstring背景色(16進数またはCSS色名)
caption_colorstringテキスト色(16進数またはCSS色名)
caption_fontstringauto、フォントファミリー、または .ttf、.otf、.woff、.woff2 ファイルへのパス
caption_font_tagstring または nullbrand-manager から優先するブランドフォントタグ(caption、body、heading など)
caption_paddingstringCSSパディング(例: "10px 15px")
caption_marginstringCSSマージン(例: "0")
caption_font_sizeinteger または nullフォントサイズ(ピクセル単位、null = 自動スケール)

利用可能なフォント

システムフォントは名前で指定できます:

  • DejaVu Sans / DejaVu Sans Bold / DejaVu Serif
  • Liberation Sans / Liberation Mono`
  • Courier New
  • Ubuntu Mono
  • TTFファイルへのパス: /path/to/font.ttf

または、skills/brand-manager/brand-assets/asset-manifest.json のブランドフォントから選択します。 caption_font が auto の場合、スキルはブランドマニフェスト(または設定されていれば CLAW_BRAND_ASSETS_DIR)を読み取り、caption_font_tag でタグ付けされた最初の利用可能なフォントを使用します。タグ付けされたフォントがない場合、caption、body、heading、または bold のタグが付いたブランドフォントを試し、それもなければCourier Newにフォールバックします。解決されたブランドフォントがファイルパスの場合、生成されるCSSに @font-face ルールが含まれ、pycapsがそれをレンダリングできるようになります。

実行方法

依存関係をインストール(初回のみ):

cd "$SKILL_DIR" && uv sync

注: 初回実行は(数分かかる可能性があり)遅くなります。これはpycapsがWhisper音声認識モデルをダウンロードするためです。開始前にユーザーに警告してください。

その後、動画を処理:

cd "$SKILL_DIR" && uv run python scripts/caption_service.py \
  --input <path/to/input> \
  --output <path/to/output> \
  [--css scripts/futuristic.css]

一般的な呼び出し方

# デフォルトのミニマルキャプション(Whisper文字起こし)
uv run python scripts/caption_service.py --input ./input --output ./output

# 未来的スタイル
uv run python scripts/caption_service.py \
  --input ./input --output ./output \
  --css scripts/futuristic.css

# カスタムCSS
uv run python scripts/caption_service.py \
  --input ./input --output ./output \
  --css /path/to/my.css

# デフォルトスタイリングの静的キャプション(白背景、青文字、Courier New)
uv run python scripts/caption_service.py \
  --input ./input --output ./output \
  --caption "0:01-0:05: チャンネル登録お願いします" \
  --caption "0:10-0:15: Instagramもフォローしてね"

# ダークモードスタイルの静的キャプション
uv run python scripts/caption_service.py \
  --input ./input --output ./output \
  --caption "0:01-0:05: Hello world" \
  --caption "0:10-0:20: これはデモです" \
  --style-config config.dark-mode.json

# カスタムスタイル設定の静的キャプション
uv run python scripts/caption_service.py \
  --input ./input --output ./output \
  --caption "0:01-0:05: カスタムテキスト" \
  --style-config my-custom-style.json

# CLIフラグで上書きする静的キャプション
uv run python scripts/caption_service.py \
  --input ./input --output ./output \
  --caption "0:01-0:05: Hello" \
  --style-config config.dark-mode.json \
  --caption-color "#00FF00"

# ウォッチモード(10秒ごとに新しい動画をポーリング)
uv run python scripts/caption_service.py --input ./input --output ./output --watch

実行後

ユーザーに報告:

  • 正常に処理された動画の数と失敗した動画の数。
  • 出力ディレクトリのフルパス。
  • 失敗した動画がある場合は、その名前を明示的に挙げてください。

エッジケース

  • ffmpeg がインストールされていない場合: インストールするようユーザーに指示(Arch/CachyOSでは sudo pacman -S ffmpeg、macOSでは brew install ffmpeg、Ubuntuでは sudo apt install ffmpeg)
  • uv がインストールされていない場合: https://docs.astral.sh/uv/getting-started/installation/ に誘導
  • 入力ディレクトリが空の場合: 静かに終了するのではなく、明確に報告
  • 初回実行ではWhisperモデルをダウンロード(tiny で約140 MB、large で約1.5 GB)— これは一度だけです

リモート文字起こし

このスキルは、pycapsレンダリングはローカルのまま、オプションのリモート文字起こしをサポートしています。

  • デフォルトの動作は完全にローカル: pycaps内のWhisper文字起こし + ローカルレンダリング
  • リモートモードは文字起こしステップのみを置き換えます
  • キャプションレンダリング、テンプレート、CSS処理はローカルのまま

サポートされているプロバイダー

  • huggingface
  • replicate

設定 / CLIキー

キーデフォルト備考
transcription_providernullnull はローカルのWhisper-in-pycapsフローを維持
remote_modelnullオプションのプロバイダー固有の文字起こしモデル上書き
hf_token_envHF_TOKENHuggingFace認証環境変数名
replicate_api_key_envREPLICATE_API_TOKENReplicate認証環境変数名
remote_timeout_seconds300リモート呼び出しタイムアウト

例

# HuggingFaceリモート文字起こし + ローカルpycapsレンダリング
export HF_TOKEN=hf_your_token
uv run python scripts/caption_service.py --input ./input --output ./output --transcription-provider huggingface

# Replicateリモート文字起こし + ローカルpycapsレンダリング
export REPLICATE_API_TOKEN=r8_your_token
uv run python scripts/caption_service.py --input ./input --output ./output --transcription-provider replicate --remote-model <replicate-model-slug>

注意

  • リモート認証/設定がない場合、ローカルモードへのサイレントフォールバックはありません
  • 既存のローカルCLIの使用法は引き続き有効です
  • --transcription-provider を設定しない場合、pycapsは組み込みのWhisperフローを引き続き使用します

Individual skills in this repo

This repo contains 7 individual skills — each has its own dedicated page.

FilippTrigub/abra

>- Animate a still image into a short video clip using fal.ai's LTX-2.3 Fast image-to-video model in the cloud. No GPU required - runs entirely on fal.ai serverless infrastructure.

FilippTrigub/abra

>- Auto-describe and caption images using a local vision-language model. Writes a JSON sidecar per image containing a one-sentence description, a suggested Instagram caption with hashtags, and detected content tags.

FilippTrigub/abra

>- Cut videos into segments, rearrange them, and produce an output video with a specific cuts-per-second rate. Uses MoviePy for video manipulation. Prioritizes audio transcription for timestamped cutting, falls back to adaptive scene detection.

FilippTrigub/abra

>- Edit a region of a video using a text prompt via Wan2.1-VACE inpainting. Supports two modes: background (auto-segment via rembg) or region (rectangle defined by fractions). Requires a CUDA GPU with at least 8 GB free VRAM.

FilippTrigub/abra

>- Video enhancement pipeline. Use this skill when the user wants to sharpen, colour grade, warm, or normalise the audio of videos — including presets for natural, cinematic, or vivid looks.

FilippTrigub/abra

Generate videos from text or images using Higgsfield's multi-model cloud platform. Supports kling, seedance, dop, and dop-preview models. Uses a small preset layer for common creative styles. Auto-detects text-to-video or image-to-video based on input. No GPU required.

FilippTrigub/abra

>- Remove the background from every frame of a video using AI (BiRefNet-general via rembg). Outputs transparent-background video or composites onto a solid colour or image. Requires a CUDA GPU with at least 3 GB free VRAM.

関連スキル