Skip to content

shotsan/video-edits

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Video Editor with AI Chat

A modern video editing application with AI-powered chat interface, featuring Azure Sora video generation and GPT-4.1 intelligent command parsing.

Features

  • 🎬 Video Editing: Trim, resize, rotate, apply effects (grayscale, brightness, speed)
  • 🤖 AI Chat Interface: Natural language commands with GPT-4.1 fallback
  • 🎨 Auto Color Correction: AI-powered color grading
  • 📝 Text Overlays: Add and manage text overlays
  • 🎥 Azure Sora Integration: Generate videos from text prompts
  • 📱 Social Media Formats: One-click TikTok/Reels/Shorts formatting (1080x1920)
  • 📜 Edit History: Track and review all edits

Tech Stack

Frontend

  • React + Vite
  • Material-UI (MUI)
  • Axios for API calls
  • Modern glassmorphism design

Backend

  • FastAPI (Python)
  • MoviePy for video processing
  • Azure OpenAI (Sora + GPT-4.1-mini)
  • OpenAI Python SDK

Prerequisites

  • Node.js 20.19+ or 22.12+
  • Python 3.9+
  • Azure OpenAI API key

Setup

1. Clone Repository

git clone <your-repo-url>
cd video-edits

2. Backend Setup

cd backend

# Create virtual environment
python3 -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Create .env file
cp .env.example .env
# Edit .env and add your AZURE_API_KEY

Backend .env file:

AZURE_API_KEY=your_azure_openai_api_key_here

3. Frontend Setup

cd ../frontend

# Install dependencies
npm install

# Build for production
npm run build

Running the Application

Start Backend Server

cd backend
source venv/bin/activate
uvicorn main:app --reload --host 0.0.0.0 --port 8000

Backend will run on http://localhost:8000

Start Frontend Server

cd frontend
npm run preview

Frontend will run on http://localhost:4173

Usage

Chat Commands

The AI chat supports both fuzzy matching and GPT-4.1 intelligent parsing:

Video Generation:

  • sora a cat playing with yarn
  • generate a video of sunset over ocean

Editing:

  • trim to 10 seconds
  • keep first 5 seconds
  • make it black and white
  • rotate the video
  • make it brighter
  • make it faster

Social Media Formatting:

  • create tiktok video → Resize to 1080x1920 (9:16)
  • instagram reels → Resize to 1080x1920
  • make it vertical → Resize to 1080x1920

Text Overlays:

  • add text saying hello world

Color Correction:

  • auto color → Uses current frame as reference

API Endpoints

Backend (http://localhost:8000)

  • POST /upload - Upload video file
  • POST /trim - Trim and/or resize video
  • POST /effects - Apply effects (rotate, grayscale, brightness, speed)
  • POST /color-correct - Auto color correction
  • POST /overlay-text - Add text overlay
  • POST /generate - Generate video with Sora
  • POST /parse-command - Parse natural language with GPT-4.1
  • GET /files/{filename} - Serve uploaded/processed files
  • GET /recent-edits - Get recent edit history

Project Structure

video-edits/
├── backend/
│   ├── main.py              # FastAPI server
│   ├── gpt_parser.py        # GPT-4.1 command parser
│   ├── sora_generator.py    # Azure Sora integration
│   ├── video_processor.py   # Video editing functions
│   ├── requirements.txt     # Python dependencies
│   └── .env.example         # Environment template
├── frontend/
│   ├── src/
│   │   ├── App.jsx          # Main app component
│   │   ├── components/
│   │   │   ├── ChatPanel.jsx              # AI chat interface
│   │   │   ├── EditorPlayground.jsx       # Video player & controls
│   │   │   ├── ColorCorrectionDialog.jsx  # Color correction UI
│   │   │   └── ...
│   │   └── index.css        # Global styles
│   ├── package.json
│   └── vite.config.js
└── README.md

Environment Variables

Backend

Variable Description Required
AZURE_API_KEY Azure OpenAI API key (for Sora & GPT-4.1) Yes

Development

Backend Development

cd backend
source venv/bin/activate
uvicorn main:app --reload --host 0.0.0.0 --port 8000

Frontend Development

cd frontend
npm run dev  # Development server with hot reload

Troubleshooting

"Module not found: requests"

cd backend
source venv/bin/activate
pip install requests

"AZURE_API_KEY not set"

Make sure you've created .env file in the backend/ directory with your API key.

Node.js version warning

Upgrade to Node.js 20.19+ or 22.12+:

nvm install 22
nvm use 22

License

MIT

Credits

Built with:

About

Agentic Video Editor

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages