making single veo 3.1 model default
447
CLAUDE.md
|
|
@ -4,214 +4,315 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
|
|||
|
||||
## Project Overview
|
||||
|
||||
This is a full-stack web application for integrating Google's Veo 3.0 video generation model. The project consists of:
|
||||
Full-stack web application integrating Google's **Veo 3.1 video generation models only**. The system provides text-to-video and image-to-video generation with advanced features like frame interpolation and reference images.
|
||||
|
||||
- **Backend**: Flask REST API that interfaces with Google's Gen AI SDK (v1.17.0) for Veo 3.0 video generation
|
||||
- **Frontend**: React single-page application with Material-UI components and MSAL authentication
|
||||
- **Storage**: Google Cloud Storage for temporary video and image file storage
|
||||
- **Deployment**: Production-ready with systemd service and Apache reverse proxy configuration
|
||||
**Stack:**
|
||||
- Backend: Flask 3.0 + Google Gen AI SDK 1.47.0
|
||||
- Frontend: React 18 + Vite + Material-UI 5
|
||||
- Storage: Google Cloud Storage
|
||||
- Auth: Azure AD SSO (MSAL) with dev mode bypass
|
||||
- Deployment: systemd service + Apache reverse proxy
|
||||
|
||||
### Key Features
|
||||
- Text-to-video and image-to-video generation
|
||||
- Dual model support (Veo 3.0 and Veo 3.0 Fast)
|
||||
- Multi-process job queue system (max 2 concurrent jobs per instance)
|
||||
- Real-time progress tracking with job status polling
|
||||
- Azure AD SSO authentication (with dev mode bypass)
|
||||
- Automatic file cleanup and download management
|
||||
- Usage tracking via webhook integration
|
||||
**Note:** This application exclusively uses Veo 3.1 models (Standard and Fast variants). Veo 3.0 models are not supported.
|
||||
|
||||
## Common Commands
|
||||
|
||||
### Development
|
||||
```bash
|
||||
# Start both frontend and backend in development mode
|
||||
# Start both frontend and backend
|
||||
./run-dev.sh
|
||||
|
||||
# Start backend only
|
||||
cd backend && python app.py
|
||||
# Backend only (from backend/)
|
||||
python app.py
|
||||
|
||||
# Start frontend only
|
||||
cd frontend && npm run dev
|
||||
# Frontend only (from frontend/)
|
||||
npm run dev
|
||||
|
||||
# Build frontend for production
|
||||
cd frontend && npm run build
|
||||
|
||||
# Frontend linting
|
||||
cd frontend && npm run lint
|
||||
```
|
||||
|
||||
### Backend Commands
|
||||
```bash
|
||||
# Install Python dependencies
|
||||
cd backend && pip install -r requirements.txt
|
||||
|
||||
# Create virtual environment
|
||||
python -m venv venv && source venv/bin/activate # Linux/Mac
|
||||
python -m venv venv && venv\Scripts\activate # Windows
|
||||
|
||||
# Run backend in debug mode
|
||||
cd backend && FLASK_DEBUG=True python app.py
|
||||
```
|
||||
|
||||
### Production Deployment
|
||||
```bash
|
||||
# Backend systemd service management
|
||||
sudo systemctl start veo-video-generator
|
||||
sudo systemctl stop veo-video-generator
|
||||
sudo systemctl restart veo-video-generator
|
||||
sudo systemctl status veo-video-generator
|
||||
|
||||
# View service logs
|
||||
sudo journalctl -u veo-video-generator -f
|
||||
```
|
||||
|
||||
## Project Structure
|
||||
|
||||
```
|
||||
veo3_poc/
|
||||
├── backend/ # Flask backend application
|
||||
│ ├── routes/ # API routes (api.py, health.py)
|
||||
│ ├── utils/ # Utilities (auth.py, storage.py)
|
||||
│ ├── app.py # Flask app initialization
|
||||
│ ├── config.py # Configuration management
|
||||
│ ├── video_generator.py # Core Veo 3.0 integration
|
||||
│ └── requirements.txt # Python dependencies
|
||||
├── frontend/ # React frontend application
|
||||
│ ├── src/
|
||||
│ │ ├── components/ # React components (VideoForm, ProgressIndicator, etc.)
|
||||
│ │ ├── services/ # API service layer
|
||||
│ │ └── config/ # MSAL configuration
|
||||
│ └── package.json # Node.js dependencies
|
||||
└── service-account.json # Google Cloud service account key
|
||||
```
|
||||
|
||||
## Configuration Requirements
|
||||
|
||||
### Backend Configuration (`backend/.env`)
|
||||
|
||||
The backend uses environment-specific files:
|
||||
- **`.env.development`**: Local development with debug mode and localhost CORS
|
||||
- **`.env.production`**: Production deployment with strict CORS and optimized settings
|
||||
|
||||
Key environment variables:
|
||||
- `PROJECT_ID`: Google Cloud project ID
|
||||
- `OUTPUT_GCS_BUCKET_NAME`: GCS bucket for temporary storage
|
||||
- `REGION`: Google Cloud region (us-central1)
|
||||
- `MODEL_ID`: Veo model identifier (veo-3.0-generate-preview)
|
||||
- `MODEL_FAST_ID`: Veo Fast model identifier (veo-3.0-fast-generate-preview)
|
||||
- `SERVICE_ACCOUNT_KEY_PATH`: Path to service account JSON (../service-account.json)
|
||||
- `PORT`: Backend server port (7394)
|
||||
- `FRONTEND_URL`: Frontend URL for CORS configuration
|
||||
|
||||
### Frontend Configuration (`frontend/.env`)
|
||||
|
||||
Environment-specific files:
|
||||
- **`.env.development`**: Localhost API, auth bypass enabled (`VITE_DEV_MODE=true`)
|
||||
- **`.env.production`**: Production API, MSAL authentication enabled
|
||||
|
||||
Key environment variables:
|
||||
- `VITE_API_BASE_URL`: Backend API URL
|
||||
- `VITE_DEV_MODE`: Enable/disable auth bypass
|
||||
- `VITE_MSAL_CLIENT_ID`: Azure AD client ID
|
||||
- `VITE_MSAL_AUTHORITY`: Azure AD authority URL
|
||||
- `VITE_MSAL_REDIRECT_URI`: Authentication redirect URI
|
||||
|
||||
## Running the Application
|
||||
|
||||
### Quick Start (Development)
|
||||
|
||||
```bash
|
||||
# Run both frontend and backend with one command
|
||||
./run-dev.sh
|
||||
|
||||
# Access:
|
||||
# Frontend: http://localhost:3000
|
||||
# Backend API: http://localhost:7394
|
||||
```
|
||||
|
||||
### Manual Start
|
||||
|
||||
**Backend:**
|
||||
### Backend Setup
|
||||
```bash
|
||||
cd backend
|
||||
python -m venv venv
|
||||
source venv/bin/activate # Linux/Mac
|
||||
venv\Scripts\activate # Windows
|
||||
pip install -r requirements.txt
|
||||
cp .env.development .env
|
||||
python app.py
|
||||
```
|
||||
|
||||
**Frontend:**
|
||||
### Frontend Setup
|
||||
```bash
|
||||
cd frontend
|
||||
npm install # first time only
|
||||
npm install
|
||||
cp .env.development .env
|
||||
npm run dev
|
||||
```
|
||||
|
||||
### Production Deployment
|
||||
### Production Service Management
|
||||
```bash
|
||||
# systemd service control
|
||||
sudo systemctl start veo-video-generator
|
||||
sudo systemctl stop veo-video-generator
|
||||
sudo systemctl restart veo-video-generator
|
||||
sudo systemctl status veo-video-generator
|
||||
|
||||
1. Build frontend: `cd frontend && npm run build`
|
||||
2. Copy `dist/` contents to Apache web root
|
||||
3. Configure systemd service: `veo-video-generator.service`
|
||||
4. Configure Apache: `apache.conf` and `apache-htaccess.txt`
|
||||
# View logs
|
||||
sudo journalctl -u veo-video-generator -f
|
||||
```
|
||||
|
||||
## Key Dependencies
|
||||
|
||||
### Backend
|
||||
- `flask==3.0.0` - Web framework
|
||||
- `google-genai==1.17.0` - Google Gen AI SDK for Veo 3.0 (replaces deprecated google-generativeai)
|
||||
- `google-cloud-storage==2.12.0` - GCS operations
|
||||
- `Pillow==10.1.0` - Image processing
|
||||
|
||||
### Frontend
|
||||
- `react==18.2.0` - UI framework
|
||||
- `@mui/material==5.15.1` - Material-UI components
|
||||
- `@azure/msal-react==2.0.7` - Microsoft authentication
|
||||
- `vite==5.0.8` - Build tool
|
||||
|
||||
## Core Architecture
|
||||
## Architecture
|
||||
|
||||
### Job Queue System
|
||||
The application implements a multi-process job queue system in `backend/video_generator.py`:
|
||||
- **Global queue**: `job_queue` array stores pending job IDs
|
||||
- **Processing jobs**: `processing_jobs` tracks active jobs (max 2 concurrent via `CONCURRENT_JOB_LIMIT`)
|
||||
- **User limits**: `user_job_counts` enforces max 4 jobs per user (`MAX_QUEUE_SIZE_PER_USER`)
|
||||
- **Job status**: In-memory `job_status` dictionary tracks all job states (consider Redis for production scaling)
|
||||
The core of the application is a multi-process job queue system implemented in `backend/video_generator.py`:
|
||||
|
||||
### Backend Request Flow
|
||||
1. **Job creation**: `generate_video_task()` validates input, creates UUID, queues job
|
||||
2. **Queue processing**: `process_job_queue()` thread picks jobs from queue
|
||||
3. **Video generation**: `generate_video()` calls Google Gen AI SDK with threading
|
||||
4. **Status updates**: Jobs transition through: queued → processing → polling → completed/failed
|
||||
5. **File management**: Videos downloaded to `temp_downloads/`, cleaned up after user download
|
||||
**Key Data Structures:**
|
||||
- `job_status`: In-memory dict tracking all job states (consider Redis for production scaling)
|
||||
- `job_queue`: Global FIFO array of pending job IDs
|
||||
- `processing_jobs`: Array of currently active jobs (max 2 concurrent via `CONCURRENT_JOB_LIMIT`)
|
||||
- `user_job_counts`: Per-user job count tracking (no limits, but tracked for monitoring)
|
||||
|
||||
### Authentication Architecture
|
||||
- **Production**: Azure AD SSO via MSAL (`@azure/msal-react`)
|
||||
- **Development**: Auth bypass when `VITE_DEV_MODE=true`
|
||||
- **Backend validation**: No auth validation on backend (frontend-only)
|
||||
**Queue Processing Flow:**
|
||||
1. Jobs are created with UUID and added to `job_queue` via `add_to_queue()`
|
||||
2. Background thread in `start_next_job()` picks jobs when `len(processing_jobs) < CONCURRENT_JOB_LIMIT`
|
||||
3. `process_video_generation()` handles the actual generation in a separate thread
|
||||
4. `complete_job()` removes from `processing_jobs` and triggers next job
|
||||
|
||||
**Job Lifecycle States:**
|
||||
- `queued` → `processing` → `generating` → `downloading` → `completed`
|
||||
- OR: `failed`, `cancelled`, `retry_1_of_3`, etc.
|
||||
|
||||
### Video Generation Pipeline
|
||||
|
||||
**Request Flow (backend/routes/api.py → video_generator.py):**
|
||||
1. **POST /api/generate**: Multipart form data with prompt, images, parameters
|
||||
2. **Job creation**: `generate_video_async()` creates UUID, validates inputs
|
||||
3. **Image processing**: If images provided, validate → convert to JPEG → upload to GCS `temp_images/`
|
||||
4. **API calls**: Multiple threaded calls to Google Gen AI SDK (1 call per requested video)
|
||||
5. **Polling**: Backend polls operations every 30s, frontend polls status every 2s
|
||||
6. **Download**: Videos downloaded from GCS to `temp_downloads/job_{job_id}/`
|
||||
7. **Packaging**: Multiple videos + images packaged into zip if needed
|
||||
8. **Cleanup**: Auto-delete 5 seconds after successful download
|
||||
|
||||
**Key Functions:**
|
||||
- `generate_video_async()`: Queue job, return job ID immediately
|
||||
- `process_video_generation()`: Main processing function (runs in thread)
|
||||
- `start_next_job()`: Queue processor that maintains concurrent limit
|
||||
- `complete_job()`: Cleanup and start next queued job
|
||||
|
||||
### Model Support (Veo 3.1 Only)
|
||||
|
||||
Two models defined in `backend/config.py` → `SUPPORTED_MODELS`:
|
||||
- **veo-3.1-generate-preview** (Veo 3.1 Standard): High-quality with reference images + frame interpolation ($0.40/sec)
|
||||
- **veo-3.1-fast-generate-preview** (Veo 3.1 Fast): Optimized speed with frame interpolation only ($0.15/sec)
|
||||
|
||||
**Veo 3.1 Feature Constraints (enforced in `process_video_generation()`):**
|
||||
- **Frame interpolation (last frame)**: Requires 8-second duration, available on BOTH models
|
||||
- **Reference images**: Requires 8-second duration + 16:9 aspect ratio, Standard model ONLY (NOT available in Fast)
|
||||
|
||||
### Authentication Flow
|
||||
|
||||
**Production:** Azure AD SSO via `@azure/msal-react`
|
||||
- Frontend wraps app in `<AuthGuard>` component
|
||||
- Backend has NO auth validation (frontend-only)
|
||||
|
||||
**Development:** Auth bypass when `VITE_DEV_MODE=true`
|
||||
- `<DevAuthWrapper>` component bypasses MSAL
|
||||
- Shows "Dev User" in UI header
|
||||
|
||||
### Storage Architecture
|
||||
- **Temporary images**: Uploaded to GCS `temp_images/` bucket path, cleaned up after processing
|
||||
- **Generated videos**: Downloaded from GCS to local `temp_downloads/` directory
|
||||
- **Automatic cleanup**: Configurable delays (15s small files, 30s large files)
|
||||
|
||||
## Video Generation Flow
|
||||
**Local Storage:**
|
||||
- `backend/temp_downloads/job_{job_id}/`: Per-job folder for videos and images
|
||||
- Files deleted automatically 5 seconds after download
|
||||
- Entire job folder removed with `shutil.rmtree()` for efficiency
|
||||
|
||||
1. **User submits request** via React frontend (prompt + optional image + parameters)
|
||||
2. **Job queuing**: Backend creates job with UUID, adds to global queue, enforces user limits
|
||||
3. **Queue processing**: Background thread picks next job when slot available
|
||||
4. **Image processing** (if provided): validate, convert to JPEG, upload to GCS
|
||||
5. **API call to Google**: Gen AI SDK call with Veo 3.0 model in separate thread
|
||||
6. **Backend polling**: Long-running operation polled every 30 seconds
|
||||
7. **Frontend polling**: Status endpoint polled every 2 seconds for progress updates
|
||||
8. **Video download**: Completed video downloaded from GCS to local temp storage
|
||||
9. **User download**: Video served to user and temp files cleaned up automatically
|
||||
**GCS Storage:**
|
||||
- Temp images: `gs://{bucket}/temp_images/` (cleaned up after processing)
|
||||
- Generated videos: `gs://{bucket}/veo_outputs/{prompt}_{timestamp}/` (cleaned up after download)
|
||||
- Cleanup happens in `cleanup_image_files()` and `delete_blob()` from `utils/storage.py`
|
||||
|
||||
## Important Implementation Details
|
||||
**Download Strategy (backend/routes/api.py:download_video):**
|
||||
- Single video + no image → Direct MP4 download
|
||||
- Multiple videos OR image included → ZIP file download
|
||||
- ZIP created in `process_video_generation()` and stored in job folder
|
||||
|
||||
- **Concurrent processing**: Max 2 simultaneous video generations per backend instance
|
||||
- **Queue management**: FIFO queue with per-user limits to prevent abuse
|
||||
- **Error handling**: Max 3 retries per job with exponential backoff
|
||||
- **File cleanup**: Automatic deletion after download, configurable cleanup endpoint
|
||||
- **CORS**: Development allows localhost, production restricts to specific domain
|
||||
- **Image formats**: All Pillow-supported formats accepted, automatically converted to JPEG
|
||||
- **Model selection**: UI allows choosing between Veo 3.0 (high-quality) and Veo 3.0 Fast (optimized)
|
||||
- **Usage tracking**: Optional webhook integration sends generation data to external endpoint
|
||||
- **Threading**: Job processing and GCS operations use threading for non-blocking execution
|
||||
## Project Structure
|
||||
|
||||
```
|
||||
backend/
|
||||
├── routes/
|
||||
│ ├── api.py # Main API routes (generate, status, download, cancel, retry, delete)
|
||||
│ └── health.py # Health check endpoints
|
||||
├── utils/
|
||||
│ ├── auth.py # Google Cloud credentials
|
||||
│ └── storage.py # GCS operations, image validation/conversion
|
||||
├── app.py # Flask app initialization, CORS setup
|
||||
├── config.py # Config class with model definitions, env vars
|
||||
├── video_generator.py # Core logic: queue system, job processing, Gen AI SDK calls
|
||||
├── requirements.txt
|
||||
├── .env.development # Dev config (localhost CORS, debug mode)
|
||||
└── .env.production # Prod config (strict CORS, optimized)
|
||||
|
||||
frontend/
|
||||
├── src/
|
||||
│ ├── components/
|
||||
│ │ ├── VideoForm.jsx # Main form with conditional Veo 3.1 features
|
||||
│ │ ├── VideoGenerator.jsx # Top-level container
|
||||
│ │ ├── ProgressIndicator.jsx # Job status display
|
||||
│ │ ├── QueueManager.jsx # Queue visualization (3 sections)
|
||||
│ │ ├── Layout.jsx # App layout wrapper
|
||||
│ │ ├── AuthGuard.jsx # MSAL authentication wrapper
|
||||
│ │ └── DevAuthWrapper.jsx # Dev mode auth bypass
|
||||
│ ├── services/
|
||||
│ │ └── api.js # Axios API client
|
||||
│ ├── hooks/
|
||||
│ │ └── useVideoGeneration.js # Custom hook for video generation logic
|
||||
│ ├── config/
|
||||
│ │ └── msalConfig.js # MSAL configuration
|
||||
│ └── App.jsx # Main app component
|
||||
├── .env.development # Dev config (localhost API, VITE_DEV_MODE=true)
|
||||
└── .env.production # Prod config (production API, MSAL enabled)
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
### Backend Environment Variables (.env.development vs .env.production)
|
||||
|
||||
**Critical differences:**
|
||||
- `FLASK_ENV`: `development` vs `production`
|
||||
- `FLASK_DEBUG`: `True` vs `False`
|
||||
- `FRONTEND_URL`: `http://localhost:3000` vs production URL
|
||||
- CORS: Development allows `localhost:3000`, `127.0.0.1:3000` + configured URL
|
||||
|
||||
**Key variables (backend/config.py):**
|
||||
- `PROJECT_ID`, `REGION`, `OUTPUT_GCS_BUCKET_NAME`: GCP configuration
|
||||
- `SERVICE_ACCOUNT_KEY_PATH`: Path to service account JSON (default: `../service-account.json`)
|
||||
- `MODEL_ID`, `MODEL_FAST_ID`: Default model identifiers (overridable per request)
|
||||
- `WEBHOOK_URL`, `WEBHOOK_ENABLED`: Usage tracking webhook integration
|
||||
- `TEMP_DOWNLOAD_PATH`: Local storage path (`./temp_downloads/`)
|
||||
- `MAX_IMAGE_SIZE`: 10MB upload limit
|
||||
- `MIN_IMAGE_RESOLUTION`: (720, 720) minimum
|
||||
|
||||
### Frontend Environment Variables
|
||||
|
||||
**Critical differences:**
|
||||
- `VITE_DEV_MODE`: `true` (bypasses auth) vs `false` (enables MSAL)
|
||||
- `VITE_API_BASE_URL`: `http://localhost:7394` vs production API URL
|
||||
|
||||
**Key variables:**
|
||||
- `VITE_MSAL_CLIENT_ID`, `VITE_MSAL_AUTHORITY`, `VITE_MSAL_REDIRECT_URI`: Azure AD config
|
||||
|
||||
## API Endpoints
|
||||
|
||||
### Main Routes (backend/routes/api.py)
|
||||
|
||||
**Job Management:**
|
||||
- `POST /api/generate`: Start video generation (multipart form data)
|
||||
- `GET /api/status/<job_id>`: Get job status with queue position
|
||||
- `GET /api/download/<job_id>`: Download video/zip (auto-deletes job after 5s)
|
||||
- `GET /api/download/<job_id>/video/<index>`: Download individual video
|
||||
- `GET /api/user-jobs?user_email=<email>`: Get all user jobs
|
||||
- `GET /api/queue-status`: Get queue status (length, processing jobs, concurrent limit)
|
||||
|
||||
**Job Actions:**
|
||||
- `POST /api/cancel/<job_id>`: Cancel queued/processing job
|
||||
- `POST /api/retry/<job_id>`: Retry failed/cancelled job
|
||||
- `DELETE /api/delete/<job_id>`: Completely delete job and files
|
||||
- `DELETE /api/cleanup/<job_id>`: Manual cleanup (full GCS cleanup)
|
||||
- `DELETE /api/cleanup/<job_id>/local`: Fast local-only cleanup
|
||||
|
||||
**Health:**
|
||||
- `GET /health`: Detailed health check with config info
|
||||
- `GET /ping`: Simple ping response
|
||||
|
||||
## Key Implementation Details
|
||||
|
||||
### Multi-Video Generation
|
||||
- Frontend sends `sampleCount` (1-4 videos per request)
|
||||
- Backend makes N API calls to ensure N videos (1 call per video)
|
||||
- Operations polled in parallel, results collected in `all_generated_videos`
|
||||
- Exact count selected: `generated_videos = all_generated_videos[:sample_count]`
|
||||
|
||||
### Image Processing Pipeline (utils/storage.py)
|
||||
1. **Validation**: Check format, resolution, file size
|
||||
2. **Conversion**: All formats → JPEG (Pillow supported formats accepted)
|
||||
3. **Aspect ratio detection**: Auto-detect 16:9 or 9:16
|
||||
4. **Cropping**: Auto-crop to target aspect ratio if needed
|
||||
5. **Upload**: To GCS `temp_images/` with unique blob name
|
||||
6. **Cleanup**: Delete from GCS after video generation completes
|
||||
|
||||
### Error Handling & Retries
|
||||
- Automatic retry for network errors: 503, 500, timeout, connection errors
|
||||
- Max 3 retries with exponential backoff (30s, 60s, 120s)
|
||||
- Retry count tracked in `job_status[job_id]['retry_count']`
|
||||
- Job status shows `retry_1_of_3`, `retry_2_of_3`, etc.
|
||||
- Final failure after max retries updates status to `failed`
|
||||
|
||||
### File Cleanup Strategy
|
||||
- **Auto-cleanup**: Triggered 5 seconds after successful download
|
||||
- **Complete deletion**: `delete_job_completely()` removes from queue, job_status, local files, GCS files
|
||||
- **Efficient folder cleanup**: Uses `shutil.rmtree()` instead of individual file deletion
|
||||
- **GCS cleanup**: Optional in `cleanup_job_files(cleanup_gcs=True/False)` for performance
|
||||
|
||||
### Content Safety Filtering
|
||||
- Handled in `process_video_generation()` after operation completion
|
||||
- Checks `response.rai_media_filtered_count` and `rai_media_filtered_reasons`
|
||||
- Returns user-friendly error message with filter reason
|
||||
|
||||
### Usage Tracking
|
||||
- Webhook integration sends data to configured endpoint
|
||||
- Payload includes: user email, prompt, model, timestamp
|
||||
- Non-blocking: Failures don't interrupt main flow
|
||||
- Disable with `WEBHOOK_ENABLED=false`
|
||||
|
||||
## Development Workflow
|
||||
|
||||
**Quick start:** Run `./run-dev.sh` from project root
|
||||
|
||||
**Manual start:**
|
||||
1. Backend: `cd backend && python app.py` (port 7394)
|
||||
2. Frontend: `cd frontend && npm run dev` (port 3000)
|
||||
|
||||
**Development features:**
|
||||
- Hot reload on both frontend and backend
|
||||
- Auth bypass enabled (no Azure AD needed)
|
||||
- Verbose logging with DEBUG statements
|
||||
- CORS configured for localhost
|
||||
|
||||
**Environment setup:**
|
||||
- Script automatically copies `.env.development` to `.env` for both frontend and backend
|
||||
- Virtual environment required for backend (must be created manually first)
|
||||
- Frontend dependencies installed automatically if missing
|
||||
|
||||
## Production Deployment
|
||||
|
||||
**Backend:**
|
||||
1. Copy `veo-video-generator.service` to `/etc/systemd/system/`
|
||||
2. Update paths in service file
|
||||
3. Enable and start: `sudo systemctl enable veo-video-generator && sudo systemctl start veo-video-generator`
|
||||
|
||||
**Frontend:**
|
||||
1. Build: `cd frontend && npm run build`
|
||||
2. Copy `dist/*` to Apache web root
|
||||
3. Copy `apache-htaccess.txt` to web root as `.htaccess`
|
||||
|
||||
**Apache configuration:**
|
||||
- Main config in `apache.conf` (reverse proxy to backend)
|
||||
- Required modules: `proxy`, `proxy_http`, `rewrite`, `headers`, `expires`
|
||||
- Backend proxied at `/api` endpoint
|
||||
- Frontend served as static files with SPA routing support
|
||||
|
||||
## Important Notes
|
||||
|
||||
- **Veo 3.1 Only**: Application exclusively uses Veo 3.1 models. Veo 3.0 is not supported.
|
||||
- **In-memory job tracking**: `job_status` dict is NOT persisted. Consider Redis for production scaling.
|
||||
- **No queue limits**: Unlimited submissions allowed per user (removed MAX_QUEUE_SIZE_PER_USER)
|
||||
- **Concurrent processing**: Hard limit of 2 jobs (`CONCURRENT_JOB_LIMIT`)
|
||||
- **Service account required**: Must have GCS permissions for bucket operations
|
||||
- **SDK version**: Requires `google-genai>=1.47.0` for Veo 3.1 features
|
||||
- **Image formats**: All Pillow formats accepted, automatically converted to JPEG
|
||||
- **Auto-deletion**: Jobs automatically deleted 5 seconds after download (no user action needed)
|
||||
- **Frontend validation**: No backend auth validation - security relies on frontend MSAL
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
# Google Cloud Configuration
|
||||
PROJECT_ID=optical-414516
|
||||
REGION=us-central1
|
||||
MODEL_ID=veo-3.0-generate-preview
|
||||
MODEL_ID=veo-3.1-generate-preview
|
||||
OUTPUT_GCS_BUCKET_NAME=optical-veo3-test
|
||||
SERVICE_ACCOUNT_KEY_PATH=./service-account.json
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
# Google Cloud Configuration
|
||||
PROJECT_ID=your-project-id
|
||||
REGION=us-central1
|
||||
MODEL_ID=veo-3.0-generate-preview
|
||||
MODEL_ID=veo-3.1-generate-preview
|
||||
OUTPUT_GCS_BUCKET_NAME=your-bucket-name
|
||||
SERVICE_ACCOUNT_KEY_PATH=../service-account.json
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
# Google Cloud Configuration
|
||||
PROJECT_ID=optical-414516
|
||||
REGION=us-central1
|
||||
MODEL_ID=veo-3.0-generate-preview
|
||||
MODEL_ID=veo-3.1-generate-preview
|
||||
OUTPUT_GCS_BUCKET_NAME=optical-veo3-test
|
||||
SERVICE_ACCOUNT_KEY_PATH=./service-account.json
|
||||
|
||||
|
|
|
|||
|
|
@ -7,36 +7,16 @@ class Config:
|
|||
# Google Cloud Configuration
|
||||
PROJECT_ID = os.getenv('PROJECT_ID', 'optical-414516')
|
||||
REGION = os.getenv('REGION', 'us-central1')
|
||||
MODEL_ID = os.getenv('MODEL_ID', 'veo-3.0-generate-preview')
|
||||
MODEL_FAST_ID = os.getenv('MODEL_FAST_ID', 'veo-3.0-fast-generate-preview')
|
||||
MODEL_ID = os.getenv('MODEL_ID', 'veo-3.1-generate-preview')
|
||||
MODEL_FAST_ID = os.getenv('MODEL_FAST_ID', 'veo-3.1-fast-generate-preview')
|
||||
OUTPUT_GCS_BUCKET_NAME = os.getenv('OUTPUT_GCS_BUCKET_NAME', 'optical-veo3-test')
|
||||
SERVICE_ACCOUNT_KEY_PATH = os.getenv('SERVICE_ACCOUNT_KEY_PATH', '../service-account.json')
|
||||
|
||||
# Model configurations
|
||||
# Model configurations - Veo 3.1 Only
|
||||
SUPPORTED_MODELS = {
|
||||
# Veo 3.0 Models
|
||||
'veo-3.0-generate-preview': {
|
||||
'name': 'Veo 3.0',
|
||||
'description': 'High-quality video generation',
|
||||
'price_per_second': 0.40,
|
||||
'speed': 'Standard',
|
||||
'supports_reference_images': False,
|
||||
'supports_last_frame': False,
|
||||
'supports_video_extension': False
|
||||
},
|
||||
'veo-3.0-fast-generate-preview': {
|
||||
'name': 'Veo 3.0 Fast',
|
||||
'description': 'Optimized for speed and cost',
|
||||
'price_per_second': 0.15,
|
||||
'speed': 'Fast',
|
||||
'supports_reference_images': False,
|
||||
'supports_last_frame': False,
|
||||
'supports_video_extension': False
|
||||
},
|
||||
# Veo 3.1 Models
|
||||
'veo-3.1-generate-preview': {
|
||||
'name': 'Veo 3.1',
|
||||
'description': 'Next-gen with reference images & frame interpolation',
|
||||
'name': 'Veo 3.1 Standard',
|
||||
'description': 'High-quality with reference images & frame interpolation',
|
||||
'price_per_second': 0.40,
|
||||
'speed': 'Standard',
|
||||
'supports_reference_images': True,
|
||||
|
|
@ -45,7 +25,7 @@ class Config:
|
|||
},
|
||||
'veo-3.1-fast-generate-preview': {
|
||||
'name': 'Veo 3.1 Fast',
|
||||
'description': 'Optimized Veo 3.1 with last frame interpolation (no reference images)',
|
||||
'description': 'Optimized speed with frame interpolation',
|
||||
'price_per_second': 0.15,
|
||||
'speed': 'Fast',
|
||||
'supports_reference_images': False, # Reference images NOT supported in Fast model
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 2.3 MiB |
|
Before Width: | Height: | Size: 2.3 MiB |
|
Before Width: | Height: | Size: 1.8 MiB |
|
Before Width: | Height: | Size: 1.8 MiB |
|
|
@ -7,34 +7,11 @@ export const VIDEO_GENERATION_OPTIONS = {
|
|||
{ value: '9:16', label: '9:16 (Portrait)' }
|
||||
],
|
||||
models: [
|
||||
// Veo 3.0 Models
|
||||
{
|
||||
value: 'veo-3.0-generate-preview',
|
||||
label: 'Veo 3.0',
|
||||
description: 'High-quality video generation',
|
||||
pricePerSecond: 0.40,
|
||||
speed: 'Standard',
|
||||
recommended: false,
|
||||
supportsReferenceImages: false,
|
||||
supportsLastFrame: false,
|
||||
supportsVideoExtension: false
|
||||
},
|
||||
{
|
||||
value: 'veo-3.0-fast-generate-preview',
|
||||
label: 'Veo 3.0 Fast',
|
||||
description: 'Optimized for speed and cost',
|
||||
pricePerSecond: 0.15,
|
||||
speed: 'Fast',
|
||||
recommended: false,
|
||||
supportsReferenceImages: false,
|
||||
supportsLastFrame: false,
|
||||
supportsVideoExtension: false
|
||||
},
|
||||
// Veo 3.1 Models
|
||||
// Veo 3.1 Models Only
|
||||
{
|
||||
value: 'veo-3.1-generate-preview',
|
||||
label: 'Veo 3.1',
|
||||
description: 'Next-gen with reference images & frame interpolation',
|
||||
label: 'Veo 3.1 Standard',
|
||||
description: 'High-quality with reference images & frame interpolation',
|
||||
pricePerSecond: 0.40,
|
||||
speed: 'Standard',
|
||||
recommended: true,
|
||||
|
|
@ -45,7 +22,7 @@ export const VIDEO_GENERATION_OPTIONS = {
|
|||
{
|
||||
value: 'veo-3.1-fast-generate-preview',
|
||||
label: 'Veo 3.1 Fast',
|
||||
description: 'Optimized Veo 3.1 with last frame interpolation (no reference images)',
|
||||
description: 'Optimized speed with frame interpolation',
|
||||
pricePerSecond: 0.15,
|
||||
speed: 'Fast',
|
||||
recommended: false,
|
||||
|
|
|
|||