# Anime Quiz Video Generator

Generate "Guess the Anime Opening" videos for YouTube and TikTok.

## Quick Start

```bash
docker-compose up --build
```

After startup:
- Frontend: http://localhost:5173
- Backend API: http://localhost:8000
- API Docs: http://localhost:8000/docs

## Project Structure

```
project-root/
├── backend/
│   ├── app/
│   │   ├── main.py          # FastAPI endpoints
│   │   ├── models.py        # Pydantic models
│   │   ├── video_generator.py # Video generation logic
│   │   └── config.py        # Settings
│   ├── requirements.txt
│   └── Dockerfile
├── frontend/
│   ├── src/
│   │   ├── App.vue          # Main component
│   │   ├── main.js
│   │   └── style.css
│   ├── package.json
│   └── Dockerfile
├── media/
│   ├── audio/               # MP3 anime openings
│   ├── backgrounds/         # Looping MP4 backgrounds
│   └── posters/             # Anime poster images
├── output/
│   └── videos/              # Generated videos
└── docker-compose.yml
```

## Adding Content

### Audio Files (Required)
Place MP3 files of anime openings in `media/audio/`:
```
media/audio/
├── aot_op1.mp3
├── demon_slayer_op1.mp3
└── jjk_op1.mp3
```

### Background Videos (Recommended)
Place looping MP4 backgrounds in `media/backgrounds/`:
- Recommended duration: 5-10 seconds
- Abstract animations, particles, gradients work best
- Will be looped and resized automatically

### Posters (Optional)
Place anime poster images in `media/posters/`:
- Supported formats: JPG, PNG, WebP
- Will be displayed in answer scenes

## Video Modes

### Shorts / TikTok
- Resolution: 1080x1920 (9:16)
- Fast pacing
- Best for 3-5 questions

### Full Video (YouTube)
- Resolution: 1920x1080 (16:9)
- Includes final screen with CTA
- Best for 10-20 questions

## API Endpoints

| Method | Endpoint | Description |
|--------|----------|-------------|
| GET | /health | Health check |
| GET | /content | List available media |
| POST | /generate | Generate video |
| GET | /download/{filename} | Download video |
| GET | /videos-list | List generated videos |

## Example Request

```json
{
  "mode": "shorts",
  "questions": [
    {
      "anime": "Attack on Titan",
      "opening_file": "aot_op1.mp3",
      "start_time": 32,
      "difficulty": "easy",
      "poster": "aot.jpg"
    }
  ],
  "audio_duration": 3
}
```

## Requirements

- Docker
- Docker Compose

## Tech Stack

- **Backend**: Python 3.12, FastAPI, MoviePy, FFmpeg
- **Frontend**: Vue 3, Vite
- **Container**: Docker, Docker Compose
