mcpField
C
comfyui-video-production

comfyui-video-production

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

comfyui-video-production について

comfyui-video-productionは、ComfyUIでの動画制作ワークフローを統括するスキルです。キーフレームを使った物語動画、画像からの一括動画生成、クリップ間のトランジションに加え、インスタンス復旧と出力検証を扱います。

主な機能

  1. 01キーフレーム・画像からの動画生成・結合のパイプライン
  2. 02画像からの動画の一括処理
  3. 03FFmpegによるトランジション効果
  4. 04ComfyUIインスタンスの稼働確認と復旧
  5. 05動画仕様と画質の検証
  6. 06進捗追跡、ログ、出力のバージョン復元

活用シーン

  1. 01複数のキーフレームから物語動画を制作
  2. 02複数の画像を個別の動画クリップに変換
  3. 03既存クリップにトランジションを加えて結合
  4. 04ComfyUIの障害対応と生成結果の検証

インストール

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

$npx skills add https://github.com/mckruz/comfyui-expert --skill comfyui-video-production

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

同梱ファイル

SKILL.md と一緒にインストールされる参考資料やスクリプト。

eval/
benchmark.yaml
EVAL.md
run-eval.sh
test-cases.yaml
trigger-tests.yaml
eval/results/
.gitignore
.gitkeep
references/
api-reference.md
concatenation.md
evolution.md
instance-management.md

詳細

ComfyUI 動画制作パイプライン

自動エラー復旧、品質検証、インスタンス管理を備えた、ComfyUI のエンドツーエンド動画制作オーケストレーションです。

クイックスタート:どのパイプラインを選ぶか?

複数のショットで構成されるストーリー動画を作成しますか? → キーフレームパイプライン - キーフレームを生成 → アニメーション化 → トランジションを付けて結合

既存の画像をアニメーション化しますか? → I2V バッチパイプライン - 画像を読み込み → I2V ジョブをキューに追加 → 自動検証 → 結合

シーン間に滑らかなトランジションが必要ですか? → トランジションパイプライン - FFmpeg によるクロスフェード、モーションブラー、ズーム効果

ComfyUI が停止またはクラッシュしましたか? → インスタンスマネージャー - 自動再起動、ヘルスチェック、キューの監視

動画の問題をデバッグしますか? → 検証スイート - 解像度、FPS、コーデック、顔の一貫性、カラーグレーディングを確認


コアパイプライン

パイプライン 1:キーフレームから動画へ(ナラティブ動画の作成)

使用する場面: 複数の異なるショットで構成される、ストーリー性のある動画を作成する場合

1. Keyframe Generation Phase
   - Generate consistent keyframes with IP-Adapter/LoRA
   - Validate face consistency, lighting, pose progression
   - Save to organized directory structure
   - Auto-retry failed generations

2. I2V Animation Phase
   - Queue each keyframe to I2V model (Wan 2.2, LTX-2, AnimateDiff)
   - Monitor progress via ComfyUI API
   - Validate each clip (resolution, fps, duration)
   - Auto-retry with different seeds if failed

3. Concatenation Phase
   - Pre-flight validation (ensure all clips match)
   - Apply transition effects (crossfade, motion blur)
   - FFmpeg encoding with proper codec
   - Export final video with metadata

4. Quality Assurance
   - Face consistency check across clips
   - Color grading consistency
   - Audio sync validation (if applicable)
   - Generate QA report

想定される出力: 滑らかなトランジションを備えた、まとまりのある単一の動画


パイプライン 2:I2V のバッチ処理

使用する場面: 個別にアニメーション化する画像が複数ある場合

1. Image Discovery
   - Scan directory for source images
   - Validate image specs (resolution, format)
   - Generate processing manifest

2. Parallel I2V Queue
   - Queue all images to ComfyUI with appropriate prompts
   - Stagger submissions to avoid overload
   - Monitor queue depth and ETA

3. Progressive Validation
   - Check each completed video immediately
   - Flag issues (wrong resolution, fps, corruption)
   - Auto-retry flagged videos

4. Export & Organize
   - Move validated videos to output directory
   - Generate index with metadata
   - Create contact sheet (thumbnail preview grid)

想定される出力: 検証済みのアニメーションクリップを格納したディレクトリ


パイプライン 3:トランジション付き動画の連結

使用する場面: 既存の動画クリップをプロ品質のトランジションで結合する場合

1. Clip Validation
   - Verify all clips exist and are readable
   - Check resolution, fps, codec consistency
   - Report mismatches with fix suggestions

2. Transition Planning
   - Detect scene changes (cut detection)
   - Recommend transition types (crossfade, zoom, pan)
   - Calculate transition timing

3. FFmpeg Pipeline
   - Apply transitions between clips
   - Re-encode with consistent settings
   - Preserve quality (high bitrate, proper codec)

4. Audio Handling
   - Extract audio from clips (if present)
   - Crossfade audio at transitions
   - Sync to final video timeline

想定される出力: シームレスなトランジションを備えた、洗練された動画


モデルのサポート(2026)

画像から動画を生成するモデル
モデル品質速度VRAM最適な用途備考
LTX-2★★★★★中16GB+4K 動画の制作ネイティブ 4K、音声+動画
Wan 2.2 MoE★★★★★低速24GB+映画品質の映像美最初と最後のフレームを制御
Wan 2.1 14B★★★★低速24GB高品質実績があり、安定
Wan 2.1 1.3B★★★高速8GB素早い反復作業コンシューマー向け
AnimateDiff V3★★★高速8GB長さ無制限モーション LoRA
SVD(Stable Video Diffusion)★★★中12GB短いクリップ14~25 フレーム
トランジション効果
効果用途エンコードコスト
クロスフェード汎用低
モーションブラー動きの多いシーン中
ズームイン/アウト劇的な強調中
左/右へのパンシーンの導入中
黒へのフェード/黒からのフェード章の区切り低
カスタム LUTカラーグレーディング低

ComfyUI インスタンス管理

ヘルスモニタリング
# Auto-detected issues:
- Queue stalled (no progress for 5+ minutes)
- Memory leak (VRAM usage climbing)
- Process crashed (connection refused)
- API unresponsive (timeout on /queue endpoint)
- Disk full (output directory at capacity)
自動復旧アクション
1. Soft Recovery (no restart)
   - Clear stuck queue items
   - Force garbage collection
   - Unload models from VRAM

2. Hard Recovery (restart required)
   - Save current queue state
   - Kill ComfyUI process gracefully
   - Wait for port release
   - Restart with same config
   - Restore queue from saved state

3. Emergency Fallback
   - Switch to backup ComfyUI instance
   - Redirect queue to instance on different port
   - Continue processing without data loss
マルチインスタンスのサポート
# Run multiple ComfyUI instances for parallel processing
Instance 1: localhost:8188 (primary - I2V generation)
Instance 2: localhost:8189 (secondary - upscaling/post-processing)
Instance 3: localhost:8190 (backup - standby for failover)

# Load balancing strategy:
- Round-robin for equal workloads
- Priority-based for mixed tasks
- Failover for crashed instances

検証スイート

生成前の検証
✓ Check ComfyUI is running and responsive
✓ Verify models are loaded (UNET, VAE, CLIP)
✓ Confirm output directory has sufficient space
✓ Validate source images exist and are readable
✓ Check prompts are non-empty and formatted correctly
✓ Verify workflow JSON is valid
生成後の検証
✓ Video file exists and is non-zero size
✓ Resolution matches expected (e.g., 768x1024)
✓ FPS matches expected (e.g., 16 or 25)
✓ Duration matches expected (e.g., 3-5 seconds)
✓ Codec is compatible (h264, h265)
✓ No corruption (can read all frames)
✓ Face consistency score >0.85 (if character video)
✓ Color histogram within expected range
品質指標
Metrics tracked:
- Face embedding distance (identity consistency)
- Optical flow magnitude (motion smoothness)
- Frame PSNR/SSIM (interpolation quality)
- Color histogram deviation (lighting consistency)
- Audio sync offset (if audio present)

エラー処理と復旧

再試行戦略
1. Seed Randomization Retry
   - Failed generation? Try different seed
   - Max 3 attempts per keyframe
   - Track seeds that fail (avoid reuse)

2. Parameter Adjustment Retry
   - CFG too high causing artifacts? Lower it
   - Steps too low causing incompleteness? Increase
   - Resolution too high OOM? Downscale

3. Model Fallback Retry
   - Wan 2.2 14B OOM? Fall back to 1.3B
   - LTX-2 unavailable? Fall back to Wan 2.1
   - AnimateDiff motion broken? Switch motion LoRA

4. Checkpoint Resume
   - Save progress after each successful clip
   - Resume from last successful checkpoint
   - Skip already-generated clips
失敗のログ記録
logs/
├── 2026-02-16_pipeline.log       # Main pipeline log
├── 2026-02-16_comfyui.log        # ComfyUI stdout/stderr
├── 2026-02-16_validation.json    # Validation results
├── 2026-02-16_failures.json      # Failed attempts with reasons
└── 2026-02-16_recovery.json      # Recovery actions taken

ディレクトリ構成

整理された出力
project_name/
├── 00_keyframes/                 # Source keyframe images
│   ├── kf01_scene_description.png
│   ├── kf02_scene_description.png
│   └── ...
├── 01_clips/                     # Individual animated clips
│   ├── clip_001_kf01.mp4
│   ├── clip_002_kf02.mp4
│   └── ...
├── 02_validated/                 # Clips that passed validation
│   ├── clip_001_kf01.mp4
│   ├── clip_002_kf02.mp4
│   └── ...
├── 03_transitions/               # Intermediate files for transitions
│   ├── transition_001_002.mp4
│   └── ...
├── 04_final/                     # Final combined video
│   ├── final_video_v1.mp4
│   ├── final_video_v2.mp4        # After revisions
│   └── ...
├── logs/                         # Execution logs
├── metadata/                     # JSON metadata for each asset
└── manifest.json                 # Complete project manifest

ワークフローの例

例 1:30 秒のナラティブ動画(5 つのキーフレーム)
# Configuration
project_name = "sage_character_reveal"
keyframes = 5
i2v_model = "wan_2.2_moe"
target_duration = 30  # seconds
fps = 16

# Pipeline execution
1. Generate 5 keyframes (IP-Adapter + LoRA)
   → sage_kf01_over_shoulder.png
   → sage_kf02_turning.png
   → sage_kf03_cardigan_fallen.png
   → sage_kf04_removing_bra.png
   → sage_kf05_topless.png

2. Validate keyframes
   → Face consistency: 0.92 ✓
   → Lighting consistency: 0.88 ✓
   → Pose progression: logical ✓

3. Queue I2V for each keyframe
   → clip_001: 6s @ 16fps (96 frames) ✓
   → clip_002: 6s @ 16fps (96 frames) ✓
   → clip_003: 6s @ 16fps (96 frames) ✓
   → clip_004: 6s @ 16fps (96 frames) ✓
   → clip_005: 6s @ 16fps (96 frames) ✓

4. Apply 0.5s crossfade transitions
   → Total: 30s - 2s (4 transitions × 0.5s) = 28s net

5. Export final video
   → sage_character_reveal_final.mp4 (30s, 768x1024, 16fps)
例 2:20 枚の画像をバッチ処理
# Configuration
input_dir = "E:/ComfyUI/input/character_expressions"
i2v_model = "ltx_2"
motion_prompt = "gentle breathing, subtle movement, natural"
batch_size = 4  # Process 4 at a time

# Pipeline execution
1. Scan input directory
   → Found 20 PNG files

2. Queue 4 at a time to ComfyUI
   → Batch 1: expr_001.png → expr_004.png ✓
   → Batch 2: expr_005.png → expr_008.png ✓
   → Batch 3: expr_009.png → expr_012.png ✓
   → Batch 4: expr_013.png → expr_016.png ✓
   → Batch 5: expr_017.png → expr_020.png ✓

3. Validate each output
   → 19/20 passed (expr_011 failed - wrong resolution)
   → Retry expr_011 with corrected settings ✓

4. Export batch
   → 20 validated clips in output/expressions/
   → Generated contact sheet: expressions_preview.png

参考ファイル

詳細ガイド
  • references/keyframe-generation.md - IP-Adapter、LoRA、一貫性を保つためのヒントを使ったキーフレームの作成
  • references/i2v-workflows.md - Wan 2.2、LTX-2、AnimateDiff、SVD のワークフローテンプレート
  • references/concatenation.md - FFmpeg コマンド、トランジション効果、音声処理
  • references/validation.md - 品質指標、検証しきい値、トラブルシューティング
  • references/instance-management.md - ComfyUI のヘルスチェック、再起動スクリプト、マルチインスタンスの設定
  • references/api-reference.md - ComfyUI API エンドポイント、キュー管理、ワークフローの送信
  • references/troubleshooting.md - よくある問題と解決策

他のスキルとの連携

組み合わせるスキル:

  • comfyui-character-gen - キャラクターのアイデンティティを保持しながら、最初のキーフレームを生成する場合
  • video-assembly - 高度な編集やポストプロダクションを行う場合
  • youtube-uploader - 制作後に YouTube へ直接アップロードする場合

高度な機能

適応型の品質
# Automatically adjust settings based on available resources
if vram_available > 24:
    use_model = "wan_2.2_moe_14b"
    resolution = (832, 1216)
    batch_size = 1
elif vram_available > 12:
    use_model = "wan_2.1_1.3b"
    resolution = (768, 1024)
    batch_size = 2
else:
    use_model = "animatediff_v3"
    resolution = (512, 768)
    batch_size = 4
進捗状況の追跡
# Real-time progress updates
[Pipeline] Keyframe generation: 3/5 complete (60%)
[Pipeline] ETA: 12 minutes remaining
[I2V] clip_003 generating: 47/96 frames (49%)
[I2V] Current speed: 0.42 it/s
[Validation] clip_001: PASS ✓
[Validation] clip_002: PASS ✓
ロールバックとバージョン管理
# Automatically version outputs
output/
├── final_video_v1.mp4        # Initial render
├── final_video_v2.mp4        # After fixing clip_003
├── final_video_v3.mp4        # After adding transitions
└── final_video_final.mp4     # Approved version

# Rollback to previous version
rollback_to_version(2)  # Restore v2 as current

ワークフローの生成

動画制作ワークフローの作成を依頼された場合:

  1. 要件を評価する

    • ショット/キーフレームの数
    • ショットごとの目標時間
    • I2V モデルの希望
    • トランジションのスタイル
    • 品質と速度のトレードオフ
  2. パイプライン設定を生成する

    • VRAM/品質の要件に基づくモデル選択
    • 解像度と FPS の設定
    • 検証のしきい値
    • 再試行ポリシー
  3. 実行スクリプトを提供する

    • API 送信用の Python スクリプト
    • 結合用の FFmpeg コマンド
    • 検証チェック
    • 復旧手順
  4. 監視して適応する

    • 進捗状況をリアルタイムで追跡する
    • 障害を早期に検出する
    • 復旧戦略を適用する
    • 最終的な指標を報告する

ベストプラクティス

キーフレーム動画の場合
  • すべてのキーフレームで同じシードを使用します(一貫性を保つため)
  • IP-Adapter の重みは 0.75~0.85 にします(強力でありながら、硬直しない設定)
  • I2V の前にキーフレームを検証します(計算リソースを節約できます)
  • クリップはそれぞれ 4~8 秒にします(最適な長さです)
  • 0.5~1 秒のクロスフェードトランジションを使用します(滑らかでありながら、遅くなりません)
バッチ処理の場合
  • 小さなバッチ(1 回につき 4~8 件)で処理します
  • 各バッチの処理直後に検証します
  • バッチの処理が成功するたびにチェックポイントを保存します
  • 重要なクリップには優先キューを使用します
インスタンス管理の場合
  • 30 秒ごとにキューの深さを監視します
  • 5 分間進捗がない場合は再起動します
  • 別のポートでバックアップインスタンスを準備しておきます
  • デバッグ用に、すべての再起動イベントを記録します

パフォーマンスの最適化

RTX 50 シリーズ(2026)
# ComfyUI launch flags for optimal performance
--highvram \
--fp8_e4m3fn-unet \
--reserve-vram 7 \
--use-pytorch-cross-attention

# Expected performance:
- Wan 2.2 14B: ~2-3 min per 5s clip (832x1216)
- LTX-2 4K: ~4-5 min per 5s clip (1920x1080)
- Wan 2.1 1.3B: ~1-2 min per 5s clip (768x1024)
AMD GPU(ROCm)
# ComfyUI v0.8.1+ has native ROCm support
# No special flags needed, just install ROCm drivers

スキルの進化

このスキルは、新しい I2V モデルや技術に適応します。新しいモデルがリリースされた場合:

  1. モデルの仕様を references/i2v-workflows.md に追加します
  2. 新しいモデル用のワークフローテンプレートを作成します
  3. メインパイプラインのモデル選択ロジックを更新します
  4. サンプルプロジェクトでテストします
  5. パフォーマンス特性を文書化します

更新手順については、references/evolution.md を参照してください。

コメント