# 🎬 FikoYT MVD — LTX Video Subsystem

LTX-Video tabanlı segment-segment video üretimi. Sesli/resimli/referanslı.
Bypass'li (Whisper baştan çalışmaz). Standalone modu (proje olmadan).

## Kurulum

### 1. ComfyUI-LTXVideo extension (ZORUNLU)
```bash
cd ComfyUI/custom_nodes
git clone https://github.com/Lightricks/ComfyUI-LTXVideo
```
ComfyUI'yi restart et.

### 2. LTX-Video Checkpoint (ZORUNLU)
İndir: https://huggingface.co/Lightricks/LTX-Video/blob/main/ltx-video-2b-v0.9.5.safetensors
Konum: `ComfyUI/models/checkpoints/ltx-video-2b-v0.9.5.safetensors`

### 3. VideoHelperSuite (ÖNERİLEN — mp4 çıktısı için)
```bash
cd ComfyUI/custom_nodes
git clone https://github.com/Kosinkadink/ComfyUI-VideoHelperSuite
```

### 4. FFmpeg (ZORUNLU — birleştirme için)
Windows: https://www.gyan.dev/ffmpeg/builds/  → PATH'e ekle
Linux: `apt install ffmpeg`
Mac: `brew install ffmpeg`

### 5. (Opsiyonel) IPAdapter + ControlNet Aux — referanslar için
- `git clone https://github.com/cubiq/ComfyUI_IPAdapter_plus`
- `git clone https://github.com/Fannovel16/comfyui_controlnet_aux`

## Kullanım

### Segment Modu
1. Müzik Stüdyosu'nda şarkı analiz et + segment kes
2. Görsel Stüdyosu'nda segment görselleri üret
3. **🎬 Video Stüdyosu**'nu aç
4. Her segment için "Üret" ya da **🎬 Hepsini Üret** (Toplu Mod)
5. Tamamlanınca **📦 Final'i Birleştir** → master ses dahil tek MP4

### Standalone Modu
- Şarkı analizi yapmadan tek resim + ses + prompt ile video üret
- Video Stüdyosu → 📤 Standalone Modu

### Toplu Mod
- Tüm segmentlerin videolarını sıralı üretir
- Paralel = 1 (VRAM az ise), 2 (VRAM çok ise)
- Hata durumunda retry policy

## Node'lar

| Node | İş |
|------|-----|
| 🎬 LTX Loader | Checkpoint + üretim parametreleri bundle'lar |
| 🎬 LTX Segment Video Gen | Tek segment için video üretir |
| 🎞 Video Combiner | Segmentleri ffmpeg ile birleştirir + master ses |
| 📈 Video Upscaler | Real-ESRGAN veya lanczos ile 2x/4x |
| 📂 Video Batch Manager | Proje video manifest'i |

## REST Endpoint'leri

| Endpoint | Method | Açıklama |
|----------|--------|----------|
| `/fikoyt_mvd/ltx/capabilities` | GET | LTX/ffmpeg/checkpoint durumu |
| `/fikoyt_mvd/ltx/list_segments` | GET | Proje segment listesi (video durumu) |
| `/fikoyt_mvd/ltx/generate_segment` | POST | Tek segment video üret (bypass) |
| `/fikoyt_mvd/ltx/standalone_generate` | POST | Standalone üretim |
| `/fikoyt_mvd/ltx/job_status` | GET | Üretim durumu (prompt_id) |
| `/fikoyt_mvd/ltx/cancel` | POST | Üretimi iptal |
| `/fikoyt_mvd/ltx/combine_all` | POST | Final birleştirme |
| `/fikoyt_mvd/ltx/save_video_variant` | POST | Varyant kaydet |

## Mimari

```
                 Müzik Studio                 Görsel Studio              Video Studio
                  (analiz)                     (prompt+image)            (LTX video)
                      |                              |                        |
                      v                              v                        v
              segments[] (text)        seg.image_variants[]       seg.video_variants[]
                                            (Flux+PuLID)              (LTX I2V)
                                                                          |
                                                                          v
                                                            🎞 Video Combiner (ffmpeg)
                                                                          |
                                                                          v
                                                            📦 klip_final.mp4
```

## Bypass Akışı

Frontend (`bypass-workflow.js`) MVD ana workflow'unu (SmartSegmenter, AudioSplitter, vb.) tetiklemeden DOĞRUDAN minimal LTX workflow'unu ComfyUI `/prompt` API'sine gönderir. Whisper bir daha çalışmaz.

## Varyant Sistemi

Image'larda olduğu gibi her segment için `video_variants[]` array'i tutulur. ◀ N/M ▶ ile gezilir, ✕ ile silinir. Proje JSON'una kaydedilir, restart sonrası restore edilir.

## Sorun Giderme

### "LTX kurulu DEĞİL" uyarısı
ComfyUI-LTXVideo extension kurulmamış. Adım 1'i yap.

### "ffmpeg yok" uyarısı
ffmpeg PATH'te değil. Adım 4'ü yap.

### "Checkpoint bulunamadı"
`models/checkpoints/ltx-video-2b-*.safetensors` yok. Adım 2'yi yap.

### Yavaş üretim
- Steps 30 → 20'ye düşür
- Resolution 768x512 → 576x320
- Frames 121 → 65 (kısa segment)

### Out of memory (OOM)
- ComfyUI'yi `--lowvram` flag ile başlat
- Paralel batch = 1
- VRAM yönetimi: "ComfyUI VRAM'ı Boşalt" butonu

## Lisans
LTX-Video: OpenRAIL-M (Lightricks)
ComfyUI: MIT
FikoYT MVD: MIT
