Skip to content

cmelan/movieMaker

Repository files navigation

🎬 Movie Maker - AI Video Generation System

A complete Python system for generating AI videos using Google's Vertex AI Veo 2.0 model. Features segment-based story generation, automatic concatenation, and the "Ece & Jonas - Simit Surprise!" cultural friendship story.

🌟 Features

  • 50-Second Story Generation: Complete "Simit Surprise" cultural story
  • Segment-Based Pipeline: 7 individual segments with smooth transitions
  • Content Filter Compliant: Safe, child-friendly content generation
  • FFmpeg Integration: Professional video concatenation with crossfade transitions
  • Cultural Education: Teaches diversity and friendship through food sharing

πŸš€ Quick Start

1. Prerequisites

  • Google Cloud Project with billing enabled
  • Vertex AI API enabled in us-central1 region
  • Python 3.7+
  • gcloud CLI installed and configured

2. Installation

# Clone or download this project
cd MovieProject

# Install dependencies
pip install -r requirements.txt

# Authenticate with Google Cloud
gcloud auth application-default login

3. Configuration

Create your config/config.yaml:

google_project_id: "your-project-id"
google_region: "us-central1"

4. Generate Your First Video

python example.py

πŸ“ Project Structure

MovieProject/
β”œβ”€β”€ video_generator.py          # Main video generation engine
β”œβ”€β”€ example.py                  # Usage examples
β”œβ”€β”€ config/config.yaml         # Project configuration
β”œβ”€β”€ service-account-key.json   # Google Cloud credentials (optional)
β”œβ”€β”€ requirements.txt           # Python dependencies
β”œβ”€β”€ requirements.md           # Detailed system requirements
β”œβ”€β”€ generated_videos/         # Output directory (auto-created)
└── README.md                # This file

🎬 Usage

Basic Usage

from video_generator import VideoGenerator

# Initialize
generator = VideoGenerator()

# Generate a video
video_path = generator.generate(
    prompt="A majestic elephant walking through a forest, cinematic lighting",
    duration=8  # seconds
)

print(f"Video saved: {video_path}")

Advanced Usage

# Custom parameters
video_path = generator.generate(
    prompt="Your detailed video description here",
    duration=5,  # 5-8 seconds supported
    model_id="veo-2.0-generate-001"  # Veo 2.0 model
)

βš™οΈ Configuration Options

Video Parameters

  • Duration: 5-8 seconds
  • Aspect Ratio: 16:9 (fixed)
  • Resolution: 720p
  • Format: MP4
  • Frame Rate: 24 FPS

Model Settings

  • Model: veo-2.0-generate-001 (Generally Available)
  • Region: us-central1 (REQUIRED - only working region)
  • Prompt Enhancement: Automatically enabled
  • Watermark: Enabled by default

πŸ› οΈ Setup Instructions

Google Cloud Setup

  1. Create Project & Enable APIs:
# Set your project
gcloud config set project your-project-id

# Enable Vertex AI API
gcloud services enable aiplatform.googleapis.com
  1. Authentication (Choose one method):

Option A: Application Default Credentials (Recommended)

gcloud auth application-default login

Option B: Service Account

# Create service account
gcloud iam service-accounts create veo-generator

# Add required roles
gcloud projects add-iam-policy-binding your-project-id \
    --member="serviceAccount:veo-generator@your-project-id.iam.gserviceaccount.com" \
    --role="roles/aiplatform.user"

# Download key
gcloud iam service-accounts keys create service-account-key.json \
    --iam-account=veo-generator@your-project-id.iam.gserviceaccount.com

Verify Setup

# Test authentication
gcloud auth list

# Test API access
python -c "from video_generator import VideoGenerator; print('βœ… Setup successful!')"

πŸ“Š Performance & Specifications

Generation Performance

  • Typical Generation Time: 45-90 seconds
  • Success Rate: >95% with proper configuration
  • File Size: ~1-2 MB per second of video
  • Timeout: 15 minutes maximum

Video Quality

  • Resolution: 1280x720 (720p)
  • Encoding: H.264/MP4
  • Quality: High-definition, cinematic
  • Audio: Not supported (Veo 2.0 is video-only)

πŸ’‘ Tips for Better Videos

Prompt Writing Best Practices

Good Prompts Include:

  • Specific subject and action
  • Visual style and mood
  • Camera angle/movement
  • Lighting conditions
  • Quality descriptors

Example Good Prompts:

"A majestic African elephant walking slowly through a lush green forest, dappled sunlight filtering through trees, cinematic wide shot, 4K quality, natural movement"

"Ocean waves gently crashing on a pristine beach at golden hour, warm sunset lighting, peaceful atmosphere, slow motion, cinematic"

"A red sports car driving on a winding mountain road, dramatic lighting, aerial view, high-speed cinematography"

Avoid:

  • Vague descriptions
  • Multiple unrelated subjects
  • Complex scene changes
  • Text or logos in videos

🚨 Troubleshooting

Common Issues

Authentication Error:

gcloud auth application-default login

404 Model Not Found:

  • Ensure you're using us-central1 region
  • Verify Vertex AI API is enabled
  • Check project ID in config

Long Generation Times:

  • Normal: 45-90 seconds
  • If >5 minutes, check logs for errors
  • Timeout after 15 minutes

Permission Denied:

  • Verify IAM roles: Vertex AI User
  • Check project billing is enabled
  • Ensure API is enabled in correct region

Debug Mode

Enable detailed logging:

import logging
logging.basicConfig(level=logging.DEBUG)

generator = VideoGenerator()

πŸ”§ System Requirements

For detailed technical requirements, see requirements.md.

Minimum Requirements

  • Python: 3.7+
  • Memory: 1GB RAM
  • Storage: 100MB for dependencies + video storage
  • Network: Stable internet connection
  • Google Cloud: Project with billing enabled

Dependencies

  • requests - HTTP client
  • pyyaml - Configuration parsing
  • google-auth - Authentication
  • google-cloud-aiplatform - Vertex AI SDK

πŸ“š API Reference

This implementation follows the Google Cloud Vertex AI Video Generation API.

Key Implementation Details

  • Uses predictLongRunning for video generation requests
  • Uses fetchPredictOperation for status polling (not standard operation polling)
  • Follows Google Console parameter format exactly
  • Implements automatic token refresh via gcloud CLI

🀝 Support

For Issues:

  1. Check troubleshooting section above
  2. Verify Google Cloud setup
  3. Review requirements.md for detailed specs
  4. Check Google Cloud Console for API quotas/billing

For Questions:

  • Review the example code in example.py
  • Check the detailed requirements in requirements.md
  • Consult Google Cloud documentation

🎯 What Makes This Implementation Special

βœ… Proven Working: Based on successful reverse-engineering of Google Console guidance
βœ… Optimized Performance: 45-90 second generation times vs. previous timeout issues
βœ… Correct Region: Uses us-central1 (the only working region despite documentation)
βœ… Proper Parameters: String format for durationSeconds and other critical settings
βœ… Reliable Polling: Uses fetchPredictOperation endpoint for consistent results
βœ… Simple & Clean: Minimal dependencies, clear code structure

Happy video generating! 🎬✨

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages