# Reel Editor - Setup e Configuração

## Acesso
https://video.agenciaclimb.com.br

## Configurações pendentes

### 1. Pexels API Key (B-roll automático)

Sem a chave, o pipeline funciona normalmente mas sem B-rolls.

1. Crie conta em https://www.pexels.com/api/
2. Copie a chave API gerada
3. Defina a variável de ambiente antes de iniciar o backend:

```bash
export PEXELS_API_KEY="sua_chave_aqui"
# ou edite direto em /opt/mia/workspace/video_editor/backend/pexels_utils.py
# linha: PEXELS_KEY = os.getenv("PEXELS_API_KEY", "PEXELS_API_KEY_PLACEHOLDER")
```

Depois reinicie o backend:
```bash
pkill -f video_editor/backend/app.py
nohup python3 /opt/mia/workspace/video_editor/backend/app.py > /opt/mia/logs/video_editor_backend.log 2>&1 &
```

### 2. Músicas royalty-free

Adicione arquivos MP3 em `/opt/mia/workspace/video_editor/backend/music/`

Fontes gratuitas:
- https://pixabay.com/music/ (filtrar por "corporate", "upbeat", "inspiring")
- https://www.bensound.com/ (royalty free com atribuição)

Nomes sugeridos: `upbeat.mp3`, `corporate.mp3`, `inspiring.mp3`

### 3. Whisper - primeiro uso

Na primeira execução o modelo `base` (~150MB) é baixado automaticamente da internet. Aguarde 1-2 minutos na primeira transcrição.

## Reiniciar serviços

```bash
# Backend (porta 5054)
pkill -f video_editor/backend/app.py
nohup python3 /opt/mia/workspace/video_editor/backend/app.py > /opt/mia/logs/video_editor_backend.log 2>&1 &

# Frontend (porta 8777)
pkill -f video_editor/frontend/server.py
nohup python3 /opt/mia/workspace/video_editor/frontend/server.py > /opt/mia/logs/video_editor_frontend.log 2>&1 &
```

## Logs

- Backend: `/opt/mia/logs/video_editor_backend.log`
- Frontend: `/opt/mia/logs/video_editor_frontend.log`

## Estrutura de arquivos gerados

- Temporários: `/opt/mia/workspace/video_editor/backend/temp/` (limpeza automática após 24h)
- Outputs finais: `/opt/mia/workspace/video_editor/backend/output/`
